Hello,
I'd like to thank the PyX developers for this amazing
package. Congratulations and keep up the good work.
This is for PyX 0.9. There's something I don't understand
about the tangent method provided by path. After reading
the documentation, I thought that "length" was an optional
argument, with None as default value. In this case, a
normalized unit vector would be returned. Please, consider
the following trivial example:
cir = path.circle(0, 0, 1)
tg = cir.tangent(cir.atbegin())
When Python executes the second line, it throws a TypeError
exception. Here's the traceback:
File "circles.py", line 9, in ?
tg = cir.tangent(cir.begin(), None)
File "[...]/pyx/path.py", line 1164, in tangent
return self.normpath().tangent(params, length)
File "[...]/pyx/normpath.py", line 1418, in wrappedmethod
return method(self, [valueorlist], *args, **kwargs)[0]
File "[...]/pyx/normpath.py", line 1900, in tangent
return self._tangent(self._convertparams(params, self.arclentoparam),
unit.topt(length))
File "[...]/pyx/unit.py", line 72, in topt
return _convert_to(l, "pt")
File "[...]/pyx/unit.py", line 55, in _convert_to
l = length(l) # convert to length instance if necessary
File "[...]/pyx/unit.py", line 94, in __init__
l = float(f) * _m[unit or _default_unit]
TypeError: float() argument must be a string or a number
If you add a length argument different from None, then it
works as expected.
I'm rather new to Python, so don't take the following very
seriously: I've been reading over the code, and I suspect
that neither the tangent method provided by path nor the one
provided by normpath check the type of "length"; therefore,
this length transparently passes as an argument to
unit.topt, and a TypeError is thrown if it's None.
I'd appreciate your helping me understand this.
Cheers.
Lander
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user