Debugging (was Re: Why not allow empty code blocks?)
Chris Angelico
rosuav at gmail.com
Tue Aug 2 16:50:02 EDT 2016
On Wed, Aug 3, 2016 at 5:55 AM, Christian Gollwitzer <auriocus at gmx.de> wrote:
>> - Arbitrary-precision non-integers
>
>
> https://pypi.python.org/pypi/bigfloat/
>
> ?
Wasn't aware of that. Cool. Not that I need it very often (and when I
do, I can use Pike, which has MPFR support built-in). Or I can use
decimal.Decimal, which isn't exactly the same, but often accomplishes
the same thing.
>> - Convenient syntax for a few array/list manipulations
>
>
> Huh? Slices and list comprehensions go a long way. What syntax can you
> imagine that goes beyond that?
Imagine you have a list (or array, depending on language) of objects,
some of which may be None (or null). Call the foo method on every
object, ignoring the null/None ones.
# Python - creates a useless list
[obj.foo() for obj in objects if obj]
# Python - a bit clunky
for obj in objects:
if obj:
obj.foo()
//Pike
objects->foo();
But my point wasn't "hey, Python sucks", but "look what is *not* on my
list". Other people's lists of stuff they miss will differ (either
because they know of third-party solutions, like bigfloat, or because
they just don't need them... like bigfloat), and that's fine and
correct.
ChrisA
More information about the Python-list
mailing list