Re: How to sort over dictionaries

2018-08-29 Thread Peter Otten
har...@moonshots.co.in wrote: > sort = sorted(results, key=lambda res:itemgetter('date')) > print(sort) > > > I have tried the above code peter but it was showing error like > TypeError: '<' not supported between instances of 'operator.itemgetter' > and 'operator.itemgetter' lambda res: it

Re: How to sort over dictionaries

2018-08-29 Thread harish
> > > On Wednesday, August 29, 2018 at 11:20:26 AM UTC+5:30, John Ladasky wrote: > >> The top-level object you are showing is a list [], not a dictionary {}. > >> It has dictionaries inside of it though. Do you want to sort the list? > >> > >> Python's sorted() function returns a sorted copy of

Re: Question about floating point

2018-08-29 Thread Steven D'Aprano
On Wed, 29 Aug 2018 11:31:29 +1200, Gregory Ewing wrote: > Frank Millman wrote: >> I have been trying to explain why >> they should use the decimal module. They have had a counter-argument >> from someone else who says they should just use the rounding technique >> in my third example above. > >

Re: Question about floating point

2018-08-29 Thread Steven D'Aprano
On Tue, 28 Aug 2018 16:47:25 +0200, Frank Millman wrote: > The reason for my query is this. I am assisting someone with an > application involving monetary values. I have been trying to explain why > they should use the decimal module. They have had a counter-argument > from someone else who says

Re: Broken pip

2018-08-29 Thread Thomas Jollans
On 08/29/2018 09:05 PM, Michael F. Stemper wrote: I can certainly see a use case for user-specific versions of modules, and even user-specific presence of modules. For instance, at school, different researchers might need to have specific modules for their work. Possibly one person is doing some

RE: How to sort over dictionaries

2018-08-29 Thread David Raymond
Well, that's a list of... somethings. So I'm assuming you mean sort a list of dictionaries? foo.sort(key = lambda x: time.strptime(x["date"], "%d-%m-%Y %H:%M")) with , reverse = True in the sort if you want it sorted in reverse -Original Message- From: Python-list [mailto:python-list

Re: Calling an unbound method in C using the Public API

2018-08-29 Thread Stefan Behnel
Matthieu Dartiailh schrieb am 29.08.2018 um 16:33: > I am one of the maintainer of the atom library > (https://github.com/nucleic/atom ). This > library provides low-memory footprint Python objects, descriptors and > containers enforcing type validation, implemen

Re: Broken pip

2018-08-29 Thread Michael F. Stemper
On 2018-08-29 03:10, Thomas Jollans wrote: > On 2018-08-28 20:10, Michael F. Stemper wrote: >> I'm trying to upgrade my pip on Ubuntu 16.04. I appear to have >> buggered things up pretty well. (Details follow) Any suggestions >> on how to undo this and get everything back to proper operation? >> >>

How to sort over dictionaries

2018-08-29 Thread harish
[, https://getbootstrap.com/', 'author': 'Hari', 'date': '15-08-2018 15:15', 'headline': 'latest news'}>, , https://www.deps.co/blog/google-cloud-platform-good-bad-ugly/', 'author': 'Harish', 'headline': 'Google Cloud Platform – The Good, Bad, and Ugly', 'date': '16-08-2018 08:15'}>, , , http:

Calling an unbound method in C using the Public API

2018-08-29 Thread Matthieu Dartiailh
Hi, I am one of the maintainer of the atom library (https://github.com/nucleic/atom ). This library provides low-memory footprint Python objects, descriptors and containers enforcing type validation, implements the observer pattern. For list, we basically subc

Re: Broken pip

2018-08-29 Thread Sivan Greenberg
I used to get into that sort of lib chaos but then a few years ago I stopped doing any python outside of virtualenv(s). My 2c is use it always, use it more and then you’re free to use pip as the only pkg manager for the project, with the occasional caveat that sometimes you require non python libs

Re: Question about floating point

2018-08-29 Thread Oscar Benjamin
On Tue, 28 Aug 2018 at 15:50, Frank Millman wrote: > > "Frank Millman" wrote in message news:pm3l2m$kv4$1...@blaine.gmane.org... > > > > I know about this gotcha - > > > > >>> x = 1.1 + 2.2 > > >>> x > > 3.3003 > > > [...] > > > > >>> y = 3.3 > > >>> y > > 3.3 > > > [...] > > > > >>>

Re: How to sort over dictionaries

2018-08-29 Thread Peter Otten
har...@moonshots.co.in wrote: > On Wednesday, August 29, 2018 at 11:20:26 AM UTC+5:30, John Ladasky wrote: >> The top-level object you are showing is a list [], not a dictionary {}. >> It has dictionaries inside of it though. Do you want to sort the list? >> >> Python's sorted() function return

Re: How to sort over dictionaries

2018-08-29 Thread harish
On Wednesday, August 29, 2018 at 11:20:26 AM UTC+5:30, John Ladasky wrote: > The top-level object you are showing is a list [], not a dictionary {}. It > has dictionaries inside of it though. Do you want to sort the list? > > Python's sorted() function returns a sorted copy of a sequence. Sort

Re: Broken pip

2018-08-29 Thread Thomas Jollans
On 2018-08-28 20:10, Michael F. Stemper wrote: > I'm trying to upgrade my pip on Ubuntu 16.04. I appear to have > buggered things up pretty well. (Details follow) Any suggestions > on how to undo this and get everything back to proper operation? > > Based on the information that I found at: >