mm a écrit :
>
> Yes, it was the (), equivalent to thiks like new() create new object
> from class xy.
Yeps. In Python there's no 'new' operator. Instead, classes are
themselves 'callable' objects, acting as instance factory. It's very
handy since it let's you replace a class with a factory fu
Neil Cerutti wrote:
> On 2007-01-03, Jussi Salmela <[EMAIL PROTECTED]> wrote:
>> hg kirjoitti:
>>> mm wrote:
>>>
Yes, it was the (), equivalent to thiks like new() create new object
from class xy.
> s1.append(Word)
s1.append(Word())
But I was looking for a "struct"
mm wrote:
> But I was looking for a "struct" equivalent like in c/c++.
> And/or "union". I can't find it.
class Honk(object):
pass
test = Honk()
test.spam = 4
test.eggs = "Yum"
Is it this what you're looking for?
> Maybe you know a source (URL) "Python for c/c++ programmers" or
> things li
On 2007-01-03, Jussi Salmela <[EMAIL PROTECTED]> wrote:
> hg kirjoitti:
>> mm wrote:
>>
>>> Yes, it was the (), equivalent to thiks like new() create new object
>>> from class xy.
s1.append(Word)
>>> s1.append(Word())
>>>
>>> But I was looking for a "struct" equivalent like in c/c++.
>>> An
hg kirjoitti:
> mm wrote:
>
>> Yes, it was the (), equivalent to thiks like new() create new object
>> from class xy.
>>> s1.append(Word)
>> s1.append(Word())
>>
>> But I was looking for a "struct" equivalent like in c/c++.
>> And/or "union". I can't find it.
>>
>> Maybe you know a source (URL)
mm wrote:
>
> Yes, it was the (), equivalent to thiks like new() create new object
> from class xy.
>> s1.append(Word)
> s1.append(Word())
>
> But I was looking for a "struct" equivalent like in c/c++.
> And/or "union". I can't find it.
>
> Maybe you know a source (URL) "Python for c/c++ prog
Yes, it was the (), equivalent to thiks like new() create new object
from class xy.
> s1.append(Word)
s1.append(Word())
But I was looking for a "struct" equivalent like in c/c++.
And/or "union". I can't find it.
Maybe you know a source (URL) "Python for c/c++ programmers" or things
like that