Il venerdì 24 ottobre 2008 18:54:57 [EMAIL PROTECTED] ha scritto:
> Ciao,
> come posso testare se una variabile d'istanza di una classe esiste?
>
> Ho provato così:
>
> class Foo(object):
>   def bar(self):
>    try:
>      self.baz
>      # qui posso usare baz
>
>    except AttributeError:
>      print 'la variabile non esiste, la creo'
>
>
> Non sono sicuro che sia il metodo giusto, però.
> Avete qualche idea?
>
> Vi ringrazio
>
>
>
> _______________________________________________
> Python mailing list
> Python@lists.python.it
> http://lists.python.it/mailman/listinfo/python

-- 
--
Simone
Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 

_______________________________________________
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python

Rispondere a