How to extend inner classes?
Alex Martelli
aleaxit at yahoo.com
Sun Nov 28 07:58:32 EST 2004
Kay Schluehr <kayschluehr at gmx.de> wrote:
> You can define a class variable Pos with the class Pos as its value
>
> class PeriodicGrid :
> class Pos:
> pass
> Pos = Pos
>
> >>> grid = PeriodicGrid()
> >>> grid.Pos()
> <__main__.Pos instance at 0x00EEFAD0>
You can, but that 'Pos = Pos' statement in this code is just as
redundant and useless as it appears. In every aspect, the behavior will
be exactly identical if you remove that assignment.
Alex
More information about the Python-list
mailing list