Re: python: what's with the underscores?

alex, again... read the class tutorial. it explains that.
On Dec 27, 2009, at 3:13 PM, Alex Hall wrote:

> Okay, but (A) I did not think Python had constructor methods and (B) why do I 
> always see methodName(self): like in your example?
> 
> 
> Have a great day,
> Alex
> New email address: mehgcap@xxxxxxxxx
> ----- Original Message ----- From: "edward" <personal.edward@xxxxxxxxx>
> To: <programmingblind@xxxxxxxxxxxxx>
> Sent: Sunday, December 27, 2009 17:11
> Subject: RE: python: what's with the underscores?
> 
> 
>> Two underscores signify either a constructor method or a built in method I
>> think.  Like the str method.  If you want to define string formatting with
>> your class its defined by two underscores before and after the method name.
>> example __str__(self):
>> 
>> 
>> -----Original Message-----
>> From: programmingblind-bounce@xxxxxxxxxxxxx
>> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Alex Hall
>> Sent: Sunday, December 27, 2009 3:58 PM
>> To: Blind Programming List
>> Subject: python: what's with the underscores?
>> 
>> In python, why are some method names surrounded by two underscores? Even
>> some filenames have these two underscores, though I imagine that is more of
>> a convention than anything else. What do the underscores mean, if anything?
>> 
>> 
>> Have a great day,
>> Alex
>> New email address: mehgcap@xxxxxxxxx
>> 
>> __________
>> View the list's information and change your settings at
>> http://www.freelists.org/list/programmingblind
>> 
>> __________
>> View the list's information and change your settings at
>> http://www.freelists.org/list/programmingblind
> 
> __________
> View the list's information and change your settings at 
> http://www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind

Other related posts: