In article <[EMAIL PROTECTED]>,
Andrea Griffini <[EMAIL PROTECTED]> wrote:
> Isn't the handling of StopIteration confined in the very moment of
> calling .next() ? This was what I expected... and from a simple test
> looks also what is happening...
Not if someone farther back in the call chain i
Christopher J. Bottaro wrote:
Wow, good advice. One question, how is the generator class implemented so
that if assigned to a tuple/list, it knows what to do? Is it possible to
overload the assignment operator kinda like in C++?
Tuple unpacking works with generators because generators implement t
Steven Bethard wrote:
> I don't do much with SQL/databases stuff, but if you really know the
> result will be a single row, you can take advantage of tuple unpacking
> and do something like:
>
> row, = obj.ExecSQLQuery(sql, args)
>
> or
>
> [row] = obj.ExecSQLQuery(sql, args)
>
> This has the a
David Eppstein wrote:
In article <[EMAIL PROTECTED]>,
"Robert Brewer" <[EMAIL PROTECTED]> wrote:
But I'm guessing that you can't index into a generator as if
it is a list.
row = obj.ExecSQLQuery(sql, args).next()
I've made it a policy in my own code to always surround explicit calls
to next()
Robert Brewer wrote:
Christopher J. Bottaro wrote:
I have a generator that works like this:
for row in obj.ExecSQLQuery(sql, args):
# process the row
Now there are some querys that run where I know the result
will only be a
single row. Is there anyway to get that single row from the genera
In article <[EMAIL PROTECTED]>,
"Robert Brewer" <[EMAIL PROTECTED]> wrote:
> > But I'm guessing that you can't index into a generator as if
> > it is a list.
>
> row = obj.ExecSQLQuery(sql, args).next()
I've made it a policy in my own code to always surround explicit calls
to next() with try
Christopher J. Bottaro wrote:
> I have a generator that works like this:
>
> for row in obj.ExecSQLQuery(sql, args):
> # process the row
>
> Now there are some querys that run where I know the result
> will only be a
> single row. Is there anyway to get that single row from the generato