Robert Berman wrote:
Emille,
I do think he meant bit 20 to 32 rather than 20 to 40. Unless, of
course, he's dealing with a 64 bit word.
You posted out of order (top--osted). So I am forced to put my response
elsewhere.
I am delighted with all the help I have received on this topic and I a
Uncle Bob Martin has written a great post about TDD:
http://blog.objectmentor.com/articles/2009/10/06/echoes-from-the-stone-age
"Look, TDD is not my religion, it is one of my disciplines. It’s like
dual entry bookkeeping for accountants, or sterile procedure for
surgeons. Professionals adopt such
Emille,
I do think he meant bit 20 to 32 rather than 20 to 40. Unless, of
course, he's dealing with a 64 bit word.
I am delighted with all the help I have received on this topic and I am
gleefully learning anding and oring, but not too much on the EOR side.
Thanks again for all the assistance.
On 12/2/2009 4:10 PM GilJohnson said...
Using an array of 32 bit integers, you have to go to some
trouble to slice out, say, bits 20 to 40.
I think I agree -- if in fact it's not impossible. Tell me that's a
typo or take a moment to explain what I'm misunderstanding...
Emile
"wesley chun" wrote
i believe the 1st ed is 3.0 and the 2nd ed is 3.1 but haven't
confirmed with him yet.
I bought the 1st edition which is definitely 3.0.
It was quite good I thought.
I doubt I'll buy another edition just for the 3.1 uplift, but if he
covers the new themed widgets in tki
"Robert Berman" wrote
I am trying to represent a number as a list of bits: for example the bit
representation of the integer 8.
Numbers are already represented as arrays of bits, thats how
they are stored.
I am almost certain there is a relatively easy way to convert an integer
that can b
As`Kent Johnson pointed out, you don't need to convert anything to strings, etc.
An integer _is_ a bit array, and individual bits can be tested using the bitwise
operators. For your example, if A is an integer you can test bit 8 with:
if A & (1 << 8): dosomething
There is a simple example on the Py
On Mi, 2009-12-02 at 13:08 -0500, Robert Berman wrote:
> Hi,
>
> I am trying to represent a number as a list of bits: for example the
> bit representation of the integer 8. I did find a number of articles
> pertaining to a module called bitarray but I was unable to
> download/install that package.
>> I have the first edition of your book. What is the difference between
>> two editions?
i believe the 1st ed is 3.0 and the 2nd ed is 3.1 but haven't
confirmed with him yet.
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2
I don't know that you will reach Mark through this list, I forwarded
his post from another list. There is some info on the book web site:
http://www.qtrac.eu/py3book.html
When replying to a digest, please
- change the subject line to something relevant
- don't quote the entire digest in your reply
On Wed, Dec 2, 2009 at 1:08 PM, Robert Berman wrote:
> Hi,
>
> I am trying to represent a number as a list of bits: for example the bit
> representation of the integer 8. I did find a number of articles pertaining
> to a module called bitarray but I was unable to download/install that
> package. I
ounce. A helpful summary of the differences
>>> between Python 2 and 3 (though some of the differences were introduced
>>> well before Python 3).
>>
>>> It is available as a free PDF download (no registration or anything)
>>>
My approach has been to store it as an array and then build the integer as
needed. This code requires Python 2.5 or later.
def bits2int(l):
return sum([2**i if j else 0 for i,j in enumerate(l)])
To convert the other way:
def int2bits(m, n):
return [int(bool(m&(1<>= inc
return i
flo
Wayne,
Thank you very much.
Robert
On Wed, 2009-12-02 at 12:48 -0600, Wayne Werner wrote:
> On Wed, Dec 2, 2009 at 12:08 PM, Robert Berman
> wrote:
>
> Hi,
>
> I am trying to represent a number as a list of bits: for
> example the bit representation of the inte
On Wed, Dec 2, 2009 at 12:08 PM, Robert Berman wrote:
> Hi,
>
> I am trying to represent a number as a list of bits: for example the bit
> representation of the integer 8. I did find a number of articles pertaining
> to a module called bitarray but I was unable to download/install that
> package
Hi,
I am trying to represent a number as a list of bits: for example the bit
representation of the integer 8. I did find a number of articles
pertaining to a module called bitarray but I was unable to
download/install that package. I am using Linux on Ubuntu 9.10; Python
2.6.2.
I am almost certa
Thanks
2009/12/3 Wayne Werner
>
>
> On Wed, Dec 2, 2009 at 8:13 AM, Joerg Woelke wrote:
>
>> Alan Gauld [091202 15:07]:
>> > >
>> http://ptgmedia.pearsoncmg.com/imprint_downloads/informit/promotions/python/python2python3.pdf
>> >
>> >
>> > It didn't work for me I always got forwarded to the B
On Wed, Dec 2, 2009 at 8:13 AM, Joerg Woelke wrote:
> Alan Gauld [091202 15:07]:
> > >
> http://ptgmedia.pearsoncmg.com/imprint_downloads/informit/promotions/python/python2python3.pdf
> >
> >
> > It didn't work for me I always got forwarded to the Book "home page"
> > on InformIT
> Worked for m
* Alan Gauld [091202 15:07]:
> >http://ptgmedia.pearsoncmg.com/imprint_downloads/informit/promotions/python/python2python3.pdf
>
>
> It didn't work for me I always got forwarded to the Book "home page"
> on InformIT
Worked for me with wget(1).
--
You are capable of planning your future.
__
On Wed, Dec 2, 2009 at 8:56 AM, Alan Gauld wrote:
>
> "Kent Johnson" wrote
>
>> Forwarded from python-announce. A helpful summary of the differences
>> between Python 2 and 3 (though some of the differences were introduced
>> well before Python 3).
>
>> It is available as a free PDF download (no
ok so its working and drops a normal cow and randomly a green cow but
i want it to be able to tell when you collide with the green cow cause
its gonna be a powerup.
heres the code for my program.
# Pizza Panic
# Player must catch falling pizzas before they hit the ground
from livewires import ga
"Kent Johnson" wrote
Forwarded from python-announce. A helpful summary of the differences
between Python 2 and 3 (though some of the differences were introduced
well before Python 3).
It is available as a free PDF download (no registration or anything)
from InformIT's website. Here's the di
Forwarded from python-announce. A helpful summary of the differences
between Python 2 and 3 (though some of the differences were introduced
well before Python 3).
Kent
-- Forwarded message --
From: Mark Summerfield
To: comp-lang-python-annou...@moderators.isc.org
Date: Tue, 1 Dec
On Tuesday 01 December 2009, questions anon wrote:
> I would now like to add a line of best fit. I think the command is
> polyfit()??
> But I can't seem to get it to work
These are the steps to make polyval work. I typed it into
an 'ipython -pylab' session; I hope I included all relevant lines an
24 matches
Mail list logo