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

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 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: 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

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

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

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:

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

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: 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 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: 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: __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: 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: 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: 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 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: 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( ( (

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: 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

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: 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: 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

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: [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

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: 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: 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: 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

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

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 -

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

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: 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: 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

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: 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

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: 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

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: 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: 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: 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 Tim Chase
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's tough to find those generic keywords. It happens to be documented a bit here: http://docs.python.org/library/operator.html#operator.contain

Re: Memory efficient tuple storage

2009-03-13 Thread Aaron Brady
On Mar 13, 1:13 pm, "psaff...@googlemail.com" wrote: > Thanks for all the replies. > > First of all, can anybody recommend a good way to show memory usage? I > tried heapy, but couldn't make much sense of the output and it didn't > seem to change too much for different usages. Maybe I was just mak

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

2009-03-13 Thread aiwarrior
On Mar 13, 9:31 pm, 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() i

Re: c++ extension, problem passing argument

2009-03-13 Thread Aaron Brady
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 the appropriate > dereferencing? 'ctypes' may be a

Re: Quadratic equation

2009-03-13 Thread Benjamin Kaplan
On Fri, Mar 13, 2009 at 5:01 PM, Daniel Sidorowicz wrote: > For instructions open file named README > Enter control-C to quit > Traceback (most recent call last): > File "main.py", line 57, in > main() > File "main.py", line 16, in main > S = L.split() > AttributeError: 'list' object

Re: Get pixel colors from images in Python 3

2009-03-13 Thread Cro
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. -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory efficient tuple storage

2009-03-13 Thread Paul Rubin
"psaff...@googlemail.com" writes: > However, I still need the coordinates. If I don't keep them in a list, > where can I keep them? See the docs for the array module: http://docs.python.org/library/array.html -- http://mail.python.org/mailman/listinfo/python-list

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

2009-03-13 Thread Albert Hopkins
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.lower(): > bla bla bla > > But I

Re: How to find "in" in the documentation

2009-03-13 Thread Benjamin Peterson
isbd.co.uk> writes: > > 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 but not a lot. Look here: http://docs.python.org/reference/expressions.ht

Re: How to find "in" in the documentation

2009-03-13 Thread Albert Hopkins
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 but not a lot. > >From http://docs.py

Get pixel colors from images in Python 3

2009-03-13 Thread Cro
Good day. As the title sais, i am trying to extract pixel colors from images, in Python 3. I know that for python 2.x, PIL (Python image library) can do that, via Image > getpixel((x,y)). It returns the colors as a list with 3 parameters, Red, Green and Blue. This is exactly what i want. Now, the

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

2009-03-13 Thread Raymond Hettinger
> > The separators can be any one of COMMA, > > SPACE, DOT, UNDERSCORE, or NON-BREAKING-SPACE. > > What if I want other separators? format(n, ',d').replace(",", yoursep) > How about this idea: make the format has "long" format, which is a bit > more verbose, flexible, and unambiguous, and the cu

Threads and temporary files

2009-03-13 Thread aiwarrior
Hi 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 sequentially. An example is if we want to get various ranges of

Neatest way to do a case insensitive "in"?

2009-03-13 Thread tinnews
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? -- Chris Green -- http://mail.pytho

How to find "in" in the documentation

2009-03-13 Thread tinnews
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 but not a lot. -- Chris Green -- http://mail.python.org/mailman/listinfo/python-list

Re: Short-term python programming consultant - funds expire soon!

2009-03-13 Thread bobicanprogram
On Mar 10, 1:35 pm, Rob Clewley wrote: > Dear Pythonistas, > > Our open-source software project (PyDSTool) has money to hire an > experienced Python programmer on a short-term, per-task basis as a > technical consultant (i.e., no fringe benefits offered). The work can > be done remotely and will b

setup.py install and bdist_egg

2009-03-13 Thread Jasiu
Hey, I work at a company where I'm lucky enough to write web apps using Python and WSGI :). We develop more and more stuff in Python and it's becoming a mess of dependencies, so we thought we would create a guideline for developers that describes the whole process of deploying a Python app on a se

Re: An ordering question

2009-03-13 Thread John Posner
> If you don't want to build the intermediary dict, a > less efficient > version that runs in O(n^2): > > a.sort(key=lambda k: b.index(k[1])) > > Which is mostly similar to John's solution, but still > more efficient > because it only does a b.index call once per 'a' > item instead of twice > pe

Re: Memory efficient tuple storage

2009-03-13 Thread Kurt Smith
On Fri, Mar 13, 2009 at 1:13 PM, psaff...@googlemail.com wrote: > Thanks for all the replies. > [snip] > > The numpy solution does work, but it uses more than 1GB of memory for > one of my 130MB files. I'm using > > np.dtype({'names': ['chromo', 'position', 'dpoint'], 'formats': ['S6', > 'i4', 'f8

Re: c++ extension, problem passing argument

2009-03-13 Thread bobicanprogram
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 the appropriate > dereferencing? If you can't sol

Re: converting a string to a function parameter

2009-03-13 Thread Paul McGuire
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 use it as: > > test(convert(str)) and the behaviour should be

ANN: Urwid 0.9.8.4 - Console UI Library

2009-03-13 Thread Ian Ward
Announcing Urwid 0.9.8.4 Urwid home page: http://excess.org/urwid/ Tarball: http://excess.org/urwid/urwid-0.9.8.4.tar.gz RSS: http://excess.org/feeds/tag/urwid/ About this release: === This is a maintenance release that adds compatibility with P

Re: Quadratic equation

2009-03-13 Thread Benjamin Kaplan
On Fri, Mar 13, 2009 at 4:06 PM, Daniel Sidorowicz wrote: > Hello I need some hello I need some help with a programingproject, I'm > fairly new to programming so I do find it slightly confusing. > > Here is my code for my main function which > passes my variable from a text file, > however when i

Quadratic equation

2009-03-13 Thread Daniel Sidorowicz
Hello I need some hello I need some help with a programingproject, I'm fairly new to programming so I do find it slightly confusing. Here is my code for my main function which passes my variable from a text file, however when i run it I get the error code: import math import quadroot def main():

Re: PythonWin, python thread and PostQuitMessage?

2009-03-13 Thread aloonstra
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 which I've been unable to answer. I'm listen

Re: VMware and pywin32 error...

2009-03-13 Thread Joshua Kugler
dot wrote: > has anyone experience with installing Python and pywin32 to Windows XP > Pro running in a VMware environment? > > At the end of installing pywin32 I get following error: > > > Traceback (most recent call last):

Re: "import" not working?

2009-03-13 Thread Christian Heimes
Scott David Daniels wrote: > Aahz wrote: >> In article , >> Rhodri James wrote: ... >>> sys.path.append("C:\\DataFileTypes") >> >> My preference: >> sys.path.append(r"C:\DataFileTypes") >> This doesn't work if you need to add a trailing backslash, though. > > Also my preference (except, due to ag

Re: An ordering question

2009-03-13 Thread Hrvoje Niksic
"andrew cooke" writes: > Hrvoje Niksic wrote: >> Kottiyath writes: >> >>> Hi, >>> 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 be the same as b. >>> i

Re: __import__ with dict values

2009-03-13 Thread Gabriel Genellina
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=_brush() list(

Re:

2009-03-13 Thread Miles
On Fri, Mar 13, 2009 at 3:13 PM, Miles wrote: > [snip] Sorry, didn't see the original thread on this. -Miles -- http://mail.python.org/mailman/listinfo/python-list

Re:

2009-03-13 Thread Miles
On Fri, Mar 13, 2009 at 2:12 PM, John Posner wrote: > >>     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 be the same as >> b. >>     i.e. Output would be [(3, 2), (2

Re: __import__ with dict values

2009-03-13 Thread alex goretoy
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=_brush() list( ( self.__setattr__(x.replace("b_",""),getattr(B,x)) for x in dir(B)

Re: Memory efficient tuple storage

2009-03-13 Thread Gabriel Genellina
En Fri, 13 Mar 2009 14:49:51 -0200, Tim Wintle escribió: If the same chromosome string is being used multiple times then you may find it more efficient to reference the same string, so you don't need to have multiple copies of the same string in memory. That may be what is taking up the space

Re: "import" not working?

2009-03-13 Thread Gabriel Genellina
En Fri, 13 Mar 2009 14:27:27 -0200, Lie Ryan escribió: Steve Holden wrote: Lie Ryan wrote: Scott David Daniels wrote: Aahz wrote: In article , Rhodri James wrote: ... sys.path.append("C:\\DataFileTypes") My preference: sys.path.append(r"C:\DataFileTypes") This doesn't work if you need to

Re: Special keyword argument lambda syntax

2009-03-13 Thread bearophileHUGS
MRAB: >  >>> sorted(range(9), def key(n): n % 3) I am fine with the current lambda syntax, but another possibility: sorted(range(9), n => n % 3) Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: An ordering question

2009-03-13 Thread andrew cooke
MRAB wrote: > >>> a = [(4, 1), (7, 3), (3, 2), (2, 4)] > >>> b = [2, 4, 1, 3] > >>> d = dict((v, k) for k, v in a) > >>> c = [(d[s], s) for s in b] > >>> c > [(3, 2), (2, 4), (4, 1), (7, 3)] ah, that is more efficient than the suggestions i posted. andrew -- http://mail.python.org/mailman/

Re: c++ extension, problem passing argument

2009-03-13 Thread Matteo
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 the appropriate dereferencing? -- http://mail.python.org/mailman/listinfo/python-list

Re: An ordering question

2009-03-13 Thread andrew cooke
Hrvoje Niksic wrote: > Kottiyath writes: > >> Hi, >> 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 be the same as b. >> i.e. Output would be [(3, 2), (2, 4),

Re: Memory efficient tuple storage

2009-03-13 Thread Benjamin Peterson
psaffrey googlemail.com googlemail.com> writes: > > First of all, can anybody recommend a good way to show memory usage? Python 2.6 has a function called sys.getsizeof(). -- 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: [andrew cooke] would it break anything to also allow format(1234567, 'd') # what we have now '1234567' format(1234567, '.d') # proposed new option '1.234.567' format(1234.5, ',2f') # proposed new option '1234,50' format(1234.5, '.,2f') # pr

Re: Memory efficient tuple storage

2009-03-13 Thread psaff...@googlemail.com
Thanks for all the replies. First of all, can anybody recommend a good way to show memory usage? I tried heapy, but couldn't make much sense of the output and it didn't seem to change too much for different usages. Maybe I was just making the h.heap() call in the wrong place. I also tried getrusag

Re:

2009-03-13 Thread John Posner
> 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 be the same as > b. > i.e. Output would be [(3, 2), (2, 4), (4, 1), (7, 3)] > > I did the same as follows: >

Re: An ordering question

2009-03-13 Thread Hrvoje Niksic
Kottiyath writes: > Hi, > 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 be the same as b. > i.e. Output would be [(3, 2), (2, 4), (4, 1), (7, 3)] [...] > whe

Re: c++ extension, problem passing argument

2009-03-13 Thread Matteo
On 13 Mar, 18:19, Aaron Brady wrote: > On Mar 13, 12:03 pm, Matteo wrote: > > > > > Hi all, > > > I wrote a few c++ classes for some data analysis on a physics > > esperiment. Now I want to glue the lot with Python, so I built the > > necessary wrap code with SWIG and compiled the library with Di

Re: An ordering question

2009-03-13 Thread MRAB
MRAB wrote: Kottiyath wrote: Hi, 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 be the same as b. i.e. Output would be [(3, 2), (2, 4), (4, 1), (7, 3)] I did the same

Re: Special keyword argument lambda syntax

2009-03-13 Thread MRAB
Hrvoje Niksic wrote: MRAB writes: sorted(range(9), def key(n): n % 3) [0, 3, 6, 1, 4, 7, 2, 5, 8] Given the recent pattern of syntactic constructs for expressions using (ternary if, listcomps, genexps), and avoiding the use of colon in expressions, maybe it should be: sorted(range(9), k

Re: Memory efficient tuple storage

2009-03-13 Thread Tim Chase
While Kurt gave some excellent ideas for using numpy, there were some missing details in your original post that might help folks come up with a "work smarter, not harder" solution. Clearly, you're not loading it into memory just for giggles -- surely you're *doing* something with it once it's

Re: An ordering question

2009-03-13 Thread MRAB
Kottiyath wrote: Hi, 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 be the same as b. i.e. Output would be [(3, 2), (2, 4), (4, 1), (7, 3)] I did the same as follows:

Re: c++ extension, problem passing argument

2009-03-13 Thread Aaron Brady
On Mar 13, 12:03 pm, Matteo wrote: > Hi all, > > I wrote a few c++ classes for some data analysis on a physics > esperiment. Now I want to glue the lot with Python, so I built the > necessary wrap code with SWIG and compiled the library with Distutils. > All is fine, I can import the module and cl

Re: Memory efficient tuple storage

2009-03-13 Thread Kurt Smith
On Fri, Mar 13, 2009 at 11:33 AM, Kurt Smith wrote: [snip OP] > > Assuming your data is in a plaintext file something like > 'genomedata.txt' below, the following will load it into a numpy array > with a customized dtype.  You can access the different fields by name > ('chromo', 'position', and 'd

Re: Special keyword argument lambda syntax

2009-03-13 Thread Hrvoje Niksic
MRAB writes: sorted(range(9), def key(n): n % 3) > [0, 3, 6, 1, 4, 7, 2, 5, 8] Given the recent pattern of syntactic constructs for expressions using (ternary if, listcomps, genexps), and avoiding the use of colon in expressions, maybe it should be: sorted(range(9), key=n % 3 def key(n)

c++ extension, problem passing argument

2009-03-13 Thread Matteo
Hi all, I wrote a few c++ classes for some data analysis on a physics esperiment. Now I want to glue the lot with Python, so I built the necessary wrap code with SWIG and compiled the library with Distutils. All is fine, I can import the module and classes work as expected... ...but for one thing

An ordering question

2009-03-13 Thread Kottiyath
Hi, 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 be the same as b. i.e. Output would be [(3, 2), (2, 4), (4, 1), (7, 3)] I did the same as follows: >>> l = len(a) * [N

Re: converting a string to a function parameter

2009-03-13 Thread Aaron Brady
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 use it as: > test(convert(str)) and the behaviour should be same as calling test > with those values : > i.e. test(T

Re: Memory efficient tuple storage

2009-03-13 Thread Tim Wintle
On Fri, 2009-03-13 at 08:59 -0700, psaff...@googlemail.com wrote: > I'm reading in some rather large files (28 files each of 130MB). Each > file is a genome coordinate (chromosome (string) and position (int)) > and a data point (float). I want to read these into a list of > coordinates (each a tupl

Re: Special keyword argument lambda syntax

2009-03-13 Thread Scott David Daniels
Rhodri James wrote: On Fri, 13 Mar 2009 14:49:17 -, Beni Cherniavsky wrote: ...Allow keyword arguments in function call to take this form: NAME ( ARGUMENTS ) = EXPRESSION which is equivallent to the following: NAME = lambda ARGUMENTS: EXPRESSION except that NAME is also assigned as

Re: Memory efficient tuple storage

2009-03-13 Thread Kurt Smith
On Fri, Mar 13, 2009 at 10:59 AM, psaff...@googlemail.com wrote: > I'm reading in some rather large files (28 files each of 130MB). Each > file is a genome coordinate (chromosome (string) and position (int)) > and a data point (float). I want to read these into a list of > coordinates (each a tupl

  1   2   >