Re: What's the neatest way of getting dictionary entries in a specified order?

2017-03-08 Thread Michael Torrie
On 03/08/2017 12:27 PM, Chris Green wrote: > I have a fairly simple application that populates a GUI window with > fields from a database table. The fields are defined/configured by a > dictionary as follows:- Instead of ordering the data in Python, why not rely on the GUI to do the sort? Most G

Re: Alternative to signals in threads

2017-03-08 Thread woooee
Use multiprocessing since you want to do multiple things at once https://pymotw.com/2/multiprocessing/basics.html If I understand you correctly, once the string is found you would terminate the process, so you would have to signal the calling portion of the code using a Manager dictionary or l

Re: What's the neatest way of getting dictionary entries in a specified order?

2017-03-08 Thread Chris Angelico
On Thu, Mar 9, 2017 at 8:25 AM, Chris Green wrote: > Chris Angelico wrote: >> On Thu, Mar 9, 2017 at 6:27 AM, Chris Green wrote: >> > dbcol['firstname'] = col('First Name', True, False) >> > dbcol['lastname'] = col('Last Name', True, False) >> >> http://www.kalzumeus.com/2010/06/17/false

Re: What's the neatest way of getting dictionary entries in a specified order?

2017-03-08 Thread Chris Green
Chris Angelico wrote: > On Thu, Mar 9, 2017 at 6:27 AM, Chris Green wrote: > > dbcol['firstname'] = col('First Name', True, False) > > dbcol['lastname'] = col('Last Name', True, False) > > http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/ > Yes, I'm well aw

Re: What's the neatest way of getting dictionary entries in a specified order?

2017-03-08 Thread Chris Angelico
On Thu, Mar 9, 2017 at 6:27 AM, Chris Green wrote: > dbcol['firstname'] = col('First Name', True, False) > dbcol['lastname'] = col('Last Name', True, False) http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/ ChrisA -- https://mail.python.org/mailman/listinfo

Re: What's the neatest way of getting dictionary entries in a specified order?

2017-03-08 Thread gvmcmt
On Thursday, March 9, 2017 at 1:03:31 AM UTC+5:30, Chris Green wrote: > I have a fairly simple application that populates a GUI window with > fields from a database table. The fields are defined/configured by a > dictionary as follows:- > > # > # > # Address Book field details, dict

Re: What's the neatest way of getting dictionary entries in a specified order?

2017-03-08 Thread Chris Green
Ethan Furman wrote: > On 03/08/2017 11:27 AM, Chris Green wrote: > > > The for loop gets the items from the dictionary in an order that isn't > > what I want. How can I configure things so they're in the order I want? > > What order do you want? > Well probably the First Name and Last Name, th

Re: What's the neatest way of getting dictionary entries in a specified order?

2017-03-08 Thread Chris Green
Jussi Piitulainen wrote: > Chris Green writes: > > > I have a fairly simple application that populates a GUI window with > > fields from a database table. The fields are defined/configured by a > > dictionary as follows:- > > > > # > > # > > # Address Book field details, dictionary

Re: What's the neatest way of getting dictionary entries in a specified order?

2017-03-08 Thread Jussi Piitulainen
Chris Green writes: > I have a fairly simple application that populates a GUI window with > fields from a database table. The fields are defined/configured by a > dictionary as follows:- > > # > # > # Address Book field details, dictionary key is the database column > # >

Re: What's the neatest way of getting dictionary entries in a specified order?

2017-03-08 Thread Ethan Furman
On 03/08/2017 11:27 AM, Chris Green wrote: The for loop gets the items from the dictionary in an order that isn't what I want. How can I configure things so they're in the order I want? What order do you want? -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

What's the neatest way of getting dictionary entries in a specified order?

2017-03-08 Thread Chris Green
I have a fairly simple application that populates a GUI window with fields from a database table. The fields are defined/configured by a dictionary as follows:- # # # Address Book field details, dictionary key is the database column # dbcol = {} dbcol['firstname'] = co

Re: Better way to do this dict comprehesion

2017-03-08 Thread Jussi Piitulainen
Sayth Renshaw writes: >> To find an unpaired number in linear time with minimal space, try >> stepping through the list and either adding to a set or removing from >> it. At the end, your set should contain exactly one element. I'll let >> you write the actual code :) >> >> ChrisA > > ChrisA the

Re: Better way to do this dict comprehesion

2017-03-08 Thread Jussi Piitulainen
Sayth Renshaw writes: > Peter I really like this > > The complete code: > from collections import Counter def find_it(seq): > ... [result] = [k for k, v in Counter(seq).items() if v % 3 == 0] > ... return result You confirmed to Chris that you want the item that occurs an o

Re: Better way to do this dict comprehesion

2017-03-08 Thread Peter Otten
Sayth Renshaw wrote: > Peter I really like this > > The complete code: > from collections import Counter def find_it(seq): > ... [result] = [k for k, v in Counter(seq).items() if v % 3 == 0] > ... return result > ... test_seq = [20,1,-1,2,-2,3,3,5,5,1,2,4,20,4,-1,-2,5] >>>

Re: Better way to do this dict comprehesion

2017-03-08 Thread Sayth Renshaw
Peter I really like this The complete code: >>> from collections import Counter >>> def find_it(seq): ... [result] = [k for k, v in Counter(seq).items() if v % 3 == 0] ... return result ... >>> test_seq = [20,1,-1,2,-2,3,3,5,5,1,2,4,20,4,-1,-2,5] >>> find_it(test_seq) But what ma

Run Python in iPad/iPhone

2017-03-08 Thread yanyouhui
Analyser is the only iOS app that integrated both Python and R engines. build-in popular Python modules for stats/machine learning/image processing: numpy,scipy,matplotlib,scikit-learn,scikit-image,pandas,pymc,nilearn,astroML,statsmodels,astropy.. https://itunes.apple.com/cn/app/fen-xi-zhe/i

Alternative to signals in threads

2017-03-08 Thread saatomic
I've been unsuccessfully looking for an alternative for signals, that works in threads. After updating a script of mine from being single-threaded to being multi-threaded, I realised that signals do not work in threads. I've used signals to handle blocking operations that possibly take forever

Re: Better way to do this dict comprehesion

2017-03-08 Thread Peter Otten
Sayth Renshaw wrote: > Hi > > I have got this dictionary comprehension and it works but how can I do it > better? List comprehensions (that's what you have) are nice, but overused. > from collections import Counter > > def find_it(seq): > counts = dict(Counter(seq)) There is no need to

Re: Questions about API documentation

2017-03-08 Thread dieter
selphi...@gmail.com writes: > I am trying to understand how to write good API documentation. I have read > “7. Documenting Python” in the python developers guide [1] and skimmed the > Doc-SIG email archives, but I still have some questions and I would > appreciate your help. (Whenever I refer to