Re:"@" on Twitter
by icebraining on Saturday April 28, 2018 @01:31AM
(#16946208)
Well, booleans are integers, so you can do:
[ Parent
| on HN ]
fizzbuzz = lambda n: [print((“fizz” * m % 3 == 0) + (“buzz” * m % 5 == 0) or m) for m in range(n)]
Not sure if this is great or terrible
Re:"@" on Twitter
by ubernostrum on Saturday April 28, 2018 @02:22AM
(#16946337)
That's not "coercion", though. That's Python obeying the LSP, because bool is a subclass of int.