Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Dev

What letter should an UnsignedLongLong get

 

 

Python dev RSS feed   Index | Next | Previous | View Threaded


gcolgate at gmail

Mar 15, 2012, 11:47 AM

Post #1 of 8 (526 views)
Permalink
What letter should an UnsignedLongLong get

We use a lot of UnsignedLongLongs in our program (ids) and have been
parsing in PyArg_ParseTuple with 'K', which does not do error checking.
I am planning to add a new type to our local build of python for parsing
Unsigned Long Longs (64 bit numbers) that errrors if the number has more
than the correct number of bits.

I am thinking to use the letter 'N' for this purpose, since l,k,K,U,u are
all taken.

Does anyone have any better ideas?


benjamin at python

Mar 15, 2012, 11:49 AM

Post #2 of 8 (506 views)
Permalink
Re: What letter should an UnsignedLongLong get [In reply to]

2012/3/15 Gil Colgate <gcolgate [at] gmail>:
> We use a lot of UnsignedLongLongs in our program (ids) and have been parsing
> in PyArg_ParseTuple with 'K', which does not do error checking.
> I am planning to add a new type to our local build of python for parsing
> Unsigned Long Longs (64 bit numbers) that errrors if the number has more
> than the correct number of bits.
>
> I am thinking to use the letter 'N' for this purpose, since l,k,K,U,u are
> all taken.

Unfortunately, the would conflict with Py_BuildValue's 'N'.



--
Regards,
Benjamin
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


benjamin at python

Mar 15, 2012, 11:56 AM

Post #3 of 8 (509 views)
Permalink
Re: What letter should an UnsignedLongLong get [In reply to]

2012/3/15 Gil Colgate <gcolgate [at] gmail>:
> I must be using a different version of python, (3.2), I don't see that one
> in use. Do you have a different suggestion?

It's not used in PyArg_Parse*, but it is for Py_BuildValue. Adding it
to PyArg_Parse could create confusion.

>
> On Thu, Mar 15, 2012 at 11:49 AM, Benjamin Peterson <benjamin [at] python>
> wrote:
>>
>> 2012/3/15 Gil Colgate <gcolgate [at] gmail>:
>> > We use a lot of UnsignedLongLongs in our program (ids) and have been
>> > parsing
>> > in PyArg_ParseTuple with 'K', which does not do error checking.
>> > I am planning to add a new type to our local build of python for parsing
>> > Unsigned Long Longs (64 bit numbers) that errrors if the number has more
>> > than the correct number of bits.
>> >
>> > I am thinking to use the letter 'N' for this purpose, since l,k,K,U,u
>> > are
>> > all taken.
>>
>> Unfortunately, the would conflict with Py_BuildValue's 'N'.
>>
>>
>>
>> --
>> Regards,
>> Benjamin
>
>



--
Regards,
Benjamin
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


nadeem.vawda at gmail

Mar 15, 2012, 12:02 PM

Post #4 of 8 (512 views)
Permalink
Re: What letter should an UnsignedLongLong get [In reply to]

The lzma module ran into a similar issue with 32-bit unsigned ints.
I worked around it by writing a custom converter function to use
with the "O&" code.

You can find the converter definition here:

http://hg.python.org/cpython/file/default/Modules/_lzmamodule.c#l134

And an example usage here:

http://hg.python.org/cpython/file/default/Modules/_lzmamodule.c#l261

Cheers,
Nadeem
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


gcolgate at gmail

Mar 15, 2012, 12:59 PM

Post #5 of 8 (502 views)
Permalink
Re: What letter should an UnsignedLongLong get [In reply to]

How about 'G'? (Giant, or perhaps gynormous, integer?)


Then I could also map 'g' to the signed version (same as L) for consistency.

On Thu, Mar 15, 2012 at 11:49 AM, Benjamin Peterson <benjamin [at] python>wrote:

> 2012/3/15 Gil Colgate <gcolgate [at] gmail>:
> > We use a lot of UnsignedLongLongs in our program (ids) and have been
> parsing
> > in PyArg_ParseTuple with 'K', which does not do error checking.
> > I am planning to add a new type to our local build of python for parsing
> > Unsigned Long Longs (64 bit numbers) that errrors if the number has more
> > than the correct number of bits.
> >
> > I am thinking to use the letter 'N' for this purpose, since l,k,K,U,u are
> > all taken.
>
> Unfortunately, the would conflict with Py_BuildValue's 'N'.
>
>
>
> --
> Regards,
> Benjamin
>


benjamin at python

Mar 15, 2012, 1:03 PM

Post #6 of 8 (501 views)
Permalink
Re: What letter should an UnsignedLongLong get [In reply to]

2012/3/15 Gil Colgate <gcolgate [at] gmail>:
> How about 'G'? (Giant, or perhaps gynormous, integer?)
>
>
> Then I could also map 'g' to the signed version (same as L) for consistency.

Sounds okay to me.



--
Regards,
Benjamin
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


storchaka at gmail

Mar 15, 2012, 2:02 PM

Post #7 of 8 (502 views)
Permalink
Re: What letter should an UnsignedLongLong get [In reply to]

15.03.12 21:59, Gil Colgate написав(ла):
> How about 'G'? (Giant, or perhaps gynormous, integer?)
>
>
> Then I could also map 'g' to the signed version (same as L) for consistency.

What about unsigned char, short, int, and long with overflow checking?

_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


storchaka at gmail

Mar 15, 2012, 2:31 PM

Post #8 of 8 (496 views)
Permalink
Re: What letter should an UnsignedLongLong get [In reply to]

15.03.12 21:59, Gil Colgate написав(ла):
> How about 'G'? (Giant, or perhaps gynormous, integer?)
>
>
> Then I could also map 'g' to the signed version (same as L) for consistency.

For consistency 'g' must be `unsigned long` with overflow checking.

And how about 'M'? 'K', 'L', and 'M' are neighboring letters.

_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com

Python dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.