[Python-Dev] str(1L) -> '1' ?
Greg Stein
gstein@lyra.org
Mon, 27 Dec 1999 03:31:29 -0800 (PST)
On Sun, 26 Dec 1999, M.-A. Lemburg wrote:
> Greg Stein wrote:
> > On Fri, 24 Dec 1999, M.-A. Lemburg wrote:
> > > While we're at it: how about adding a PyLong_AsString() API
> > > to the C interface ? I currently use PyObject_Str() in mxODBC
> > > and then slice off the 'L' -- not very elegant. A PyLong_AsString()
> > > API would much better suit the task.
> >
> > Fred just checked in a change yesterday. PyObject_Str() on a Long no
> > longer includes the 'L'.
>
> Ah, ok... scanning the patches: they don't provide an externed
> C interface... I would like to have such a beast if possible
> (basically, the new long_format() as PyLong_AsString()).
What's wrong with PyObject_Str()? I don't see a need for Yet Another Entry
Point.
> > You're going to need to update your code :-)
> > [ I've got some here and there to fix, too, with the idiom:
> > if type(v) is type(1L): return str(v)[:-1]
> > ]
>
> Your above example will effectively divide the long value by 10
> which will probably break things in very subtle ways... hmm, this
Yah :-( Not a lot of fun, but I think for the best.
> change ought to be made *very* visible to people upgrading to
> 1.6, IMHO.
Yes.
Cheers,
-g
--
Greg Stein, http://www.lyra.org/