changing to function what works like a function

Benjamin Kaplan benjamin.kaplan at case.edu
Mon Mar 7 10:40:42 EST 2011


On Mar 7, 2011 6:35 AM, "Victor Paraschiv" <victorywin5 at yahoo.com> wrote:
>
> Hi everyone
> i understood that the goal of Python is to make programing easy (of
course, powerful at the same time).
> I think one way to do it is to eliminate unnecessary syntax exceptions.
One is the following:
> for a complex number "z", to get the real and imaginary  part, you type:
"z.real" and "z.imag".
> At the same time, the most obvious way would be to call it like a
function, say: "real(z)", and, respectively, "imag(z)". Just like it was
changed from " print 'something' " , to " print('something') " .
>
> What do you think? There are more examples like this.
>

This isn't at all similar to changing print. Print was a statement, now it's
a function. Changing it made yhe language more consistent. Real and imag are
attributes of the complex object. They are not independent functions. By
changing them into functions, you're violating the while point of
object-oriented design- putting the attributes and behavior of an entity
together.
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110307/e2a62b4a/attachment.html>


More information about the Python-list mailing list