🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.python
2 messages
2 total messages Started by Pawel J Maczewski Sat, 18 Jan 2003 12:36
klasy
#716
Author: Pawel J Maczewski
Date: Sat, 18 Jan 2003 12:36
15 lines
1123 bytes
Czesc ;>
   Mam takie definicje:

class A:
   def __init__ (self):
     X = 1
     return None
   class B:
     def __init__ ( self ):
       Y = 1

i wewnatrz funkcji w klasie B chce odwolac sie do jakiejs 
zmiennej/metody z klasy A. Jak to zrobic?

Kender
Re: klasy
#717
Author: Pet
Date: Sat, 18 Jan 2003 14:16
24 lines
1420 bytes
Pawel J Maczewski napisł(a) :

> Czesc ;>
>    Mam takie definicje:
> 
> class A:
>    def __init__ (self):
>      X = 1
>      return None
>    class B:
>      def __init__ ( self ):
>        Y = 1
> 
> i wewnatrz funkcji w klasie B chce odwolac sie do jakiejs
> zmiennej/metody z klasy A. Jak to zrobic?

Jeśli definicja clasy A jest wykonana na najwyższym poziomie modułu, to 
przez normalną kwalifikację nazw A.zmienna  A.metoda()

-- 
Bo system Linux chwyta za serce,
jak po Sylwestrze łyk Alca Zelcer.

                                  z poważaniem, Piotr Grzegorzyca
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads