On 2018-07-20 19:13:44 +1000, Chris Angelico wrote:
> On Fri, Jul 20, 2018 at 7:00 PM, Brian Oney via Python-list
> wrote:
> > That's right I had forgotten about that. Thank you for the quick
> > answer.Some fun:$ ipythonPython 2.7.13 (default, Nov 24 2017, 17:33:09)
> > ...In [1]: j = 16; i = 1
On Friday, July 20, 2018 at 2:00:26 AM UTC-7, Brian Oney wrote:
> Are 16|1 and 16+1 internally the same operation (for integers)?
For 16 and 1, the output of the two operations happen to be the same, but
generally a bitwise OR is not the same are addition. There are no carry bits
in the bitwis
On 2018-07-20, Chris Angelico wrote:
> On Sat, Jul 21, 2018 at 1:14 AM, Grant Edwards
> wrote:
>> On 2018-07-20, Dennis Lee Bieber wrote:
>>
>>> While I suspect Python isn't micro-optimizing, take into account
>>> that most processors do have an "increment"/"decrement" operation --
>>> since th
On Sat, Jul 21, 2018 at 2:39 AM, Marko Rauhamaa wrote:
> Chris Angelico :
>
>> On Sat, Jul 21, 2018 at 1:14 AM, Grant Edwards
>> wrote:
>>> I refuse to believe there's an extant processor in common use where
>>> an ADD is faster than an OR unless somebody shows me the processor
>>> spec sheet.
>>
Chris Angelico :
> On Sat, Jul 21, 2018 at 1:14 AM, Grant Edwards
> wrote:
>> I refuse to believe there's an extant processor in common use where
>> an ADD is faster than an OR unless somebody shows me the processor
>> spec sheet.
>
> "Faster than"? I'd agree with you. But "as fast as"? I believe
On Fri, 2018-07-20 at 10:38 -0400, Dennis Lee Bieber wrote:
> On Fri, 20 Jul 2018 11:00:09 +0200, Brian Oney via Python-list
> declaimed the following:
>
> > Are 16|1 and 16+1 internally the same operation (for integers)?
>
> For those integers the EFFECT/RESULT will be the same. But...
>
On Sat, Jul 21, 2018 at 1:14 AM, Grant Edwards
wrote:
> On 2018-07-20, Dennis Lee Bieber wrote:
>
>> While I suspect Python isn't micro-optimizing, take into account
>> that most processors do have an "increment"/"decrement" operation --
>> since that is done so much at the low-level. Also, just
On 2018-07-20, Dennis Lee Bieber wrote:
> While I suspect Python isn't micro-optimizing, take into account
> that most processors do have an "increment"/"decrement" operation --
> since that is done so much at the low-level. Also, just general
> integer addition is common, so the hardware may be
On Fri, 2018-07-20 at 18:07 +0900, xffox wrote:
> On Fri, Jul 20, 2018 at 08:25:04AM +0200, Brian Oney via Python-list wrote:
> > Therefore, what book or learning course do you recommend? I imagine
> > something that tours or skims
> > the fundamentals of Boolean algebra and digital logic, and the
Brian Oney writes:
> On Fri, 2018-07-20 at 06:37 +, Steven D'Aprano wrote:
>> On Fri, 20 Jul 2018 08:25:04 +0200, Brian Oney via Python-list wrote:
>>
>> > PS: Can I twiddle bits in Python?
>>
>> Yes.
>>
>> These operators work on ints:
>>
>> bitwise AND: &
>> bitwise OR: |
>> bi
On Fri, Jul 20, 2018 at 7:00 PM, Brian Oney via Python-list
wrote:
> On Fri, 2018-07-20 at 06:37 +, Steven D'Aprano wrote:
>> On Fri, 20 Jul 2018 08:25:04 +0200, Brian Oney via Python-list wrote:
>>
>> > PS: Can I twiddle bits in Python?
>>
>> Yes.
>>
>> These operators work on ints:
>>
>> b
On Fri, Jul 20, 2018 at 08:25:04AM +0200, Brian Oney via Python-list wrote:
> Therefore, what book or learning course do you recommend? I imagine something
> that tours or skims
> the fundamentals of Boolean algebra and digital logic, and then goes to C and
> some fun homework
> problems. It may
On Fri, 2018-07-20 at 06:37 +, Steven D'Aprano wrote:
> On Fri, 20 Jul 2018 08:25:04 +0200, Brian Oney via Python-list wrote:
>
> > PS: Can I twiddle bits in Python?
>
> Yes.
>
> These operators work on ints:
>
> bitwise AND: &
> bitwise OR: |
> bitwise XOR: ^
>
That's right I ha
On Fri, 20 Jul 2018 08:25:04 +0200, Brian Oney via Python-list wrote:
> PS: Can I twiddle bits in Python?
Yes.
These operators work on ints:
bitwise AND: &
bitwise OR: |
bitwise XOR: ^
--
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere
On Fri, Jul 20, 2018 at 4:25 PM, Brian Oney via Python-list
wrote:
> PS: Can I twiddle bits in Python?
You sure can! With most of the same operators that you would in C. The
main difference is that Python's integers don't have word size limits;
instead of working with, say, 32-bit integer, you j
Dear Python-List,
an old dog wants to learn some new tricks.
Due to my contact with microcontrollers, I am learning C/C++. I am aware that
this is the
endearing, helpful, yet chatty python-list. Many of you are competent
C-programmers.
The allure of C is that I can play directly with memory.
16 matches
Mail list logo