[Tutor] special attributes naming confusion

Prasad, Ramit ramit.prasad at jpmorgan.com
Wed Jun 6 21:30:27 CEST 2012

> My question is how was I supposed to kinow that the function I call using the
> name iter() is implemented using the name __iter__()?
> Is there a rule that describes when I would implement an attribute name with
> leading and trailing double underscores, and then call it without those
> underscores? How many names like this exist in Python? Are these special cases
> or is there a general rule that leading and trailing double underscores get
> dropped when calling functions that were implemented with these names? I'm
> trying to understand the big picture as far as how Python works when it comes
> to this situation. Thanks.

They are listed here http://docs.python.org/reference/datamodel.html#specialnames 


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  

More information about the Tutor mailing list