max(), sum(), next()

Patrick Maupin pmaupin at gmail.com
Sun Sep 7 14:17:04 EDT 2008


On Sep 7, 12:30 pm, Mensanator <mensana... at aol.com> wrote:
> On Sep 6, 11:05 pm, Steven D'Aprano <st... at REMOVE-THIS-
> > Sheesh. That's not a problem, because Python is not trying to be a
> > dialect of SQL.
>
> And yet, they added a Sqlite3 module.

Does that mean that, because there is an 'os' module, Python is trying
to compete with Linux and Windows?

This is starting to feel like a troll, but JUST IN CASE you are really
serious about wanting to get work done with Python, rather than
complaining about how it is not perfect, I offer the following snippet
which will show you how you can test the results of a sum() to see if
there were any items in the list:

>>> class MyZero(int):
...     pass
...
>>> zero = MyZero()
>>> x=sum([], zero)
>>> isinstance(x,MyZero)
True
>>> x = sum([1,2,3], zero)
>>> isinstance(x,MyZero)
False
>>>



More information about the Python-list mailing list