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
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
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
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
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
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*
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
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
> 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
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
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
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
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.
>>
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
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
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
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
17 matches
Mail list logo