Re: magic names in python

2007-06-05 Thread Lenard Lindstrom
Steven D'Aprano wrote: > On Tue, 05 Jun 2007 18:08:31 +, Lenard Lindstrom wrote: > >> Steven D'Aprano wrote: >>> On Mon, 04 Jun 2007 22:19:35 +, Lenard Lindstrom wrote: >>> What is "magic" about __init__ and __repr__? They are identifiers just like "foo" or "JustAnotherClass". T

Re: magic names in python

2007-06-05 Thread Steven D'Aprano
On Tue, 05 Jun 2007 18:08:31 +, Lenard Lindstrom wrote: > Steven D'Aprano wrote: >> On Mon, 04 Jun 2007 22:19:35 +, Lenard Lindstrom wrote: >> >>> What is "magic" about __init__ and __repr__? They are identifiers just >>> like "foo" or "JustAnotherClass". They have no special meaning to

Re: magic names in python

2007-06-05 Thread Lenard Lindstrom
Steven D'Aprano wrote: > On Mon, 04 Jun 2007 22:19:35 +, Lenard Lindstrom wrote: > >> What is "magic" about __init__ and __repr__? They are identifiers just >> like "foo" or "JustAnotherClass". They have no special meaning to the >> Python compiler. The leading and trailing double underscore

Re: magic names in python

2007-06-05 Thread per9000
hem). > > > I guess all programming languages have magic names to some extent > > (f.x. classes in the "C-family" have constructors that must have the > > same name as the class (foo::foo) instead of foo.__init__). > > > I just used a search engine a little on this

Re: magic names in python

2007-06-05 Thread ai
y" have constructors that must have the > same name as the class (foo::foo) instead of foo.__init__). > > I just used a search engine a little on this topic and I found no > comprehensive list of magic names in python. > > So my questions: > * is there a comprehensive

Re: magic names in python

2007-06-05 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, per9000 wrote: > Still, I have problems with "magic" functions, similar to magic > numbers: http://en.wikipedia.org/wiki/Magic_number_%28programming%29 > f.x. calling all member-functions of a class to close files as > illustrated in a previous post, or PyUnits magic "test*

Re: magic names in python

2007-06-05 Thread per9000
On 4 Juni, 10:19, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > [...] > > Now I'm a little confused. What does this have to do with magic names? I > thought you are talking about names that start and end with two > underscores (`__magic__`)!? Indeed I am talking about two things at onc

Re: magic names in python

2007-06-04 Thread Steven D'Aprano
On Mon, 04 Jun 2007 22:19:35 +, Lenard Lindstrom wrote: > What is "magic" about __init__ and __repr__? They are identifiers just > like "foo" or "JustAnotherClass". They have no special meaning to the > Python compiler. The leading and trailing double underscores represent > no special inca

Re: magic names in python

2007-06-04 Thread Lenard Lindstrom
> same name as the class (foo::foo) instead of foo.__init__). > > I just used a search engine a little on this topic and I found no > comprehensive list of magic names in python. > > So my questions: > * is there a comprehensive list of magic names in python (so far i > k

Re: magic names in python

2007-06-04 Thread Facundo Batista
Josiah Carlson wrote: > I don't believe that there is a full list of all __magic__ methods. The > operator module has a fairly extensive listing of functions that call > such methods, but I know that some have been left out. There IS a full documentation of this special methods:: http://doc

Re: magic names in python

2007-06-04 Thread markacy
quot; have constructors that must have the > same name as the class (foo::foo) instead of foo.__init__). > > I just used a search engine a little on this topic and I found no > comprehensive list of magic names in python. > > So my questions: > * is there a comprehensive l

Re: magic names in python

2007-06-04 Thread Diez B. Roggisch
s names > matching "close_*_file". > > I would consider this an ugly way of solving it. > > [in my taste: NICER] > I'd perhaps add file-handles to some list (and encourage inherited > classes to use this list) and close everything in the list. I would > not use

Re: magic names in python

2007-06-04 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, per9000 wrote: > On Jun 4, 9:11 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> In <[EMAIL PROTECTED]>, per9000 wrote: >> > >> > [...] >> > >> > So another question emerges: >> > * is the use of magic names encouraged and/or part of good coding >> > practice. >>

Re: magic names in python

2007-06-04 Thread per9000
On Jun 4, 9:11 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, per9000 wrote: > > > > [...] > > > > So another question emerges: > > * is the use of magic names encouraged and/or part of good coding > > practice. > > What do you mean by "use"? Implement them to o

Re: magic names in python

2007-06-04 Thread Josiah Carlson
per9000 wrote: > So my questions: > * is there a comprehensive list of magic names in python (so far i > know of __init__ and __repr__)? > * are these lists complete or can magic names be added over time (to > the python "core")? > * are magic names the same in d

Re: magic names in python

2007-06-04 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, per9000 wrote: > I just used a search engine a little on this topic and I found no > comprehensive list of magic names in python. They are usually mentioned in parts of the docs where the relevant functionality is explained. For example in `Special method na

magic names in python

2007-06-03 Thread per9000
d a search engine a little on this topic and I found no comprehensive list of magic names in python. So my questions: * is there a comprehensive list of magic names in python (so far i know of __init__ and __repr__)? * are these lists complete or can magic names be added over time (to the py