On 07Aug2019 16:36, Terry Reedy wrote:
On 8/7/2019 3:26 PM, Manfred Lotz wrote:
On Wed, 07 Aug 2019 14:39:00 -0400
Dennis Lee Bieber wrote:
On Wed, 7 Aug 2019 20:11:15 +0200, Manfred Lotz
declaimed the following:
More often I see something like this:
class Myclass:
...
but sometimes I see
On 8/7/2019 3:26 PM, Manfred Lotz wrote:
On Wed, 07 Aug 2019 14:39:00 -0400
Dennis Lee Bieber wrote:
On Wed, 7 Aug 2019 20:11:15 +0200, Manfred Lotz
declaimed the following:
Hi there,
More often I see something like this:
class Myclass:
...
but sometimes I see
class Myclass(object):
...
On Wed, 07 Aug 2019 14:39:00 -0400
Dennis Lee Bieber wrote:
> On Wed, 7 Aug 2019 20:11:15 +0200, Manfred Lotz
> declaimed the following:
>
> >Hi there,
> >More often I see something like this:
> >
> >class Myclass:
> >...
> >
> >
> >but sometimes I see
> >
> >class Myclass(object):
> >...
> >
>
harryos a écrit :
hi
i have seen some class definitions like
class MyClass(object):
def __init__(self):
what does the object keyword
It's not a keyword.
inside the braces in MyClass() mean?
Answer is here:
http://docs.python.org/tut/node11.html#SECTION00115000
harryos wrote:
hi
i have seen some class definitions like
class MyClass(object):
def __init__(self):
what does the object keyword inside the braces in MyClass() mean?
Has it got any significance?
thanks in advance
harry
It is a syntax used for 'new type' classes, not so new a
On Fri, 29 Aug 2008 02:50:57 -0700 (PDT), harryos wrote:
> class MyClass(object):
> def __init__(self):
>
>
> what does the object keyword inside the braces in MyClass() mean?
> Has it got any significance?
It's inheritance. MyClass class inherits from object class.
Check out poin
harryos wrote:
> hi
> i have seen some class definitions like
>
> class MyClass(object):
> def __init__(self):
>
>
> what does the object keyword inside the braces in MyClass() mean?
> Has it got any significance?
It indicates a so-called new-style-class. The new style classes h
On Aug 5, 12:53 am, Michele Simionato <[EMAIL PROTECTED]>
wrote:
> BTW, since I do not really follow python-dev, do you know
> if some consensus was reached on the issue of adding an ordered dict
> implementation to the standard library?
I believe it has been deferred to 2.7/3.1.
--
http://mail.p
On Aug 10, 12:14 am, thebjorn
> > FWIW, I have just finished translating the first
> > part of the article and I have posted it on my
> > blog on Artima:
>
> >http://www.artima.com/weblogs/viewpost.jsp?thread=236234
>
> Great feature and great article! I haven't used ABCs yet, so my
> initial inst
On Aug 9, 7:55 am, Michele Simionato <[EMAIL PROTECTED]>
wrote:
> On Aug 5, 5:05 am, Michele Simionato
>
> > Yep. Seehttp://stacktrace.it/articoli/2008/01/metaclassi-python-3000
> > (I am working on an English translation these days,
> > but for the moment you can use Google Translator).
>
> > M.
On Aug 5, 5:05 am, Michele Simionato
> Yep. Seehttp://stacktrace.it/articoli/2008/01/metaclassi-python-3000
> (I am working on an English translation these days,
> but for the moment you can use Google Translator).
>
> M. Simionato
FWIW, I have just finished translating the first
part of the arti
Michele Simionato wrote:
BTW, since I do not really follow python-dev, do you know
if some consensus was reached on the issue of adding an ordered dict
implementation to the standard library?
I thought there was to be one added to collections, where default_dict
lives, but I do not remember
En Tue, 05 Aug 2008 00:05:58 -0300, Michele Simionato
<[EMAIL PROTECTED]> escribió:
On Aug 5, 4:38 am, "Gabriel Genellina":
So the namespace that the metaclass receives when the class is created,
will be some kind of ordered dictionary?
Metaclasses are available for a long time ago, but th
On Aug 5, 7:47 am, Terry Reedy <[EMAIL PROTECTED]> wrote:
>
> Bfiefly, as I understood the discussion some months ago: In 2.x, the
> class body is executed in a local namespace implemented as a normal dict
> and *then* passed to the metaclass. In 3.0, the metaclass gets brief
> control *before* ex
Michele Simionato wrote:
On Aug 5, 4:38 am, "Gabriel Genellina":
So the namespace that the metaclass receives when the class is created,
will be some kind of ordered dictionary?
Metaclasses are available for a long time ago, but the definition order is
lost right at the start, when the clas
On Aug 5, 4:38 am, "Gabriel Genellina":
>
> So the namespace that the metaclass receives when the class is created,
> will be some kind of ordered dictionary?
> Metaclasses are available for a long time ago, but the definition order is
> lost right at the start, when the class body is executed.
En Fri, 01 Aug 2008 23:47:42 -0300, Benjamin <[EMAIL PROTECTED]>
escribió:
On Aug 1, 6:23 pm, Andrew Lentvorski <[EMAIL PROTECTED]> wrote:
How do I determine the order of definition of class attributes?
For example, if I have a class
class Test(object):
y = 11
x = 22
How do I tell
On Aug 1, 6:23 pm, Andrew Lentvorski <[EMAIL PROTECTED]> wrote:
> How do I determine the order of definition of class attributes?
>
> For example, if I have a class
>
> class Test(object):
> y = 11
> x = 22
>
> How do I tell that y was defined before x?
You wait until Python 3.0 where yo
Andrew Lentvorski <[EMAIL PROTECTED]> writes:
> How do I determine the order of definition of class attributes?
>
> For example, if I have a class
>
> class Test(object):
> y = 11
> x = 22
>
> How do I tell that y was defined before x?
Like any namespace, attributes of an object are im
On Fri, Aug 1, 2008 at 7:23 PM, Andrew Lentvorski <[EMAIL PROTECTED]> wrote:
> How do I determine the order of definition of class attributes?
>
> For example, if I have a class
>
> class Test(object):
>y = 11
>x = 22
>
> How do I tell that y was defined before x?
You can't. The order tha
"Miles" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| On Wed, May 7, 2008 at 7:40 PM, Yves Dorfsman <[EMAIL PROTECTED]> wrote:
| > Does it make a difference if you put subclass object or not ?
| Old-style | classes will go away in Python 3 (I think),
Have gone ;-)
| and all cla
Miles wrote:
In Python 2.2, classes and types were unified. If a class inherits
from object (or any other built-in), it is considered a "new-style"
class; otherwise, it is an old-style (or classic) class. There are
some differences in their behavior; most notably, descriptors
(computer propert
On Wed, May 7, 2008 at 7:40 PM, Yves Dorfsman <[EMAIL PROTECTED]> wrote:
> Does it make a difference if you put subclass object or not ?
>
> What is the difference between c1 and c2 here:
>
> class c1:
> pass
>
> class c2(object):
> pass
>>> type(c1)
>>> type(c1())
>>> type(c2)
>>> type(
Duncan Booth <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
>> >>> def f():
>> class C(object):
>> def __init__(self):
>>self.a = 'a'
>> return C()
>>
>> >>> x = f()
>> >>> x.a
>> 'a'
>> >>> y=f.C()
>>
>
Of course there's this:
>>> def f():
... clas
Kay Schluehr wrote:
>
> Tomi Lindberg wrote:
>> Hi,
>>
>> With the following function definition, is it possible to
>> create an instance of class C outside the function f (and if
>> it is, how)?
>
> def f():
> class C(object):
> def __init__(self):
> self.a = 'a'
>
Peter Otten wrote:
> By the way you get an instance of a different class C every time you call f,
> so that
>
> isinstance(f(), type(f())
>
> is False.
That I didn't know. Well, that theory won't be seeing much
practice I guess.
--
Tomi Lindberg
--
http://mail.python.org/mailman/listinfo/pyt
Tomi Lindberg wrote:
> With the following function definition, is it possible to
> create an instance of class C outside the function f (and if
> it is, how)? And yes, I think this is one of those times
> when the real question is why :)
>
> >>> def f():
> class C(object):
> def
Tomi Lindberg wrote:
> With the following function definition, is it possible to
> create an instance of class C outside the function f (and if
> it is, how)? And yes, I think this is one of those times
> when the real question is why :)
>
> >>> def f():
> class C(object):
>
Diez B. Roggisch wrote:
> No, its not. Only inside of it. And the question really is: why?
Thanks. And no need to worry, the question was intended as
fully theoretical.
--
Tomi Lindberg
--
http://mail.python.org/mailman/listinfo/python-list
Tomi Lindberg wrote:
> Hi,
>
> With the following function definition, is it possible to
> create an instance of class C outside the function f (and if
> it is, how)?
def f():
class C(object):
def __init__(self):
self.a = 'a'
f.C = C
return C()
>>> f.C
>
Tomi Lindberg wrote:
> Hi,
>
> With the following function definition, is it possible to
> create an instance of class C outside the function f (and if
> it is, how)? And yes, I think this is one of those times
> when the real question is why :)
>
> >>> def f():
> class C(object):
> def __init_
31 matches
Mail list logo