On Dec 19, 4:46 pm, "Frank Millman" wrote:
> Am I missing something?
No, I seem to be. I have _no_ idea how I got that original syntax to
work :|
My apologies, DevPlayer's suggestion is much more sensible, although
slices are still handy when dealing with groups of values.
--
http://mail.pytho
On Mon, 19 Dec 2011 10:40:06 +1100, Chris Angelico wrote:
> On Mon, Dec 19, 2011 at 9:55 AM, HoneyMonster
> wrote:
>> When the user selects a row and clicks a button, I am using:
>> pos = self.grid_1.GetGridCursorRow() to establish which tuple in recs
>> is involved, and then pid = recs[pos][4] t
On Dec 19, 1:46 am, "Frank Millman" wrote:
> "Steven D'Aprano" wrote in message
>
> news:4eeea8eb$0$11091$c3e8...@news.astraweb.com...
>
> > On Sun, 18 Dec 2011 18:35:47 -0800, alex23 wrote:
>
> >> Pre-namedtuple, I used to like using named slices for this:
>
> >> cPID = slice(19)
> >> pi
"Steven D'Aprano" wrote in message
news:4eeea8eb$0$11091$c3e8...@news.astraweb.com...
On Sun, 18 Dec 2011 18:35:47 -0800, alex23 wrote:
Pre-namedtuple, I used to like using named slices for this:
cPID = slice(19)
pid = recs[cPID]
You know, that is an incredibly simple thing and ye
On Sun, 18 Dec 2011 18:35:47 -0800, alex23 wrote:
> Pre-namedtuple, I used to like using named slices for this:
>
> cPID = slice(19)
> pid = recs[cPID]
You know, that is an incredibly simple thing and yet it never dawned on
me before now. Thank you for sharing that.
--
Steven
--
ht
Roy Smith wrote:
> A common convention
> is that when you're unpacking a tuple (or a list, I suppose) and are
> only interested in some of the elements, you unpack the others into "_".
> Thus:
>
> _, _, _, _, pid, _, _, _ = recs[19]
Pre-namedtuple, I used to like using named slices for this:
On Mon, Dec 19, 2011 at 9:55 AM, HoneyMonster wrote:
> When the user selects a row and clicks a button, I am using:
> pos = self.grid_1.GetGridCursorRow() to establish which tuple in recs is
> involved, and then pid = recs[pos][4] to determine the key value (I
> suspected that accessing recs direc
On Mon, 19 Dec 2011 07:51:08 +1100, Chris Angelico wrote:
> On Mon, Dec 19, 2011 at 6:41 AM, HoneyMonster
> wrote:
>> My question is doubtless a very easy one to answer: Say I want the
>> ninth element in the twentieth tuple put into variable PID, I can do
>> this, bearing in mind that numbering
In article ,
Chris Angelico wrote:
> If you're absolutely certain that you'll always get precisely one
> value from a query, this becomes rather more useful:
>
> mode = conn.query("SELECT mode FROM config WHERE id=5")[0][0]
Although, if you're going to do that, you might as well take advantage
On Mon, Dec 19, 2011 at 6:41 AM, HoneyMonster wrote:
> My question is doubtless a very easy one to answer: Say I want the ninth
> element in the twentieth tuple put into variable PID, I can do this,
> bearing in mind that numbering starts at zero:
>
> tup = recs[19]
> PID = tup[8]
>
> But there mu
In article ,
HoneyMonster wrote:
> I think I rather like Python!
+1 QOTD?
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 18 Dec 2011 15:04:13 -0500, Roy Smith wrote:
> In article ,
> HoneyMonster wrote:
>
>> Hi,
>>
>> I'm just starting to learn Python, so please bear with me. I have in my
>> program an object (recs) which is a list of tuples (returned as such by
>> a database query).
>
> Sounds like a s
In article ,
HoneyMonster wrote:
> Hi,
>
> I'm just starting to learn Python, so please bear with me. I have in my
> program an object (recs) which is a list of tuples (returned as such by a
> database query).
Sounds like a standard database interface -- each tuple represents one
row in the
On 18 December 2011 19:41, HoneyMonster wrote:
> Hi,
>
> I'm just starting to learn Python, so please bear with me. I have in my
> program an object (recs) which is a list of tuples (returned as such by a
> database query).
>
> My question is doubtless a very easy one to answer: Say I want the nin
Hi,
I'm just starting to learn Python, so please bear with me. I have in my
program an object (recs) which is a list of tuples (returned as such by a
database query).
My question is doubtless a very easy one to answer: Say I want the ninth
element in the twentieth tuple put into variable PID,
15 matches
Mail list logo