When to use classes?
Toby Dickenson
mbel44 at dial.pipex.net
Wed Mar 8 04:32:26 EST 2000
danielt3 at gte.net (Daniel T.) wrote:
>For the above, your best bet would be something like:
>
>x,y = poly.firstPointX(), poly.firstPointY()
>
>or
>
>x,y = poly.firstPoint() # assumes that firstPoint( self ) returns a tuple
>
>or
>
>aPoint = poly.firstPoint() # assumes that firstPoint( self ) returns a Point
> # class object
That second method does not require a tuple - any sequence object will
do. If you have a point class that implements the sequence protocol
then you can use both conventions.
This is probably the best pure-python option unless you have millions
of these objects, or you will be accessing them millions of times.
Toby Dickenson
tdickenson at geminidataloggers.com
More information about the Python-list
mailing list