Re: Perl to Python conversion

2009-12-28 Thread Simon Brunning
2009/12/25 Aahz a...@pythoncraft.com: I'd write an imperial to metric converter in Python  ;-) Should be possible to use unum (http://bit.ly/4X0PwR) to do the conversions. The SI units are already defined - adding in any necessary imperial units should be easy enough. -- Cheers, Simon B. --

Re: Perl to Python conversion

2009-12-25 Thread Aahz
In article 87zl5rnayz@crunchbang.belkin, Martin =?utf-8?B?U2Now7bDtm4=?= martin.sch...@gmail.com wrote: Problem: I have come across a small open source application that I find quite useful. It does have one major flaw though. Its output is in imperial units. Converting isn't a big deal for

Re: Perl to Python conversion

2009-12-25 Thread John Yeung
On Dec 13, 5:23 pm, martin.sch...@gmail.com (Martin Schöön) wrote: r0g aioe@technicalbloke.com writes: You'll probably find the majority of code in a GUI app is boring window handling stuff [...] Also, they probably didn't make it with QT which is fairly different from GTK. Tk is

Re: Perl to Python conversion

2009-12-13 Thread r0g
Martin Schöön wrote: Thanks all, great response! A little more background: I am not a programmer but I have done some programming in the past. This was all humble number crunching as part of my PhD project using FORTRAN. I also did some Rocky Mountain Basic coding for programs

Re: Perl to Python conversion

2009-12-13 Thread Martin Schöön
r0g aioe@technicalbloke.com writes: I'd recommend you start from scratch and refer to the perl version if and when you need to. That is my plan. You'll probably find the majority of code in a GUI app is boring window handling stuff rather, often this is machine generated (by progs like

Re: Perl to Python conversion

2009-12-12 Thread Colin W.
On 09-Dec-09 15:33 PM, Martin Schöön wrote: First off: I am new here and this is my first post after lurking for quite some time. Second off: I don't know much Python---yet. Problem: I have come across a small open source application that I find quite useful. It does have one major flaw

Re: Perl to Python conversion

2009-12-10 Thread J Kenneth King
martin.sch...@gmail.com (Martin Schöön) writes: First off: I am new here and this is my first post after lurking for quite some time. Hi. Second off: I don't know much Python---yet. It's not a very big language. If you have experience programming in other languages, you can probably pick it

Re: Perl to Python conversion

2009-12-10 Thread Martin Schöön
Thanks all, great response! A little more background: I am not a programmer but I have done some programming in the past. This was all humble number crunching as part of my PhD project using FORTRAN. I also did some Rocky Mountain Basic coding for programs manipulating measurement instruments.

Perl to Python conversion

2009-12-09 Thread Martin Schöön
First off: I am new here and this is my first post after lurking for quite some time. Second off: I don't know much Python---yet. Problem: I have come across a small open source application that I find quite useful. It does have one major flaw though. Its output is in imperial units. Converting

Re: Perl to Python conversion

2009-12-09 Thread zeph
Python and Perl often have different design idioms - learning to write *well* in a language involves understanding those idioms, and being able to translate between languages involves understanding the source language well enough to understand the intent of the program's code (even if its poorly

Re: Perl to Python conversion

2009-12-09 Thread Intchanter / Daniel Fackrell
On Dec 9, 1:33 pm, martin.sch...@gmail.com (Martin Schöön) wrote: First off: I am new here and this is my first post after lurking for quite some time. Second off: I don't know much Python---yet. Problem: I have come across a small open source application that I find quite useful. It does

Re: Perl to Python conversion

2009-12-09 Thread Peter Chant
Martin Schöön wrote: Hence, are there any Perl to Python converters? So far I have only found bridgekeeper which really is (was?) consultancy. Apart from that I only find people recommending a manual re-write. Any thoughts/recommendations? Voice of almost no experience. I once ran a

REQ: Small Perl to Python conversion needed

2005-06-02 Thread Koncept
Howdie Python folks! I am very new to Python ( 3rd day now ) and it has already earned its place as my fav. language to work in. I hope to continue, and I really would appreciate some good resources if anybody would care to contribute. My current head-scratcher concerns something I can do in

Re: REQ: Small Perl to Python conversion needed

2005-06-02 Thread Steven Bethard
Koncept wrote: #!/usr/bin/perl # Parse comma delimited lines and create a final frequency hash # Real example would read a file line by line my %dict = {}; my @lines = ( 1,2,3,4,5, 2,3,4,5, 3,4,5, 4,5, 5 ); foreach(@lines) { map( $dict{ $_ }++, split( , ) ); } foreach( sort byKeys keys

Re: REQ: Small Perl to Python conversion needed

2005-06-02 Thread John Machin
Koncept wrote: Howdie Python folks! I am very new to Python ( 3rd day now ) and it has already earned its place as my fav. language to work in. I hope to continue, and I really would appreciate some good resources if anybody would care to contribute. My current head-scratcher concerns

Re: REQ: Small Perl to Python conversion needed

2005-06-02 Thread Ivan Van Laningham
Hi All-- John Machin wrote: how to duplicate the following bit of code using Python dictionaries. [expletives deleted] +1 QOTW Metta, Ivan -- Ivan Van Laningham God N Locomotive Works http://www.andi-holmes.com/

Re: REQ: Small Perl to Python conversion needed

2005-06-02 Thread Steven Bethard
John Machin wrote: freq_dict = {} ... if thing in freq_dict: freq_dict[thing] += 1 else: freq_dict[thing] = 1 or, less plainly, freq_dict[thing] = freq_dict.get(thing, 0) + 1 or try: freq_dict[thing] += 1 except KeyError: freq_dict[thing] = 1 STeVe --

Re: REQ: Small Perl to Python conversion needed

2005-06-02 Thread Koncept
In article [EMAIL PROTECTED], Steven Bethard [EMAIL PROTECTED] wrote: I don't speak Perl, but based on your output, I'd probably do something like: py lines = [1,2,3,4,5, 2,3,4,5, 3,4,5, 4,5, 5] py counts = {} py for items in lines: ...for item in items.split(','): ...