tobiah wrote:
> Suppose I do:
>
>
> myfoo = Foo('grapes', 'oranges')
>
> And in the __init__() of Foo, there is
> a real problem with the consumption of fruit.
> Is there a clean way to ensure that myfoo
> will be None after the call? Would the
> __init__() just do del(self), or is there
> a bett
tobiah wrote:
> Suppose I do:
>
>
> myfoo = Foo('grapes', 'oranges')
>
> And in the __init__() of Foo, there is
> a real problem with the consumption of fruit.
> Is there a clean way to ensure that myfoo
> will be None after the call? Would the
> __init__() just do del(self), or is there
> a be
Simon Forman wrote:
> The entire post was meant as a pedantic exercise illustrating what not
> to do (and how easy it is to figure that out with an interactive
> session,) and sketching how to raise and check for an error instead.
>
Lessons usually start with the teacher asserting authority and
John Machin wrote:
> Simon Forman wrote:
>
> >
> > |>> class f:
> > ... def __init__(self):
> > ... del self
>
> Of course nothing happens. Args are local variables. 'self' is is a
> vanilla arg of a vanilla function.
I know.
> > ...
> > |>> e = f()
> > |>> e
> > <__main__.f insta
On Tue, 15 Aug 2006 16:04:12 -0700, tobiah wrote:
> Suppose I do:
>
>
> myfoo = Foo('grapes', 'oranges')
>
> And in the __init__() of Foo, there is
> a real problem with the consumption of fruit.
> Is there a clean way to ensure that myfoo
> will be None after the call?
I don't believe so.
Ge
Simon Forman wrote:
>
> |>> class f:
> ... def __init__(self):
> ... del self
Of course nothing happens. Args are local variables. 'self' is is a
vanilla arg of a vanilla function.
> ...
> |>> e = f()
> |>> e
> <__main__.f instance at 0xb7dd91ec>
>
>
> |>> class f:
> ... def
tobiah wrote:
> Suppose I do:
>
>
> myfoo = Foo('grapes', 'oranges')
>
> And in the __init__() of Foo, there is
> a real problem with the consumption of fruit.
> Is there a clean way to ensure that myfoo
> will be None after the call? Would the
> __init__() just do del(self), or is there
> a be
tobiah <[EMAIL PROTECTED]> writes:
> myfoo = Foo('grapes', 'oranges')
>
> And in the __init__() of Foo, there is a real problem with the
> consumption of fruit. Is there a clean way to ensure that myfoo
> will be None after the call? Would the __init__() just do
> del(self), or is there a bette
tobiah wrote:
> I should have made it more clear that Foo is a class:
>
>
> class Foo:
>
> def __init__(self, *args):
>
> for arg in args:
> if is_fruit(arg):
> del(self)
>
>
>
> tobiah wrote:
> > Suppose I do:
> >
> >
-*> > m
tobiah wrote:
> I should have made it more clear that Foo is a class:
>
>
> class Foo:
>
> def __init__(self, *args):
>
> for arg in args:
> if is_fruit(arg):
> del(self)
>
>
>
> tobiah wrote:
> > Suppose I do:
> >
> >
> > myfo
I should have made it more clear that Foo is a class:
class Foo:
def __init__(self, *args):
for arg in args:
if is_fruit(arg):
del(self)
tobiah wrote:
> Suppose I do:
>
>
> myfoo = Foo('grapes',
Suppose I do:
myfoo = Foo('grapes', 'oranges')
And in the __init__() of Foo, there is
a real problem with the consumption of fruit.
Is there a clean way to ensure that myfoo
will be None after the call? Would the
__init__() just do del(self), or is there
a better way to think about this?
Thank
12 matches
Mail list logo