Stephen McInerney wrote:
Because it was designed that way and then implemented to follow the design. Or are you asking why it was designed that way? I guess you'd have to ask the designer. At least it is somewhat compatible with str representations of other data types that contain more than 1 value, e.g. decimal, set, tuple, ... It's unwanted By some; others like it. I think you mean you don't want it. , and it also makes them look like a tuple (other than the trailing comma). True. How can I get rid of it, other than the clunky: Please define "clunky". Create your own subclas >>> class C(complex): ... def __str__(self): ... return "%s-%sj" % (self.real, self.imag) ... def __init__(self, r, i): ... complex.__init__(self, r, i) ... >>> c=C(1,2) >>> c (1+2j) >>> print c '1.0-2.0j'; This might seem clunky but this is the way to alter behavior of built-in objects. -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonviolent Communication provides tools for this awareness. As a coach and trainer I can assist you in learning this process. What is YOUR biggest relationship challenge? |
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor