[Tutor] Bad time to get into Python?

Eric Brunson brunson at brunson.com
Mon Feb 4 18:26:04 CET 2008


Dotan Cohen wrote:
> On 03/02/2008, Kent Johnson <kent37 at tds.net> wrote:
>   
>> I did a little research on the question of running the same script
>>  unmodified in Python 2.6 and 3.0. It seems that there is no consensus
>>  opinion and it may depend on your personal tolerance for compatibility
>>  cruft. Here is a c.l.py thread of interest:
>>  http://groups.google.com/group/comp.lang.python/browse_thread/thread/4e0a71d86e80d0f9/8e7fb527e32d3064?hl=en&
>>
>>
>>  Kent
>>
>>     
>
> Like I mentioned earlier, I'm more interested in my learning being 3.x
> compatible, not my scripts. If all I need to do is learn to print("")
> instead of print"" then that's fine.
>   

Basically, if you follow a few simple rules you'll avoid 99% of 3.0 
incompatibilities:

1) Always use:

    print( "like it was a function" )
    rather than:
    print "like it was a statement"

2) Always use:

    class NewStyle( object ):
    rather than:
    class OldStyle():

3) Never try to be clever with side effects of internal implementations 
of language


Pretty much everything else you learn in 2.5 will be applicable in 3.0.

(Others on the list, please feel free to extend my rules with things 
that you feel will be important)

> Dotan Cohen
>
> http://what-is-what.com
> http://gibberish.co.il
> א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
>
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080204/8d630ad4/attachment.htm 


More information about the Tutor mailing list