Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #2301 > unrolled thread
| Started by | "eryksun ()" <eryksun@gmail.com> |
|---|---|
| First post | 2011-03-31 14:43 -0700 |
| Last post | 2011-03-31 17:08 -0600 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.lang.python
Re: Learn Python the Hardway exercise 11 question 4 "eryksun ()" <eryksun@gmail.com> - 2011-03-31 14:43 -0700
Re: Learn Python the Hardway exercise 11 question 4 geremy condra <debatem1@gmail.com> - 2011-03-31 14:57 -0700
Re: Learn Python the Hardway exercise 11 question 4 Chris Angelico <rosuav@gmail.com> - 2011-04-01 09:14 +1100
Re: Learn Python the Hardway exercise 11 question 4 John Bokma <john@castleamber.com> - 2011-03-31 17:08 -0600
| From | "eryksun ()" <eryksun@gmail.com> |
|---|---|
| Date | 2011-03-31 14:43 -0700 |
| Subject | Re: Learn Python the Hardway exercise 11 question 4 |
| Message-ID | <493bab97-ec24-450d-8366-5e8302b57181@glegroupsg2000goo.googlegroups.com> |
On Thursday, March 31, 2011 4:35:42 PM UTC-4, Chris Angelico wrote:
>
> I was trolling, I know the reasons behind it. Anyway, most people
> don't share code by email! (Actually, since you seem to be the author
> of that page - could you address that particular point? I think it's
> probably as big an issue as any of the others, to today's coders -
> "code semantics get destroyed by forums/email/etc/etc/etc".)
>
> Solution: All emailed code should begin with
> from __future__ import braces
> And there you are, out of your difficulty at once!
You could paste it as a base64 stream, such as:
> ZGVmIHNwYW0oKToNCiAgICBwcmludCAiU3BhbSEg
> TG92ZWx5IHNwYW0hIExvdmVseSBzcGFtISI=
Then decode and exec:
In [1]: import base64
In [2]: %cpaste
Pasting code; enter '--' alone on the line to stop.
:code="""> ZGVmIHNwYW0oKToNCiAgICBwcmludCAiU3BhbSEg
:> TG92ZWx5IHNwYW0hIExvdmVseSBzcGFtISI="""
:--
In [3]: print base64.b64decode(code)
def spam():
print "Spam! Lovely spam! Lovely spam!"
In [4]: exec(base64.b64decode(code))
In [5]: spam()
Spam! Lovely spam! Lovely spam!
[toc] | [next] | [standalone]
| From | geremy condra <debatem1@gmail.com> |
|---|---|
| Date | 2011-03-31 14:57 -0700 |
| Message-ID | <mailman.48.1301608656.2990.python-list@python.org> |
| In reply to | #2301 |
On Thu, Mar 31, 2011 at 2:43 PM, eryksun () <eryksun@gmail.com> wrote: > On Thursday, March 31, 2011 4:35:42 PM UTC-4, Chris Angelico wrote: >> >> I was trolling, I know the reasons behind it. Anyway, most people >> don't share code by email! (Actually, since you seem to be the author >> of that page - could you address that particular point? I think it's >> probably as big an issue as any of the others, to today's coders - >> "code semantics get destroyed by forums/email/etc/etc/etc".) >> >> Solution: All emailed code should begin with >> from __future__ import braces >> And there you are, out of your difficulty at once! > > You could paste it as a base64 stream, such as: > > >> ZGVmIHNwYW0oKToNCiAgICBwcmludCAiU3BhbSEg >> TG92ZWx5IHNwYW0hIExvdmVseSBzcGFtISI= > > > Then decode and exec: > > In [1]: import base64 > > In [2]: %cpaste > Pasting code; enter '--' alone on the line to stop. > :code="""> ZGVmIHNwYW0oKToNCiAgICBwcmludCAiU3BhbSEg > :> TG92ZWx5IHNwYW0hIExvdmVseSBzcGFtISI=""" > :-- > > In [3]: print base64.b64decode(code) > def spam(): > print "Spam! Lovely spam! Lovely spam!" > > In [4]: exec(base64.b64decode(code)) > > In [5]: spam() > Spam! Lovely spam! Lovely spam! I know it's tongue-in-cheek, but please, please, please don't do this. Geremy Condra
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2011-04-01 09:14 +1100 |
| Message-ID | <mailman.49.1301609672.2990.python-list@python.org> |
| In reply to | #2301 |
On Fri, Apr 1, 2011 at 8:57 AM, geremy condra <debatem1@gmail.com> wrote: > I know it's tongue-in-cheek, but please, please, please don't do this. It would be more secure to base64 it and then rot13 the output. Chris Angelico /me is feeling evil today === Begin Base-Rotten 64-13 === FKDtq291oTDtLzHtoJ9lMFOmMJA1pzHtqT8tLzSmMGL0VTy0VTShMPO0nTIhVUWiqQRmVUEbMFOi qKEjqKDhQDbAPxAbpzymVRShM2IfnJAiQDbioJHtnKZtMzIyoTyhMlOyqzyfVUEiMTS5QDb= === End Base-Rotten 64-13 ===
[toc] | [prev] | [next] | [standalone]
| From | John Bokma <john@castleamber.com> |
|---|---|
| Date | 2011-03-31 17:08 -0600 |
| Message-ID | <8739m23n2z.fsf@castleamber.com> |
| In reply to | #2308 |
Chris Angelico <rosuav@gmail.com> writes:
> On Fri, Apr 1, 2011 at 8:57 AM, geremy condra <debatem1@gmail.com> wrote:
>> I know it's tongue-in-cheek, but please, please, please don't do this.
>
> It would be more secure to base64 it and then rot13 the output.
Rot-13 twice, to make it even more secure ;-)
--
John Bokma j3b
Blog: http://johnbokma.com/ Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http://castleamber.com/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web