Re: Documentaion of dunder methods

2015-05-26 Thread Mark Lawrence
On 26/05/2015 04:30, Rustom Mody wrote: On Tuesday, May 26, 2015 at 8:48:11 AM UTC+5:30, Steven D'Aprano wrote: On Tue, 26 May 2015 12:17 pm, Steven D'Aprano wrote: In other words, dunder methods are reserved for use by the core developers for the use of the Python interpreter. Er, that's ea

Re: Documentaion of dunder methods

2015-05-26 Thread Steven D'Aprano
On Tuesday 26 May 2015 14:34, Ian Kelly wrote: >> Apart from PEP 8, is this documented anywhere in the official >> documentation? If so, I have been unable to find it. > > https://docs.python.org/3/reference/lexical_analysis.html#reserved- classes-of-identifiers That's the bunny! Thanks for th

Re: Documentaion of dunder methods

2015-05-25 Thread Ian Kelly
On Mon, May 25, 2015 at 8:17 PM, Steven D'Aprano wrote: > PEP 8 states that developers should never invent their own dunder methods: > > __double_leading_and_trailing_underscore__ : > "magic" objects or attributes that live in user-controlled > namespaces. E.g. __init__ , __imp

Re: Documentaion of dunder methods

2015-05-25 Thread Rustom Mody
On Tuesday, May 26, 2015 at 8:48:11 AM UTC+5:30, Steven D'Aprano wrote: > On Tue, 26 May 2015 12:17 pm, Steven D'Aprano wrote: > > > In other words, dunder methods are reserved for use by the core developers > > for the use of the Python interpreter. > > Er, that's easy to misinterpret. Let me tr

Re: Documentaion of dunder methods

2015-05-25 Thread Steven D'Aprano
On Tue, 26 May 2015 12:17 pm, Steven D'Aprano wrote: > In other words, dunder methods are reserved for use by the core developers > for the use of the Python interpreter. Er, that's easy to misinterpret. Let me try rewording: You should not invent new dunder methods. And if possible, you should

Re: Documentaion of dunder methods

2015-05-25 Thread Rustom Mody
On Tuesday, May 26, 2015 at 7:47:41 AM UTC+5:30, Steven D'Aprano wrote: > PEP 8 states that developers should never invent their own dunder methods: > > __double_leading_and_trailing_underscore__ : > "magic" objects or attributes that live in user-controlled > namespaces. E.g.

Documentaion of dunder methods

2015-05-25 Thread Steven D'Aprano
PEP 8 states that developers should never invent their own dunder methods: __double_leading_and_trailing_underscore__ : "magic" objects or attributes that live in user-controlled namespaces. E.g. __init__ , __import__ or __file__ . Never invent such names; only use th