@mavica_again true. But it does drive me crazy a little seeing people do bit twiddling in Python when that is clearly something that would be more efficient if written in C.

@mavica_again Looks just fine to me?

I tend to break something like that OR line into multiple lines with \ so that I can look down the columns and make sure I didn't typo a number, but I'm sure it works fine as a 1-liner.

@rainwarrior it really felt like something that there ought to be a better way to do it, but if it passes your smell test i feel better :P

@mavica_again Someone who's really into python language features might write something like this:
```
from functools import reduce
byte = reduce(lambda a,b: a|b, [bitmap[x,y+i] >> i for i in range(8)])
```
I don't find that kind of thing easier to read or understand though, and it would probably give worse performance (not that it matters). I'd rather just write something that doesn't make me have to think harder.

Sign in to participate in the conversation
Computer Fairies

Computer Fairies is a Mastodon instance that aims to be as queer, friendly and furry as possible. We welcome all kinds of computer fairies!