Re: python question

  • From: "Octavian Rasnita" <orasnita@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Wed, 17 Dec 2008 15:40:10 +0200

The Windows msi installer for python from python.org contains a chm help file for python 3, or at least this is how it is named.


I haven't started to read it though.

But I have a question regarding python.

I have started to read the book "Perl to python migration" hoping to understand it better, but I am pretty confused of how python does the sorting, or at least about how it is explained in that book that might be old, because it talks about python 2.0.

For example, if I have a perl hash, or python dictionary like:

my %hash = (Joe => 30, John => 40, Michael => 40);

and I want to sort it for example by the values of the hashin increasing order, then by the keys of the hash in decreasing order, in perl I would need to do just:

foreach my $key(sort {$hash{$a} <=> $hash{$b} or $b cmp $a} keys %hash) {
print "$key, $hash{$key}\n";
}

This would print:
Joe, 30
Michael, 40
John, 40

Can you tell me how to do this in python? I hope there are newer ways of doing this more easier than what I read in that book.

And I would also like to know which is the prefered ORM, the prefered templating systems, form manager(s), web framework... (although I think it is Zope), so if you have used them, please tell me.

Octavian

----- Original Message ----- From: <james.homme@xxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Wednesday, December 17, 2008 2:29 PM
Subject: RE: python question


Hi,
Along those lines, does anyone know if any of the Python documentation on
http://www.nonvisualdevelopment.org talks about 3.0?

Thanks.

Jim

James D Homme, Usability Engineering, Highmark Inc.,
james.homme@xxxxxxxxxxxx, 412-544-1810

"The difference between those who get what they wish for and those who
don't is action. Therefore, every action you take is a complete
success,regardless of the results." -- Jerrold Mundis
Highmark internal only: For usability and accessibility:
http://highwire.highmark.com/sites/iwov/hwt093/

__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: