A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-March/071525.html below:

[Python-Dev] Access to bits for a PyLongObject

[Python-Dev] Access to bits for a PyLongObject [Python-Dev] Access to bits for a PyLongObject"Martin v. Löwis" martin at v.loewis.de
Tue Mar 6 05:59:49 CET 2007
Eric V. Smith schrieb:
> I'm working on PEP 3101, Advanced String Formatting.  About the only 
> built-in numeric formatting I have left to do is for converting a 
> PyLongOjbect to binary.
> 
> I need to know how to access the bits in a PyLong.  

I think it would be a major flaw in PEP 3101 if you really needed it.
The long int representation should be absolutely opaque - even the
fact that it is a sign+magnitude representation should be hidden.

Looking at the PEP, I see that a class can implement __format__.
Wouldn't it be appropriate if the long type implemented that? 
Implementation-wise, I would expect that long_format already does the
bulk of what you need to do.

OTOH, also look at _PyString_FormatLong.

Regards,
Martin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4