On 2007-03-20, Alex Martelli <[EMAIL PROTECTED]> wrote:
> Steven D'Aprano <[EMAIL PROTECTED]> wrote:
>...
>> There are plenty of reasons for preferring new style classes. If those
>> reasons hold for you, then of course you should use new style classes.
>>
>> But that's not the same thing as s
In article <[EMAIL PROTECTED]>,
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
>
>Not officially yet, true. But come on, it's been 6 (six) years since
>type unification, and it has always been obvious (to me at least) that
>the new object model was to replace the 'classic' one.
...in Python 3.0
Steven D'Aprano a écrit :
> On Tue, 20 Mar 2007 10:28:10 +0100, Bruno Desthuilliers wrote:
>
> [deploying weapons of mass snippage]
Lol !-)
>
>>>Otherwise, the choice between old
>>>and new is not very important.
>>
>>Your opinion. Too bad you're missing some of the most powerful parts of
>>th
Steven D'Aprano a écrit :
> On Tue, 20 Mar 2007 10:28:10 +0100, Bruno Desthuilliers complained about
> classic classes:
>
>
>>>What's wrong with old-style classes?
>>
>>Almost everything.
>
>
> That's rather an exaggeration, don't you think?
Oh, really ?-)
--
http://mail.python.org/mailman/l
In article <[EMAIL PROTECTED]>,
Steven D'Aprano <[EMAIL PROTECTED]> wrote:
>On Tue, 20 Mar 2007 08:27:07 -0700, Alex Martelli wrote:
>>
>> You should always use new-style classes in order to avoid having to stop
>> and make a decision each time you code a class -- having to stop and ask
>> yoursel
On Tue, 20 Mar 2007 08:27:07 -0700, Alex Martelli wrote:
> You should always use new-style classes in order to avoid having to stop
> and make a decision each time you code a class -- having to stop and ask
> yourself "do I need any of the many extra features of new-style classes
> here, or will l
Steven D'Aprano <[EMAIL PROTECTED]> wrote:
...
> There are plenty of reasons for preferring new style classes. If those
> reasons hold for you, then of course you should use new style classes.
>
> But that's not the same thing as saying that you should use new style
> classes *even when you don
On Tue, 20 Mar 2007 10:28:10 +0100, Bruno Desthuilliers complained about
classic classes:
>> What's wrong with old-style classes?
>
> Almost everything.
That's rather an exaggeration, don't you think? They have methods, and
inheritance, and attributes, all the critical features of classes, and
On Tue, 20 Mar 2007 10:28:10 +0100, Bruno Desthuilliers wrote:
[deploying weapons of mass snippage]
>> Otherwise, the choice between old
>> and new is not very important.
>
> Your opinion. Too bad you're missing some of the most powerful parts of
> the language.
Yes, it is my opinion, and it s
Steven D'Aprano a écrit :
> On Mon, 19 Mar 2007 19:48:37 +1100, Ben Finney wrote:
>
>> It's also best to inherit every class from another class, leading to a
>> single hierarchy for all classes and types. 'object' is the one to
>> choose if you don't want the behaviour of any other class.
>
> Wha
Steven D'Aprano wrote:
> On Mon, 19 Mar 2007 19:48:37 +1100, Ben Finney wrote:
>
>> It's also best to inherit every class from another class, leading to a
>> single hierarchy for all classes and types. 'object' is the one to
>> choose if you don't want the behaviour of any other class.
>
> What's
"Steven D'Aprano" <[EMAIL PROTECTED]> writes:
> On Mon, 19 Mar 2007 19:48:37 +1100, Ben Finney wrote:
>
> > It's also best to inherit every class from another class, leading
> > to a single hierarchy for all classes and types. 'object' is the
> > one to choose if you don't want the behaviour of an
On Mon, 19 Mar 2007 19:48:37 +1100, Ben Finney wrote:
> It's also best to inherit every class from another class, leading to a
> single hierarchy for all classes and types. 'object' is the one to
> choose if you don't want the behaviour of any other class.
What's wrong with old-style classes?
On
Gabriel Genellina wrote:
> you may consider using a class
> attribute as a default value:
>
> class Coffee:
>
> temp = 50
Be careful with that, though -- only use it for immutable
values. Doing that with a mutable object, such as a list,
will get you into trouble, since one object is being
Steve Holden a écrit :
> Bruno Desthuilliers wrote:
>
>> Diez B. Roggisch a écrit :
>>
(snip)
>>> You want boil to be called __init__, which is python's constructor name.
>>
>>
>> Actually, __init__ is the initializer. The proper constructor is __new__.
>>
>>
>
I'm not sure Diez qualifies as
Bruno Desthuilliers wrote:
> Diez B. Roggisch a écrit :
>> momobear schrieb:
>>> hi, I am puzzled about how to determine whether an object is
>>> initilized in one class, anyone could give me any instructions?
>>> here is an example code:
>>>
>>> class coffee:
>>> def boil(self):
>>>
En Mon, 19 Mar 2007 05:35:00 -0300, momobear <[EMAIL PROTECTED]> escribió:
>> > in C++ language we must initilized a variable first, so there is no
>> > such problem, but in python if we don't invoke a.boil(), we will not
>> > get self.temp to be initilized, any way to determine if it's initilzed
momobear a écrit :
> hi, I am puzzled about how to determine whether an object is
> initilized in one class, anyone could give me any instructions?
> here is an example code:
>
> class coffee:
> def boil(self):
>self.temp = 80
>
> a = coffer()
> if a.temp > 60:
> pr
Diez B. Roggisch a écrit :
> momobear schrieb:
>> hi, I am puzzled about how to determine whether an object is
>> initilized in one class, anyone could give me any instructions?
>> here is an example code:
>>
>> class coffee:
>> def boil(self):
>>self.temp = 80
>>
>> a = c
"momobear" <[EMAIL PROTECTED]> wrote:
> thanks for help:), I am puzzled about if I have to use try and except
> to determine it. finnal code should like this?
> class coffee:
> def __init__(self):
> '''
> do something here
> '''
> def b
On Mar 19, 4:50 pm, Duncan Booth <[EMAIL PROTECTED]> wrote:
> "momobear" <[EMAIL PROTECTED]> wrote:
> > in C++ language we must initilized a variable first, so there is no
> > such problem, but in python if we don't invoke a.boil(), we will not
> > get self.temp to be initilized, any way to determi
momobear wrote:
> hi, I am puzzled about how to determine whether an object is
> initilized in one class, anyone could give me any instructions?
> here is an example code:
>
> class coffee:
> def boil(self):
>self.temp = 80
>
> a = coffer()
> if a.temp > 60:
> print
"momobear" <[EMAIL PROTECTED]> wrote:
> in C++ language we must initilized a variable first, so there is no
> such problem, but in python if we don't invoke a.boil(), we will not
> get self.temp to be initilized, any way to determine if it's initilzed
> before self.temp be used.
>
The simplest th
"momobear" <[EMAIL PROTECTED]> writes:
> class coffee:
> def __init__(self):
> '''
> do something here
> '''
> def boil(self):
>self.temp = 80
>
> a = coffer()
> if a.temp > 60:
> print "it's boiled"
class Coffe
On Mar 19, 4:19 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> momobear schrieb:
>
>
>
> > hi, I am puzzled about how to determine whether an object is
> > initilized in one class, anyone could give me any instructions?
> > here is an example code:
>
> > class coffee:
> > def boil(se
momobear schrieb:
> hi, I am puzzled about how to determine whether an object is
> initilized in one class, anyone could give me any instructions?
> here is an example code:
>
> class coffee:
> def boil(self):
>self.temp = 80
>
> a = coffer()
> if a.temp > 60:
> pri
hi, I am puzzled about how to determine whether an object is
initilized in one class, anyone could give me any instructions?
here is an example code:
class coffee:
def boil(self):
self.temp = 80
a = coffer()
if a.temp > 60:
print "it's boiled"
in C++ language we mus
27 matches
Mail list logo