Re: [Tutor] MVC/MVP examples of how to implement it

2006-12-23 Thread Basil Shubin
Don Taylor пишет: > Basil Shubin wrote: >> Hi friends! >> >> I have read articles about MVC/MVP, but still can't get a clue to how >> implement it in really working application :-( Because I better >> understand with ready to use examples, can you provide link to free >> python+GUI application w

Re: [Tutor] Lists on the fly?

2006-12-23 Thread Luke Paireepinart
Kent Johnson wrote: > Luke Paireepinart wrote: > >> I think a better way to do this is to check if 'Level_%i' is in your >> dictionary already. > I am a fan of dict.setdefault() which has this logic built in: > Lev_List = {} > for Element in Elements: > keystr = 'Level_%i' % Element['Level

Re: [Tutor] Lists on the fly?

2006-12-23 Thread Kent Johnson
Luke Paireepinart wrote: > I think a better way to do this is to check if 'Level_%i' is in your > dictionary already. > so the loop becomes > > Lev_List = {} > for Element in Elements: > keystr = 'Level_%i' % Element['Level'] > if not Lev_List.has_key(keystr): >Lev_List[keystr] =

Re: [Tutor] Lists on the fly?

2006-12-23 Thread Luke Paireepinart
[snip] > # Get Levels List > for Element in Elements: > Lev_List['Level_%i' % (Element['Level'])] = [] > > # Append Element to corresponding Level > for Element in Elements: > Lev_List['Level_%i' % (Element['Level'])].append(Element['Name']) [snip snip] > Probably the f

Re: [Tutor] Lists on the fly?

2006-12-23 Thread Carlos
Hi, First of all, thanks for your help. This is how this ended up: Elements = [ {'Name': 'Access', 'Parent': 'Plot', 'Level': 1.0, 'Height': 3.0, 'Width': 3.0, 'Depth': 3.0}, {'Name': 'Circulation_01', 'Parent': 'Access', 'Level': 1.0, '

Re: [Tutor] [tutor] sort a list

2006-12-23 Thread Luke Paireepinart
[EMAIL PROTECTED] wrote: > Hi List, > > I have a list like this x=[7,4,2,6] > and print x.sort() > gives to me None ! : > > >>> x=[7,4,2,6] >>> print x.sort() >>> > None > > ... but > > >>> x=[7,4,2,6] >>> x.sort() >>> print x >>> > [2, 4, 6, 7] > > so, why list.sort() returns N

[Tutor] [tutor] sort a list

2006-12-23 Thread emilia12
Hi List, I have a list like this x=[7,4,2,6] and print x.sort() gives to me None ! : >> x=[7,4,2,6] >> print x.sort() None ... but >> x=[7,4,2,6] >> x.sort() >> print x [2, 4, 6, 7] so, why list.sort() returns None? is this normal ? (the python is "Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [M

Re: [Tutor] Lists on the fly?

2006-12-23 Thread Alan Gauld
"Luke Paireepinart" <[EMAIL PROTECTED]> wrote >>> 'list_%i' % (i) = [] >>> > Note, though this is pretty arbitrary :) and only saves you 2 > characters... > You don't need to create a tuple if you're only packing in one > value. > >>> i = 1 > >>> 'list_%i' % i And that works for multiple

Re: [Tutor] Lists on the fly?

2006-12-23 Thread Alan Gauld
"Carlos" <[EMAIL PROTECTED]> wrote > I am wondering if it is possible to create lists on the fly. In general you can use a list comprehension to do that. > This is only so you can have an idea: > > for i in range(5): >'list_%i' % (i) = [] >>> mylists = [ [] for n in range(5)] creats a list

Re: [Tutor] how to permanently add a module path

2006-12-23 Thread Alan Gauld
"Christopher Arndt" <[EMAIL PROTECTED]> wrote > Linux: > > Depends on your distribution: It depends even more on the shell you use. In csh or tcsh the file to modify is .cshrc > - Standard way would be to edit ~/.bash_profile and add e.g. I prefer to modify environment variables in .profile.