How to extend inner classes?

Discussion in 'Python' started by Kay Schluehr, Nov 27, 2004.

  1. Kay Schluehr

    Kay Schluehr Guest

    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>

    Ciao
    Kay
    Kay Schluehr, Nov 27, 2004
    #1
    1. Advertising

  2. Kay Schluehr <> 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
    Alex Martelli, Nov 28, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Carlo v. Dango
    Replies:
    14
    Views:
    1,013
    Alex Martelli
    Oct 19, 2003
  2. Replies:
    0
    Views:
    316
  3. Kay Schluehr

    How to extend inner classes?

    Kay Schluehr, Nov 28, 2004, in forum: Python
    Replies:
    0
    Views:
    330
    Kay Schluehr
    Nov 28, 2004
  4. harold fellermann

    How to extend inner classes?

    harold fellermann, Dec 21, 2004, in forum: Python
    Replies:
    0
    Views:
    352
    harold fellermann
    Dec 21, 2004
  5. Juha Nieminen
    Replies:
    9
    Views:
    912
    Kai-Uwe Bux
    Jun 13, 2011
Loading...

Share This Page