Passing by reference

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sun Dec 23 11:40:33 EST 2007


On Sun, 23 Dec 2007 03:10:48 -0800, MartinRinehart wrote:

> Bruno, right now I've got this:
> 
> def __init__ ( self, t ):
>     """ Constructor, called with array of strings. """
> 
>     self.text = t
>     ...
> 
> Some other program will say:
> tok = Toker( text_array )
> tokens = tok.tokenize()
> 
> So how does the constructor make the array of strings available to the
> tokenize() method?

Assuming the `__init__()` above belongs to the `Toker` class then the
`tokenize()` method can access it via `self.text` of course.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list