a question about python

李白,字一日 calidion at gmail.com
Thu Nov 26 04:57:45 EST 2009


thanks.

On Nov 26, 5:45 pm, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> On Thu, 26 Nov 2009 01:21:39 -0800, 李白,字一日 wrote:
> > hi,
> > i have a question on python programming.
>
> > let file a.py has a class named a,
> >   class a():
> >     __G__ = "1111"
>
> Methods with double leading and trailing underscores are reserved for
> Python's special use. You should find a different naming convention.
>
> > in file b.py i need to insert an attribute __C__ to class a
>
> > it would be as if class a defined in file a.py like this:
> >   class a():
> >     __G__ = "1111"
> >     __C__ = "22222"
>
> > how this be done in python without inheritance?
>
> import a
> a.a.__C__ = "22222"
>
> --
> Steven




More information about the Python-list mailing list