On Mon, Jan 16, 2006 at 09:28:10PM -0800, Bob Ippolito wrote:
On Jan 16, 2006, at 9:12 PM, Andrew Bennetts wrote:
This seems clear and simple to me. I like it. I strongly suspect the "bright beginners" Alex is interested in would have no trouble using it or finding it.
I don't know about that, all of the methods that int and long currently have are __special__. They'd really need to start with Python 2.5 (assuming int/long grow "public methods" in 2.5) to even think to look there. A format code or a built-in would be more likely to be found, since that's how you convert integers to hex and oct string representations with current Python.
[name for name in dir(0)+dir(0L) if not name.startswith('__')]
I should have said, I'm equally happy with the format code as well (although it doesn't allow arbitary base conversions, I've never had need for that, so I'm not too worried about that case). Either option is better than making the str constructor do relatively rarely used mathematics!