Re: how to get the thighest bit position in big integers?
- From: Mensanator <mensanator@xxxxxxx>
- Date: Wed, 29 Oct 2008 14:43:13 -0700 (PDT)
On Oct 29, 4:16 pm, Glenn Linderman <v+pyt...@xxxxxxxxxxxx> wrote:
On approximately 10/29/2008 11:51 AM, came the following characters from
the keyboard of Mensanator:
or in 2.6
print 'highest bit position: %d' % (len(bin(3328)[2:])-1)
highest bit position: 11
This works, but where is it documented?
Good question. Now that I think about it, I believe I learned of
it here, never saw it in the docs.
Searching the Python 2.6 docs
for bin found lots of things that start with bin, but none of them were
bin. Searching the builtins page manual didn't find it. Is this a bug
in the documentation?
Well ,it's mentioned in "What's new in Python 2.6":
<quote>
Python 3.0 adds several new built-in functions
and change the semantics of some existing built-ins.
Entirely new functions such as bin() have simply
been added to Python 2.6, but existing built-ins
haven’t been changed;
</quote>
You would think when you add a new function, you would
also add it's documentation, but maybe that was an
oversight. I don't have 3.0, but maybe it can be found
in that set of docs.
--
Glenn --http://nevcal.com/
===========================
A protocol is complete when there is nothing left to remove.
-- Stuart Cheshire, Apple Computer, regarding Zero Configuration Networking
.
- Follow-Ups:
- Re: how to get the thighest bit position in big integers?
- From: Terry Reedy
- Re: how to get the thighest bit position in big integers?
- References:
- how to get the thighest bit position in big integers?
- From: mmgarvey
- Re: how to get the thighest bit position in big integers?
- From: Gary Herron
- Re: how to get the thighest bit position in big integers?
- From: Nick Mellor
- Re: how to get the thighest bit position in big integers?
- From: Mensanator
- how to get the thighest bit position in big integers?
- Prev by Date: Re: math equation, svg and matplotlib
- Next by Date: Re: Why gives "k = 09" a syntax error ?
- Previous by thread: Re: how to get the thighest bit position in big integers?
- Next by thread: Re: how to get the thighest bit position in big integers?
- Index(es):
Relevant Pages
|