need help with properties
Esmail
ebonak at hotmail.com
Sat May 9 12:08:58 EDT 2009
Steven D'Aprano wrote:
>
> All you've done in this second block is define a new object called "size"
> and assign the tuple (3, 7) to it.
oops .. yes, you are right, and I am embarrassed...
[Aside: you might not be aware that it
> is commas that make tuples, not brackets. The brackets are for grouping.)
Helpful clarification, thanks!
> "size" has nothing to do with your Rectangle class, or the property.
> Apart from the accidental similarity of name between "Rectangle.size" and
> "size", it's unrelated to the property you created.
>
> What you probably intended to do was this:
>
> print '-----------------'
> r.size = 3, 7
> print r.size
Yup, I know Python is a dynamically typed language, but I wish it would
point this sort of silliness out .. but there are tradeoffs. I should
probably run pyflakes/pychecker/pylint on my my tiny test/try out codes
too.
Best,
Esmail
More information about the Python-list
mailing list