Re: converting a string to a function parameter

2009-03-13 Thread Aaron Brady
On Mar 13, 3:21 pm, Paul McGuire wrote: > On Mar 13, 11:46 am, Aaron Brady wrote: > > > > > On Mar 13, 2:52 am, koranthala wrote: > > > > Hi, > > >     Is it possible to convert a string to a function parameter? > > > Ex: > > > str = 'True, type=rect, sizes=[3, 4]' > > > and I should be able to

Re: How to find "in" in the documentation

2009-03-13 Thread tinnews
Albert Hopkins wrote: > On Fri, 2009-03-13 at 21:01 +, tinn...@isbd.co.uk wrote: > > I've had this trouble before, how do I find the details of how "in" > > works in the documentation. E.g. the details of:- > > > > if string in bigstring: > > > > It gets a mention in the "if" section bu

Re: Neatest way to do a case insensitive "in"?

2009-03-13 Thread tinnews
Albert Hopkins wrote: > On Fri, 2009-03-13 at 21:04 +, tinn...@isbd.co.uk wrote: > > What's the neatest way to do the following in case insensitive fashion:- > > > > if stringA in stringB: > > bla bla bla > > > > I know I can just do:- > > > > if stringA.lower() in stringB.l

Re: Neatest way to do a case insensitive "in"?

2009-03-13 Thread MRAB
tinn...@isbd.co.uk wrote: What's the neatest way to do the following in case insensitive fashion:- if stringA in stringB: bla bla bla I know I can just do:- if stringA.lower() in stringB.lower(): bla bla bla But I was wondering if there's a neater/easier way? Not unl

Re: Get pixel colors from images in Python 3

2009-03-13 Thread Daniel Fetchinson
> I've noticed that Pygame has some similar implementation. > It's a little harder to use, but efficient. > > And i think it depends on PIL too. > And Pygame is Python 2.x too... > > So, not good. I'd also like to use PIL with python 3 and was told that PIL's author mostly frequents the image-sig

Python package for .ics (iCalendar) files

2009-03-13 Thread tinnews
Is there an 'offical' Python package for handling .ics files or is the follwing the best there is:- http://codespeak.net/icalendar/ It seems rather old but Google didn't pop anything else up. -- Chris Green -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find "in" in the documentation

2009-03-13 Thread Piet van Oostrum
> tinn...@isbd.co.uk (t) wrote: >t> I've had this trouble before, how do I find the details of how "in" >t> works in the documentation. E.g. the details of:- >t> if string in bigstring: >t> It gets a mention in the "if" section but not a lot. It is explained in The Python Language Refe

parsing tab separated data efficiently into numpy/pylab arrays

2009-03-13 Thread per
hi all, what's the most efficient / preferred python way of parsing tab separated data into arrays? for example if i have a file containing two columns one corresponding to names the other numbers: col1\t col 2 joe\t 12.3 jane \t 155.0 i'd like to parse into an array() such that i

Re: Python package for .ics (iCalendar) files

2009-03-13 Thread Chris Rebert
On Fri, Mar 13, 2009 at 3:05 PM, wrote: > Is there an 'offical' Python package for handling .ics files or is the > follwing the best there is:- > >    http://codespeak.net/icalendar/ > > It seems rather old but Google didn't pop anything else up. Well, the iCalendar standard doesn't really chang

Re: PythonWin, python thread and PostQuitMessage?

2009-03-13 Thread Gabriel Genellina
En Fri, 13 Mar 2009 17:59:34 -0200, escribió: On 12 mrt, 18:43, "Gabriel Genellina" wrote: En Thu, 12 Mar 2009 07:21:35 -0200, escribió: > I'm not so much involved in any Windows programming however I needed > to write a client for the Windows platform. I have this very simple > question whi

Re: c++ extension, problem passing argument

2009-03-13 Thread Matteo
On 13 Mar, 22:35, Aaron Brady wrote: > On Mar 13, 1:34 pm, Matteo wrote: > > > hmmm... looks like SWIG has a problem with double pointers. I googled > > around a bit and found: > > >http://osdir.com/ml/programming.swig/2003-02/msg00029.html > > > anyone knows how to write a small wrapper to do th

Re: parsing tab separated data efficiently into numpy/pylab arrays

2009-03-13 Thread Matteo
On 13 Mar, 23:19, per wrote: > hi all, > > what's the most efficient / preferred python way of parsing tab > separated data into arrays? for example if i have a file containing > two columns one corresponding to names the other numbers: > > col1    \t     col 2 > joe    \t  12.3 > jane   \t 155.0

Roundup Issue Tracker release 1.4.7

2009-03-13 Thread Richard Jones
I'm proud to release version 1.4.7 of Roundup. 1.4.7 is primarily a bugfix release which contains important security fixes: - a number of security issues were discovered by Daniel Diniz - EditCSV and ExportCSV altered to include permission checks - HTTP POST required on actions which alter data -

How to interface with C# without IronPython

2009-03-13 Thread Mudcat
All the topics I seem to find on this topic lead me in the direction of IronPython, but I'm not interested right now in a reimplementation of Python in .Net environment. There are wrappers and methods available for integrating with Java, C, and a bevy of other languages. I don't know much about .N

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-13 Thread John Nagle
Lie Ryan wrote: Hendrik van Rooyen wrote: "Ulrich Eckhardt" wrote: Look back in history, and see how COBOL did it with the PICTURE - dead easy and easily understandable. Compared to that, even the C printf stuff and python's % are incomprehensible. - Hendrik Yes. In COBOL, one writes

Re: How to find "in" in the documentation

2009-03-13 Thread Colin J. Williams
Piet van Oostrum wrote: tinn...@isbd.co.uk (t) wrote: t> I've had this trouble before, how do I find the details of how "in" t> works in the documentation. E.g. the details of:- t> if string in bigstring: t> It gets a mention in the "if" section but not a lot. It is explained in T

Re: How to interface with C# without IronPython

2009-03-13 Thread Chris Rebert
On Fri, Mar 13, 2009 at 3:51 PM, Mudcat wrote: > All the topics I seem to find on this topic lead me in the direction > of IronPython, but I'm not interested right now in a reimplementation > of Python in .Net environment. There are wrappers and methods > available for integrating with Java, C, an

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-13 Thread Raymond Hettinger
Todays updates to: http://www.python.org/dev/peps/pep-0378/ * Detail issues with the locale module. * Summarize commentary to date. -- Opposition to formatting strings in general (preferring a convenience function or PICTURE clause) -- Opposition to any non-locale aware approach * Add

Re: [Roundup-users] Roundup Issue Tracker release 1.4.7

2009-03-13 Thread Richard Jones
On Sat, Mar 14, 2009 at 9:51 AM, Richard Jones wrote: > I'm proud to release version 1.4.7 of Roundup. I would like to also specially thank Stefan Seefeld who is responsible for the new features and a lot of the bugfixes in this release. Richard -- http://mail.python.org/mailman/listinfo/p

Parameter sublists [was: An ordering question]

2009-03-13 Thread Peter Pearson
On Fri, 13 Mar 2009 18:56:30 +0100, Hrvoje Niksic wrote: [snip] > a.sort(key=lambda (x, y): b[y - 1], reverse=True) Huh? I had no idea one could do this: >>> def g( ( ( x, y ), z ) ): ... return y ... >>> g( ((1,2),3) ) 2 What should I have read to learn that trick? -- To email me, substi

Re: Parameter sublists [was: An ordering question]

2009-03-13 Thread Chris Rebert
On Fri, Mar 13, 2009 at 5:30 PM, Peter Pearson wrote: > On Fri, 13 Mar 2009 18:56:30 +0100, Hrvoje Niksic wrote: > [snip] >> a.sort(key=lambda (x, y): b[y - 1], reverse=True) > > Huh?  I had no idea one could do this: > def g( ( ( x, y ), z ) ): > ...   return y > ... g( ((1,2),3) ) > 2

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-13 Thread MRAB
Raymond Hettinger wrote: Todays updates to: http://www.python.org/dev/peps/pep-0378/ * Detail issues with the locale module. * Summarize commentary to date. -- Opposition to formatting strings in general (preferring a convenience function or PICTURE clause) -- Opposition to any non-

Re: c++ extension, problem passing argument

2009-03-13 Thread Aaron Brady
On Mar 13, 5:42 pm, Matteo wrote: > On 13 Mar, 22:35, Aaron Brady wrote: > > > > > On Mar 13, 1:34 pm, Matteo wrote: > > > > hmmm... looks like SWIG has a problem with double pointers. I googled > > > around a bit and found: > > > >http://osdir.com/ml/programming.swig/2003-02/msg00029.html > > >

Re: How to interface with C# without IronPython

2009-03-13 Thread Christian Heimes
Chris Rebert wrote: > Haven't used it, but Python for .NET sounds like it might be what you > want: http://pythonnet.sourceforge.net/ I've done some development for and with PythonDotNET. It's definitely the right thing. It works with .NET, Mono and Python 2.4 to 2.6. Christian -- http://mail.py

Subprocess module: running an interactive shell

2009-03-13 Thread Roman Medina-Heigl Hernandez
Hi, I'm experimenting with Python and I need a little help with this. What I'd like is to launch an interactive shell, having the chance to send first several commands from python. I've written the following code: = #!/usr/bin/env python import sys, subprocess exe = "/bin/sh" param

Re: Parameter sublists [was: An ordering question]

2009-03-13 Thread Kottiyath
On Mar 14, 5:39 am, Chris Rebert wrote: > On Fri, Mar 13, 2009 at 5:30 PM, Peter Pearson > wrote: > > On Fri, 13 Mar 2009 18:56:30 +0100, Hrvoje Niksic > > wrote: > > [snip] > >> a.sort(key=lambda (x, y): b[y - 1], reverse=True) > > > Huh?  I had no idea one could do this: > > def g( ( (

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-13 Thread Paul Rubin
Tim Rowe writes: > And if it's mostly for programmers' eyes, why does the motivation > state that "Adding thousands separators is one of the simplest ways to > improve the professional appearance and readability of output exposed > to end users"? It occurs to me, at least for quantities of data,

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-13 Thread Paul Rubin
Paul Rubin writes: >'%.3K' % 1234567 = 1.235K # K = 1000 >'%.:3Ki' % 1234567 = 1.206K # K = 1024 I meant 1.235M and 1.177M, of course. -- http://mail.python.org/mailman/listinfo/python-list

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-13 Thread Lie Ryan
Raymond Hettinger wrote: Motivation: Provide a simple, non-locale aware way to format a number with a thousands separator. Adding thousands separators is one of the simplest ways to improve the professional appearance and readability of output exposed to end users. In

Re: An ordering question

2009-03-13 Thread Gabriel Genellina
En Fri, 13 Mar 2009 17:33:51 -0200, Hrvoje Niksic escribió: "andrew cooke" writes: Hrvoje Niksic wrote: Kottiyath writes: I have 2 lists a = [(4, 1), (7, 3), (3, 2), (2, 4)] b = [2, 4, 1, 3] Now, I want to order _a_ (a[1]) based on _b_. i.e. the second element in tuple should

Re: __import__ with dict values

2009-03-13 Thread Lie Ryan
Gabriel Genellina wrote: En Fri, 13 Mar 2009 17:12:49 -0200, alex goretoy escribió: wow, ok, thank you Gabriel, I wasn't aware of x,'y',z This is what I decided to go with for now in one of my classes, but another class will need a modified version of this, as mentioned x,'y',z B=

Re: How to find "in" in the documentation

2009-03-13 Thread Gabriel Genellina
En Fri, 13 Mar 2009 19:46:11 -0200, escribió: Albert Hopkins wrote: On Fri, 2009-03-13 at 21:01 +, tinn...@isbd.co.uk wrote: > I've had this trouble before, how do I find the details of how "in" > works in the documentation. E.g. the details of:- > > if string in bigstring: >From ht

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-13 Thread Raymond Hettinger
[Lie Ryan] >  >     In the finance world, output with commas is the norm. > > I can't cite any source, but I am skeptical with that. No doubt that you're skeptical of anything you didn't already know ;-) I'm a CPA, was a 15 year division controller for a Fortune 500 company, and an auditor for an

Re: Threads and temporary files

2009-03-13 Thread Gabriel Genellina
En Fri, 13 Mar 2009 19:07:46 -0200, aiwarrior escribió: I recently am meddling with threads and wanted to make a threaded class that instead of processing anything just retrieves data from a file and returns that data to a main thread that takes all the gathered data and concatenates it seque

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-13 Thread Lie Ryan
Raymond Hettinger wrote: If anyone here is interested, here is a proposal I posted on the python-ideas list. The idea is to make numbering formatting a little easier with the new format() builtin in Py2.6 and Py3.0: http://docs.python.org/library/string.html#formatspec ---

Re: __import__ with dict values

2009-03-13 Thread Gabriel Genellina
En Sat, 14 Mar 2009 00:31:55 -0200, Lie Ryan escribió: Gabriel Genellina wrote: En Fri, 13 Mar 2009 17:12:49 -0200, alex goretoy escribió: list( ( self.__setattr__(x.replace("b_",""),getattr(B,x)) for x in dir(B) if x.startswith("b_") ) ) __special__ methods are an implementation

tkinter: loading file before entering mainloop

2009-03-13 Thread Peter Billam
Greetings, I've got this tkinter program which allows you to load a file with File/LoadFile or Ctrl-L or from the Alt-F menu, as usual. But I'd also like to be able to invoke it with: shellprompt> midimix x.mid and have it invoke its usual loadFile method on x.mid But with the top-level code:

python book for a C programmer

2009-03-13 Thread Saurabh
Hi all, I am an experienced C programmer, I have done some perl code as well. But while thinking about large programs,I find perl syntax a hinderance. I read Eric Raymonds article reagrding python,(http:// www.linuxjournal.com/article/3882). And it kind of convinced me to learn Python,I have searc

Detecting Updates on Arbitrary Objects

2009-03-13 Thread Paul Johnston
Hi, I would like to be able to install a code hook to detect updates on arbitrary objects. To give some background, I'm writing a web widget library, that uses request-local storage. If there's a mutable object on a widget (a dict is common), I'd like any attempts to update the dict to cause the d

Re: python book for a C programmer

2009-03-13 Thread Paul Rubin
Saurabh writes: > Hi all, > I am an experienced C programmer, I have done some perl code as well. > But while thinking about large programs,I find perl syntax a > hinderance. I would say read the online tutorial, then "Python in a Nutshell". -- http://mail.python.org/mailman/listinfo/python-list

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-13 Thread Lie Ryan
Raymond Hettinger wrote: [Lie Ryan] > In the finance world, output with commas is the norm. I can't cite any source, but I am skeptical with that. No doubt that you're skeptical of anything you didn't already know ;-) I'm a CPA, was a 15 year division controller for a Fortune 500 compan

Re: Subprocess module: running an interactive shell

2009-03-13 Thread Karthik Gurusamy
On Mar 13, 6:39 pm, Roman Medina-Heigl Hernandez wrote: > Hi, > > I'm experimenting with Python and I need a little help with this. What I'd > like is to launch an interactive shell, having the chance to send first > several commands from python. I've written the following code: > > =

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-13 Thread Raymond Hettinger
[Lie Ryan] > My proposition is: make the format specifier a simpler API to locale > aware You do know that we already have one, right? That's what the existing "n" specifier does. Raymond -- http://mail.python.org/mailman/listinfo/python-list

<    1   2