Newbie observations

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Wed Dec 19 07:53:01 EST 2007


MartinRinehart at gmail.com a écrit :
>> My 2 cents.
> 
> Eurozone? That would be 3 cents US.
> 
> I meant colon, not semi-colon. I did the tutorial. I did objects 3
> times.

That's not where you'll learn the inners of Python's object model. You 
may want to browse this thread for some hints:
http://groups.google.com/group/comp.lang.python/browse_frm/thread/7943ab9f93854eb6

> In Java, the agreed convention is to use lowerAndUpper naming for
> member variables.  (See http://www.MartinRinehart.com/articles/code-conventions.html#5_1
> .)

It's also the convention used for local variables, so unless you do 
explicitely use the 'this' reference, it's not clear whether a name is a 
local variable or a member variable - you have to check the function's 
code for local variables declarations, then eventually the class 
definition, then the parent's class etc.

> 
> 10 days is not enough. But I don't have any more clarity in my Python
> classes than I did in Java.   Just more "self"s.

The "more self's" already gives you more clarity, even if you don't 
realize it yet. Now 10 days is not also not enough to switch from Java 
thinking to idiomatic Python. C/C++/Java programmer discovering Python 
is a well-known pattern here - I even suspect it to be the most common 
case !-)



More information about the Python-list mailing list