[OT]: The Python Fan

2008-01-25 Thread Paddy
http://www.brightcove.tv/title.jsp?title=1390821847 :-) - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

Re: Doesn't know what it wants

2008-01-25 Thread John Machin
On Jan 26, 6:25 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 25 Jan 2008 22:53:16 -0800, John Machin wrote: > > On Jan 26, 5:32 pm, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] > > nomine.org> wrote: > >> -On [20080126 06:26], Tim Rau ([EMAIL PROTECTED]) wrote: >

Pickling dynamically generated classes

2008-01-25 Thread George Sakkis
The Fine Manual mentions that pickle works for classes that are defined at the top level of a module. Is there a way to extend this behavior so that I can pickle and unpickle instances of dynamically generated classes ? Longer version: I have a function RecordTypeFactory(fields, ...) that dynamica

Re: Index of maximum element in list

2008-01-25 Thread Paul Rubin
"Terry Reedy" <[EMAIL PROTECTED]> writes: > | > What's about l.index(max(l)) ? > > Both of these methods scan the list twice. The two given by RH and SDD do > so just once. Both of those will give the index of the of the last maximum > value. If you want the index of the first max value (you

Re: Testing whether something is of type Exception

2008-01-25 Thread Terry Reedy
"John Nagle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |How can I tell whether an object is of type Exception? | At least in Python 2.4, "Exception" is an old-style class, and | the "type" of Exception objects is "instance". | |Clearly "repr" knows; it returns: | Actua

Re: getting values from cache

2008-01-25 Thread nodrogbrown
also if i were to write unit test for this method ,how shd i do it? shd i be checking all values in the matrix created inside and so on? gordon -- http://mail.python.org/mailman/listinfo/python-list

Re: python and multithreading problem

2008-01-25 Thread Diez B. Roggisch
whatazor schrieb: > Hi all, > I made an application that use multithreading (indifferently importing > thread or threading module) , but when I call some wrapped modules > (with swig) from my application they run like there is only a single > thread (and my application gui ,made with wxPython, fre

Re: Index of maximum element in list

2008-01-25 Thread Terry Reedy
"Henry Baxter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Thanks Hexamorph and Neal. Somehow I didn't make the connection with using | 'index', but I'm all sorted out now :) | | On Jan 25, 2008 1:47 PM, Hexamorph <[EMAIL PROTECTED]> wrote: | | > Henry Baxter wrote: | > > Oops,

Re: Doesn't know what it wants

2008-01-25 Thread Steven D'Aprano
On Fri, 25 Jan 2008 22:53:16 -0800, John Machin wrote: > On Jan 26, 5:32 pm, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] > nomine.org> wrote: >> -On [20080126 06:26], Tim Rau ([EMAIL PROTECTED]) wrote: >> >> >Line 147 reads: >> >moi = cp.cpMomentForCircle(self.mass, .2, 0, vec2d((0,0)

Re: Generational Interfaces

2008-01-25 Thread Carl Banks
On Jan 26, 12:32 am, Paul Rubin wrote: > Carl Banks <[EMAIL PROTECTED]> writes: > > AirplaneInterface = InterfaceTracker("Airplane") > > ... > > set_up_initial_state() > > ... > > AirplaneInterface.report(self) > > Thoughts? (Surely someone's thou

getting values from cache

2008-01-25 Thread nodrogbrown
hi i am writing code to check a folder containing images and then process thir vals using PIL and do some calc to create a matrix of values .if the folder has any new imgs added the program will do all calc again and dump the values into a cachefile.If the folder contents remain unaltered the progr

wx.EVT_RIGHT_UP strangeness?

2008-01-25 Thread JimT
I'm playing with wxPython 2.8.7.1 on OS X 10.4.11 with MacPython 2.5 I ran the demo program found what may be a bug with the right mouse button up event. The demo is ShapedWindow.py. Everthing thing seems to work fine except that right clicking does not close the window. Tracing the program sho

Mobile Phones, iPods EQ100 www.enmac.com.hk

2008-01-25 Thread Farooq
www.enmac.com.hk GSM Mobile Phones, Digital iPods, Digital Clocks, Digital Pens, Digital Quran. Enjoy these products with Islamic Features (Complete Holy Quran with Text and Audio, Tafaseer books, Ahadees Books, Daily Supplications, Universal Qibla Direction, Prayer Timing and much more) visit our

Re: Doesn't know what it wants

2008-01-25 Thread John Machin
On Jan 26, 5:32 pm, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] nomine.org> wrote: > -On [20080126 06:26], Tim Rau ([EMAIL PROTECTED]) wrote: > > >Line 147 reads: > >moi = cp.cpMomentForCircle(self.mass, .2, 0, vec2d((0,0))) > > I think it expects something like: > > # badly named vari

Re: Doesn't know what it wants

2008-01-25 Thread Tim Rau
On Jan 26, 1:41 am, John Machin <[EMAIL PROTECTED]> wrote: > On Jan 26, 4:20 pm, Tim Rau <[EMAIL PROTECTED]> wrote: > > > > > Traceback (most recent call last): > > File "C:\Documents and Settings\Owner\My Documents\NIm's code\sandbox > > \sandbox.py", line 242, in > > player = ship() > >

Re: Doesn't know what it wants

2008-01-25 Thread Tim Rau
On Jan 26, 1:32 am, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] nomine.org> wrote: > -On [20080126 06:26], Tim Rau ([EMAIL PROTECTED]) wrote: > > >Line 147 reads: > >moi = cp.cpMomentForCircle(self.mass, .2, 0, vec2d((0,0))) > > I think it expects something like: > > # badly named vari

Re: Doesn't know what it wants

2008-01-25 Thread John Machin
On Jan 26, 4:20 pm, Tim Rau <[EMAIL PROTECTED]> wrote: > Traceback (most recent call last): > File "C:\Documents and Settings\Owner\My Documents\NIm's code\sandbox > \sandbox.py", line 242, in > player = ship() > File "C:\Documents and Settings\Owner\My Documents\NIm's code\sandbox > \sand

Re: Doesn't know what it wants

2008-01-25 Thread Jeroen Ruigrok van der Werven
-On [20080126 06:26], Tim Rau ([EMAIL PROTECTED]) wrote: >Line 147 reads: >moi = cp.cpMomentForCircle(self.mass, .2, 0, vec2d((0,0))) I think it expects something like: # badly named variable, pick something better depending on context temp = vec2d(0, 0) cp.cpMomentForCircle(self.mass, .2

Re: eucledian dist calculations

2008-01-25 Thread nodrogbrown
sorry..the last post didn't appear! > Are you sure? What happens if the vector with the smallest > sum(distance) is the first one? > initially i will set imgindex =0 so if the first one is of smallest sum..,the image will be reteived by imgindex 0 > (a) Can't you replace the inner loop with

Re: Index of maximum element in list

2008-01-25 Thread Scott David Daniels
Hexamorph wrote: > ... > What's about l.index(max(l)) ? What about max((x,i) for i,x in enumerate(lst))[1] -- http://mail.python.org/mailman/listinfo/python-list

finding child cpu usage of a running child

2008-01-25 Thread Karthik Gurusamy
Hi, Wondering if there is a way to measure a child process's cpu usage (sys and user) when the child is still running. I see os.times() working fine in my system (Linux 2.6.9-42.7.ELsmp), but it gives valid data only after the child has exited. When the child is alive, os.times() data for child is

Re: Puzzled by behaviour of class with empty constructor

2008-01-25 Thread Tim Rau
On Jan 25, 5:54 pm, [EMAIL PROTECTED] wrote: > On Jan 25, 5:46 pm, Bjoern Schliessmann > > > [EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: > > > print x.ends,y.ends,z.ends > > > # > > > Running the following code outputs: > > [(0, 2)] [(0, 2)] [(0, 2)] > > > > Can anyone

Re: Generational Interfaces

2008-01-25 Thread Paul Rubin
Carl Banks <[EMAIL PROTECTED]> writes: > AirplaneInterface = InterfaceTracker("Airplane") > ... > set_up_initial_state() > ... > AirplaneInterface.report(self) > Thoughts? (Surely someone's thought to do this before.) A decorator might express the idea a little more natur

Re: looking for a light weighted library/tool to write simple GUI above the text based application

2008-01-25 Thread Tim Rau
On Jan 25, 10:25 pm, [EMAIL PROTECTED] wrote: > > I agree that SDL is probably the best choice but for the sake of > > completeness, Gtk can (at least in theory - I've never tried it) be > > built against directfb and run without X. > > from the Pygame Introduction: Pygame is a Python extension lib

Doesn't know what it wants

2008-01-25 Thread Tim Rau
Traceback (most recent call last): File "C:\Documents and Settings\Owner\My Documents\NIm's code\sandbox \sandbox.py", line 242, in player = ship() File "C:\Documents and Settings\Owner\My Documents\NIm's code\sandbox \sandbox.py", line 121, in __init__ self.phyInit() File "C:\Docume

Re: How can I use the up and down, left and right arrow keys to control a Python Pgm

2008-01-25 Thread Tim Rau
On Jan 25, 10:48 pm, "jitrowia" <[EMAIL PROTECTED]> wrote: > I was wondering what kind of python code I would need to enable me to > use the up and down, left and right arrow keys to control software > programming decisions within a Python Program. > > Any direction and advice would be greatly appr

Generational Interfaces

2008-01-25 Thread Carl Banks
While thinking about generational garbage collection, the thought of generational interfaces occurred to me. I'd thought I'd run it by you guys. I'm curious if there are any examples of this out there. I've opined on this chat room before that interfaces are more often cumbersome than helpful, e

Re: translating Python to Assembler

2008-01-25 Thread Grant Edwards
On 2008-01-26, ajaksu <[EMAIL PROTECTED]> wrote: > On Jan 25, 11:10 pm, [EMAIL PROTECTED] wrote: >> Once a python py file is compiled into a pyc file, I can disassemble >> it into assembler. Assembler is nothing but codes, which are >> combinations of 1's and 0's. You can't read a pyc file in a hex

Re: translating Python to Assembler

2008-01-25 Thread Grant Edwards
On 2008-01-26, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Once a python py file is compiled into a pyc file, I can disassemble > it into assembler. No you can't. It's not native machine code. It's byte code for a virtual machine. > Assembler is nothing but codes, which are combinations of

Re: regular expression negate a word (not character)

2008-01-25 Thread Mark Tolonen
"Summercool" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > somebody who is a regular expression guru... how do you negate a word > and grep for all words that is > > tire > > but not > > snow tire > > or > > snowtire > > so for example, it will grep for > > winter tire > ti

Re: Index of maximum element in list

2008-01-25 Thread Raymond Hettinger
On Jan 25, 1:47 pm, Hexamorph <[EMAIL PROTECTED]> wrote: > Henry Baxter wrote: > > Oops, gmail has keyboard shortcuts apparently, to continue: > > > def maxi(l): > >     m = max(l) > >     for i, v in enumerate(l): > >         if m == v: > >             return i > > What's about l.index(max(l)) ?

How can I use the up and down, left and right arrow keys to control a Python Pgm

2008-01-25 Thread jitrowia
I was wondering what kind of python code I would need to enable me to use the up and down, left and right arrow keys to control software programming decisions within a Python Program. Any direction and advice would be greatly appreciated, Thank You, Rodney -- http://mail.python.org/mailman/li

Re: "just like Java" (was :Re: translating Python to Assembler)

2008-01-25 Thread Christian Heimes
Paul Boddie wrote: > Well, it is important to make distinctions when people are wondering, > "If Python is 'so slow' and yet everyone tells me that the way it is > executed is 'just like Java', where does the difference in performance > come from?" Your responses seemed to focus more on waving that

Re: regular expression negate a word (not character)

2008-01-25 Thread Ben Morrow
[newsgroups line fixed, f'ups set to clpm] Quoth Summercool <[EMAIL PROTECTED]>: > On Jan 25, 5:16 pm, Summercool <[EMAIL PROTECTED]> wrote: > > somebody who is a regular expression guru... how do you negate a word > > and grep for all words that is > > > > tire > > > > but not > > > > snow ti

Re: translating Python to Assembler

2008-01-25 Thread Chris Mellon
On Jan 25, 2008 9:09 PM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 23 Jan 2008 08:49:20 +0100, Christian Heimes wrote: > > > It's even > > possible to write code with Python assembly and compile the Python > > assembly into byte code. > > Really? How do you do that? > > I thought it migh

Re: looking for a light weighted library/tool to write simple GUI above the text based application

2008-01-25 Thread petr . jakes . tpc
> I agree that SDL is probably the best choice but for the sake of > completeness, Gtk can (at least in theory - I've never tried it) be > built against directfb and run without X. from the Pygame Introduction: Pygame is a Python extension library that wraps the SDL library and it's helpers. So y

Re: translating Python to Assembler

2008-01-25 Thread Steven D'Aprano
On Wed, 23 Jan 2008 08:49:20 +0100, Christian Heimes wrote: > It's even > possible to write code with Python assembly and compile the Python > assembly into byte code. Really? How do you do that? I thought it might be compile(), but apparently not. -- Steven -- http://mail.python.org/mailma

Re: ElementTree.fromstring(unicode_html)

2008-01-25 Thread John Machin
On Jan 26, 1:11 pm, globophobe <[EMAIL PROTECTED]> wrote: > This is likely an easy problem; however, I couldn't think of > appropriate keywords for google: > > Basically, I have some raw data that needs to be preprocessed before > it is saved to the database e.g. > > In [1]: unicode_html = u'\u3055

Re: looking for a light weighted library/tool to write simple GUI above the text based application

2008-01-25 Thread Chris Mellon
On Jan 25, 2008 5:17 PM, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 25 Jan, 22:06, "Lorenzo E. Danielsson" > <[EMAIL PROTECTED]> wrote: > > > > What you need then is something like SVGAlib (http;//svgalib.org). Only > > really old people like myself know that it exists. I've never heard of > > any

pyfov Package Index link broken

2008-01-25 Thread Martin Manns
Hi, I am looking for the code of pyfov, which is on the Package Index. However, the link is broken and the author does not seem to respond to e-mails. Any chance to get hands on the code? Martin -- http://mail.python.org/mailman/listinfo/python-list

ElementTree.fromstring(unicode_html)

2008-01-25 Thread globophobe
This is likely an easy problem; however, I couldn't think of appropriate keywords for google: Basically, I have some raw data that needs to be preprocessed before it is saved to the database e.g. In [1]: unicode_html = u'\u3055\u3080\u3044\uff0f\r\n\u3064\u3081\u305f \u3044\r\n' I need to turn t

Re: translating Python to Assembler

2008-01-25 Thread ajaksu
On Jan 25, 11:36 pm, ajaksu <[EMAIL PROTECTED]> wrote: > On Jan 25, 11:10 pm, [EMAIL PROTECTED] wrote: [...] Gaah, is this what's going on? [EMAIL PROTECTED]:~$ cat error.txt This is not assembler... [EMAIL PROTECTED]:~$ ndisasm error.txt 54push sp 0001 686973

Re: translating Python to Assembler

2008-01-25 Thread ajaksu
On Jan 25, 11:10 pm, [EMAIL PROTECTED] wrote: > Once a python py file is compiled into a pyc file, I can disassemble > it into assembler. Assembler is nothing but codes, which are > combinations of 1's and 0's. You can't read a pyc file in a hex > editor, but you can read it in a disassembler. It d

Re: translating Python to Assembler

2008-01-25 Thread over
On Thu, 24 Jan 2008 08:02:06 GMT, Tim Roberts <[EMAIL PROTECTED]> wrote: >Bjoern Schliessmann <[EMAIL PROTECTED]> wrote: > >>Grant Edwards wrote: >> >>> Trying to find assembly language stuff to look at is futile. >>> Python doesn't get compiled into assembly language. >> >>So, how do processors e

Re: read and readline hanging

2008-01-25 Thread Thomas Bellman
Olivier Lefevre <[EMAIL PROTECTED]> wrote: >> 1. The subprocess has stopped producing output. > Indeed, if I do this interactively, I can tell after 3 lines that I've > gotten all there is to get right now and the fourth readline() call > hangs. Can you really? How do you know if the program ha

Re: basic output question

2008-01-25 Thread Wildemar Wildenburger
John Deas wrote: > Hi, I am very new to Python (1 evening...) > I need to process a series of files (toto-1.txt toto-2.txt toto-3.txt > toto-4.txt), and as such I created a small program to go through the > files in a directory. I want to call the script with arguments, like > > python script.py t

Re: Problem with Tkinter scrollbar callback

2008-01-25 Thread Russell E. Owen
In article <[EMAIL PROTECTED]>, "Ivan Van Laningham" <[EMAIL PROTECTED]> wrote: > Hi All-- > That helps. Doing a get() on the scrollbar before a set(0.0,0.0) > returns a 4-tuple: (0.0, 0.0, 0.0, 0.0) ! I did the set(0.0,0.0) > and now the callback gets the correct number of arguments. > > Ho

Re: Module/package hierarchy and its separation from file structure

2008-01-25 Thread Carl Banks
On Jan 25, 6:45 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > "Gabriel Genellina" <[EMAIL PROTECTED]> writes: > > You can also put, in animal/__init__.py: > > from monkey import Monkey > > and now you can refer to it as org.lib.animal.Monkey, but keep the > > implementation of Monkey class and all re

Re: Email module, how to add header to the top of an email?

2008-01-25 Thread David Erickson
On Jan 25, 5:04 am, "Karlheinz Klingbeil" <[EMAIL PROTECTED]> wrote: > Am 25.01.2008, 06:21 Uhr, schrieb David Erickson <[EMAIL PROTECTED]>: > > > Bottom of the headers... but I am looking to insert at the top, and re- > > ordering/inserting does matter depending on what type of header you > > are,

Re: basic output question

2008-01-25 Thread Alan Isaac
John Deas wrote: > My problem is that f.read() outputs nothing Since ``open`` did not give you an IOError, you did get a handle to the files, so this suggests that the files you read are empty... Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

python and multithreading problem

2008-01-25 Thread whatazor
Hi all, I made an application that use multithreading (indifferently importing thread or threading module) , but when I call some wrapped modules (with swig) from my application they run like there is only a single thread (and my application gui ,made with wxPython, freezes). If I use other module

Exceptions on delete in pysqlite

2008-01-25 Thread Wildemar Wildenburger
Hi there, Using pysqlite, I'd like to check if some dataset that I removed has been in the database at all. Ideally I'd like pysqlite to raise an Exception if deleting does nothing. Is that possible? Codewise, I'd like the following, but without me checking for and raising the exception myself

Re: a newbie regex question

2008-01-25 Thread Max Erickson
"Dotan Cohen" <[EMAIL PROTECTED]> wrote: > Maybe you mean: > for match in re.finditer(r'\([A-Z].+[a-z])\', contents): > Note the last backslash was in the wrong place. The location of the backslash in the orignal reply is correct, it is there to escape the closing paren, which is a special charac

Re: Module/package hierarchy and its separation from file structure

2008-01-25 Thread Ben Finney
"Gabriel Genellina" <[EMAIL PROTECTED]> writes: > You can also put, in animal/__init__.py: > from monkey import Monkey > and now you can refer to it as org.lib.animal.Monkey, but keep the > implementation of Monkey class and all related stuff into > .../animal/monkey.py This (as far as I can unde

Re: find minimum associated values

2008-01-25 Thread Alan Isaac
[EMAIL PROTECTED] wrote: > I'd use the first solution. It can be speeded up a bit with a try/except: for k,v in kv: try: if d[k] > v: d[k] = v except KeyError: d[k] = v Cheers, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: looking for a light weighted library/tool to write simple GUI above the text based application

2008-01-25 Thread Paul Boddie
On 25 Jan, 22:06, "Lorenzo E. Danielsson" <[EMAIL PROTECTED]> wrote: > > What you need then is something like SVGAlib (http;//svgalib.org). Only > really old people like myself know that it exists. I've never heard of > any Python bindings for it, but that might be where you come in. I > haven't lo

Re: Index of maximum element in list

2008-01-25 Thread Henry Baxter
Thanks Hexamorph and Neal. Somehow I didn't make the connection with using 'index', but I'm all sorted out now :) On Jan 25, 2008 1:47 PM, Hexamorph <[EMAIL PROTECTED]> wrote: > Henry Baxter wrote: > > Oops, gmail has keyboard shortcuts apparently, to continue: > > > > def maxi(l): > > m = ma

Re: paging in python shell

2008-01-25 Thread gagsl-py2
--- Alex K <[EMAIL PROTECTED]> escribió: > Thank you for this interesting tip. However I'm not > sure to know how > to use it. It seems pydoc.pager('text') just pages > the text passed in. > How do I actually make the python shell use a > different pager? I'm unsure of what you want. Do you want

How to modify the content of an email

2008-01-25 Thread alejandro . valdez
Hello, I'm trying to make a python script that take an email in (raw) text format, and add a footer to the text (or html) body of the email. I'm aware of the email and email.mime modules, but I can't figure out how to identify 'the main text (or html) content' from the email, and how to be sure th

Re: looking for a light weighted library/tool to write simple GUI above the text based application

2008-01-25 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > Hi, > I am working with the Python 2.5 running on the command line version > of Linux Ubuntu 7.04. This means NO X-windows, NO GTK/Gnome, NO > computer mouse, on my machine (AMD Geode 500MHz CPU, VGA output). > > I would like to write some really light weighted GU inte

Re: Puzzled by behaviour of class with empty constructor

2008-01-25 Thread dbaston
On Jan 25, 5:46 pm, Bjoern Schliessmann wrote: > [EMAIL PROTECTED] wrote: > > print x.ends,y.ends,z.ends > > # > > Running the following code outputs: > [(0, 2)] [(0, 2)] [(0, 2)] > > > Can anyone explain this? > > Yes. You bound a single list to the name "ends" inside the class.

Re: Puzzled by behaviour of class with empty constructor

2008-01-25 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > Hello, > > I have a class called 'Axis' that I use as a base class for several > types of axes that can be created by a grid generation program that I > have written: equally-spaced grids, logarithmic grids, etc. In any > case, if I use this base class by itself, I se

Re: Puzzled by behaviour of class with empty constructor

2008-01-25 Thread Tomek Paczkowski
[EMAIL PROTECTED] wrote: > Hello, > > I have a class called 'Axis' that I use as a base class for several > types of axes that can be created by a grid generation program that I > have written: equally-spaced grids, logarithmic grids, etc. In any > case, if I use this base class by itself, I see

Re: Puzzled by behaviour of class with empty constructor

2008-01-25 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > print x.ends,y.ends,z.ends > # > Running the following code outputs: [(0, 2)] [(0, 2)] [(0, 2)] > > Can anyone explain this? Yes. You bound a single list to the name "ends" inside the class. This name is shared by all instances. If you want the instanc

basic output question

2008-01-25 Thread John Deas
Hi, I am very new to Python (1 evening...) I need to process a series of files (toto-1.txt toto-2.txt toto-3.txt toto-4.txt), and as such I created a small program to go through the files in a directory. I want to call the script with arguments, like python script.py toto- 1 1 4 my script is as f

Puzzled by behaviour of class with empty constructor

2008-01-25 Thread dbaston
Hello, I have a class called 'Axis' that I use as a base class for several types of axes that can be created by a grid generation program that I have written: equally-spaced grids, logarithmic grids, etc. In any case, if I use this base class by itself, I see some puzzling behaviour:

Re: find minimum associated values

2008-01-25 Thread Alan Isaac
Alan Isaac wrote: > #sort by id and then value > kv_sorted = sorted(kv, key=lambda x: (id(x[0]),x[1])) > #groupby: first element in each group is object and its min value > d =dict( g.next() for k,g in groupby( kv_sorted, key=lambda x: x[0] ) ) > > Yes, that appears to be fastest and is > pretty

Re: find minimum associated values

2008-01-25 Thread Alan Isaac
Paul Rubin wrote: > How about something like: > > kv_sorted = sorted(kv, key=lambda x: (id(x[0]), x[1])) You mean like this? #sort by id and then value kv_sorted = sorted(kv, key=lambda x: (id(x[0]),x[1])) #groupby: first element in each group is object and its min value d =dict( g.next() fo

CFP: DATICS 2008 - Design, Analysis and Tools for Integrated Circuits and Systems

2008-01-25 Thread DATICS2008
Apologies for any multiple copies received. We would appreciate it if you could distribute the following call for papers to any relevant mailing lists you know of. CALL FOR PAPERS === Special Session:

Re: looking for a light weighted library/tool to write simple GUI above the text based application

2008-01-25 Thread Hexamorph
Lorenzo E. Danielsson wrote: > [EMAIL PROTECTED] wrote: >> I think I was not specific/clear enough in my first posting. I know >> the curses library ( http://pyncurses.sourceforge.net ). It AFIK >> provides TUI (short for: Text User Interface or Textual User >> Interface). My needs are GUI, I mean

Re: Module/package hierarchy and its separation from file structure

2008-01-25 Thread Gabriel Genellina
En Thu, 24 Jan 2008 11:57:49 -0200, Peter Schuller <[EMAIL PROTECTED]> escribió: > In this case my > problem is more related to the "file == module" and "directory == > module" semantics, since I want to break contents in a single module > out into several files. You already can do that, just i

Re: Index of maximum element in list

2008-01-25 Thread Neal Becker
Henry Baxter wrote: > Oops, gmail has keyboard shortcuts apparently, to continue: > > def maxi(l): > m = max(l) > for i, v in enumerate(l): > if m == v: > return i > > But it seems like something that should be built in - or at least I should > be able to write a lamb

Re: Index of maximum element in list

2008-01-25 Thread Hexamorph
Henry Baxter wrote: > Oops, gmail has keyboard shortcuts apparently, to continue: > > def maxi(l): > m = max(l) > for i, v in enumerate(l): > if m == v: > return i > What's about l.index(max(l)) ? -- http://mail.python.org/mailman/listinfo/python-list

Re: find minimum associated values

2008-01-25 Thread John Machin
On Jan 26, 7:58 am, [EMAIL PROTECTED] wrote: > I find the first and third solutions simpler to read, and the first > solution requires less memory, it probably works quite well with > Psyco, and it's easy to translate to other languages (that is > important for programs you want to use for a lot of

Re: Index of maximum element in list

2008-01-25 Thread Henry Baxter
Oops, gmail has keyboard shortcuts apparently, to continue: def maxi(l): m = max(l) for i, v in enumerate(l): if m == v: return i But it seems like something that should be built in - or at least I should be able to write a lambda function for it, but I'm not sure how

Index of maximum element in list

2008-01-25 Thread Henry Baxter
I apologize if this has already been discussed - funnily enough my googling did bring up a previous thread about it on this mailing list, but despite the promising subject line, seemed to mainly be concerned with whether python-list should its own FAQ...so I assume this has been asked many times be

Re: looking for a light weighted library/tool to write simple GUI above the text based application

2008-01-25 Thread Lorenzo E. Danielsson
[EMAIL PROTECTED] wrote: >>> is already solved). >> what you are looking for is curse :) >> http://docs.python.org/lib/module-curses.html >> http://www.ibm.com/developerworks/linux/library/l-python6.html >> >> renaud > > Renaud, thanks for your reply. > > I think I was not specific/clear enough i

Re: Python ADO Date Time database fields

2008-01-25 Thread John Machin
On Jan 26, 12:48 am, goldtech <[EMAIL PROTECTED]> wrote: > snip > > > > > try this: > > > val = oRS.Fields(dt).Value > > print type(val) > > this gives: > > > print float(val) > > yes, it gives 0.0 > > But there should be a way to print what is *actually in the field*. What is "actually in the f

Re: find minimum associated values

2008-01-25 Thread bearophileHUGS
I find the first and third solutions simpler to read, and the first solution requires less memory, it probably works quite well with Psyco, and it's easy to translate to other languages (that is important for programs you want to use for a lot of time or in different situations), so I'd use the fir

Re: Operator overloading

2008-01-25 Thread Hexamorph
[EMAIL PROTECTED] wrote: > > Hexamorph wrote: >> You mean you want the ability to change for example the + operator >> for ints to something like calculating the cosine instead of doing >> addition? > > Sure. Cosines are a monadic operation and the monadic '+' is a NOP, so > why shouldn't I defin

Re: looking for a light weighted library/tool to write simple GUI above the text based application

2008-01-25 Thread petr . jakes . tpc
> > is already solved). > > what you are looking for is curse :) > http://docs.python.org/lib/module-curses.html > http://www.ibm.com/developerworks/linux/library/l-python6.html > > renaud Renaud, thanks for your reply. I think I was not specific/clear enough in my first posting. I know the curse

Re: read and readline hanging

2008-01-25 Thread Marc 'BlackJack' Rintsch
On Fri, 25 Jan 2008 17:31:16 +0100, Olivier Lefevre wrote: > Thanks for the answer. Yes this is tricky. I have done it in Java > before, where you can, e.g., set up a thread to pump stuff out of > both stderr and stdout continuously but my python is too rudimentary > for that. The `trheading` mod

Re: Operator overloading

2008-01-25 Thread MartinRinehart
Hexamorph wrote: > You mean you want the ability to change for example the + operator > for ints to something like calculating the cosine instead of doing > addition? Sure. Cosines are a monadic operation and the monadic '+' is a NOP, so why shouldn't I define +45 to return cosine of 45, (presum

Re: is possible to get order of keyword parameters ?

2008-01-25 Thread rndblnch
On Jan 25, 9:01 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > rndblnch <[EMAIL PROTECTED]> wrote: > > the following example should also > > work: > > size = Point(width=23, height=45) > > w, h = size > > So you want the unpacking to depend on how the Point was initialised! > Aaargh! why not? in d

Re: is possible to get order of keyword parameters ?

2008-01-25 Thread Steven Bethard
Steven Bethard wrote: > rndblnch wrote: >> my goal is to implement a kind of named tuple. >> idealy, it should behave like this: >> p = Point(x=12, y=13) >> print p.x, p.y >> but what requires to keep track of the order is the unpacking: >> x, y = p >> i can't figure out how to produce an iterable

Re: is possible to get order of keyword parameters ?

2008-01-25 Thread Steven Bethard
rndblnch wrote: > my goal is to implement a kind of named tuple. > idealy, it should behave like this: > p = Point(x=12, y=13) > print p.x, p.y > but what requires to keep track of the order is the unpacking: > x, y = p > i can't figure out how to produce an iterable that returns the values > in th

Re: is possible to get order of keyword parameters ?

2008-01-25 Thread Duncan Booth
rndblnch <[EMAIL PROTECTED]> wrote: > the following example should also > work: > size = Point(width=23, height=45) > w, h = size > So you want the unpacking to depend on how the Point was initialised! Aaargh! -- http://mail.python.org/mailman/listinfo/python-list

Re: Increment Variable Name

2008-01-25 Thread Gabriel Genellina
En Wed, 23 Jan 2008 23:09:36 -0200, David Brochu <[EMAIL PROTECTED]> escribió: > Basically what I am trying to do is pass each value from a list to > the following line of code (where XXX is where I need to pass each > value of the list > > tests = easygui.multchoicebox(message="Pick the test(s)

Re: find minimum associated values

2008-01-25 Thread Paul Rubin
Alan Isaac <[EMAIL PROTECTED]> writes: > print "method 2: groupby" > t=time.clock() > d = dict() > kv_sorted = sorted(kv, key=lambda x: id(x[0])) How about something like: kv_sorted = sorted(kv, key=lambda x: (id(x[0]), x[1])) Now do your groupby and the first element of each group is the mini

Re: Python and binary compatibility

2008-01-25 Thread Joshua Kugler
Christian Heimes wrote: > You can use MinGW32 to compile the extension, too. Or use the free > toolchain as described at > http://wiki.python.org/moin/Building_Python_with_the_free_MS_C_Toolkit That page has a link to the Microsoft Visual C++ Toolkit 2003 page, which then says it's been discontinu

Re: looking for a light weighted library/tool to write simple GUI above the text based application

2008-01-25 Thread rndblnch
On Jan 25, 8:43 pm, [EMAIL PROTECTED] wrote: > This means NO X-windows, NO GTK/Gnome, NO > computer mouse, on my machine (AMD Geode 500MHz CPU, VGA output). > > I would like to write some really light weighted GU interface. My > concept is to have just few user screens (about 10) controlled via 4 >

Re: Sorting Large File (Code/Performance)

2008-01-25 Thread Paul Rubin
Nicko <[EMAIL PROTECTED]> writes: > # The next line is order O(n) in the number of chunks > (line, fileindex) = min(mergechunks) You should use the heapq module to make this operation O(log n) instead. -- http://mail.python.org/mailman/listinfo/python-list

Re: is possible to get order of keyword parameters ?

2008-01-25 Thread rndblnch
On Jan 25, 5:27 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > Keyword arguments are normally treaded as "order independent". > Why do you think you need to find the order? What problem do > you wish to solve? > > -Larry On Jan 25, 7:39 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > The question re

looking for a light weighted library/tool to write simple GUI above the text based application

2008-01-25 Thread petr . jakes . tpc
Hi, I am working with the Python 2.5 running on the command line version of Linux Ubuntu 7.04. This means NO X-windows, NO GTK/Gnome, NO computer mouse, on my machine (AMD Geode 500MHz CPU, VGA output). I would like to write some really light weighted GU interface. My concept is to have just few u

Re: Operator overloading

2008-01-25 Thread Hexamorph
[EMAIL PROTECTED] wrote: > > Diez B. Roggisch wrote: >> No, there is no way. You would change general interpreter behavior if >> you could set arbitrary operators for predefined types. >> >> Start grumping... > > Thank you, Diez. > > If I ever design a language, please remind me that complete, e

Re: Operator overloading

2008-01-25 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > > Diez B. Roggisch wrote: >> No, there is no way. You would change general interpreter behavior if >> you could set arbitrary operators for predefined types. >> >> Start grumping... > > Thank you, Diez. > > If I ever design a language, please remind me that complete,

Re: Operator overloading

2008-01-25 Thread MartinRinehart
Diez B. Roggisch wrote: > No, there is no way. You would change general interpreter behavior if > you could set arbitrary operators for predefined types. > > Start grumping... Thank you, Diez. If I ever design a language, please remind me that complete, easy, well-documented access to the worki

Re: When is min(a, b) != min(b, a)?

2008-01-25 Thread Robert Kern
Marc 'BlackJack' Rintsch wrote: > On Fri, 25 Jan 2008 07:57:38 +, Pete Forman wrote: > >> Mark Dickinson <[EMAIL PROTECTED]> writes: >> >> > Any change to Python that made == and != checks involving NaNs raise >> > an exception would have to consider the consequences for set, dict, >> > lis

Re: find minimum associated values

2008-01-25 Thread Alan Isaac
Steven Bethard wrote: > [3rd approach] Seems "pretty" enough to me. ;-) I find it most attractive of the lot. But its costs would rise if the number of values per object were large. Anyway, I basically agree. Thanks, Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting Large File (Code/Performance)

2008-01-25 Thread Nicko
On Jan 24, 9:26 pm, [EMAIL PROTECTED] wrote: > > If you really have a 2GB file and only 2GB of RAM, I suggest that you don't > > hold your breath. > > I am limited with resources. Unfortunately. As long as you have at least as much disc space spare as you need to hold a copy of the file then this

  1   2   >