max(), sum(), next()

Mensanator mensanator at aol.com
Sun Sep 7 20:36:58 EDT 2008


On Sep 7, 1:17�pm, Patrick Maupin <pmau... at gmail.com> wrote:
> 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?

I wasn't thinking "compete", rather "complement". Python obviously
wants to be a player in the SQL market, so you would think it
would be in Python's interest to know how SQL behaves, just as it's in
Python's interest for the os module to know how BOTH Linnux and
Windows work.

>
> This is starting to feel like a troll,

It wasn't intended to be.

> 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,

Things never change if no one ever speaks up.

> 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:

Thanks. I'll drop this from this point on.

>
> >>> class MyZero(int):
>
> ... � � pass
> ...
>
>
>
> >>> zero = MyZero()
> >>> x=sum([], zero)
> >>> isinstance(x,MyZero)
> True
> >>> x = sum([1,2,3], zero)
> >>> isinstance(x,MyZero)
> False- Hide quoted text -
>
> - Show quoted text -




More information about the Python-list mailing list