Re: A Dangling Tk Entry

2009-03-13 Thread Rhodri James
On Thu, 12 Mar 2009 04:34:57 -, W. eWatson wrote: I happened to notice that BJ and Rhondi started a small subthread to Nice to know your observation skills are up to scratch :-( this, so I thought I'd explore it. It led to interesting things, but not for its content. I reviewed some

converting a string to a function parameter

2009-03-13 Thread koranthala
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(True, type=rect, sizes=[3, 4]) I tried eval, but it did

Re: converting a string to a function parameter

2009-03-13 Thread Chris Rebert
On Fri, Mar 13, 2009 at 12: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 :

Re: converting a string to a function parameter

2009-03-13 Thread koranthala
On Mar 13, 1:01 pm, Chris Rebert wrote: > On Fri, Mar 13, 2009 at 12: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 behaviou

Re: cross platform accessing paths (windows, linux ...)

2009-03-13 Thread Vlastimil Brom
2009/3/13 hendra kusuma : > you may want to use os.sep to replace manually written "/" "\" ":" for each > os > I heard that unix/linux use "/" as directory separator while windows use "\" > and mac os use ":" > Thanks for the notice about the ":" path separator on mac; windows uses "\" but normally

Re: Raw String Question

2009-03-13 Thread andrew cooke
MRAB wrote: > andrew cooke wrote: >> MRAB wrote: >> [...] >>> The other special case is with \u in a Unicode string: >>> >>> >>> ur"\u0041" >>> u'A' >> >> this isn't true for 3.0: >> > r"\u0041" >> '\\u0041' >> >> (there's no "u" because it's a string, not a bytes literal) >> >> and as far as

VMware and pywin32 error...

2009-03-13 Thread dash
Hallo, 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): File "", line

issue - not able to connect to python com server

2009-03-13 Thread Madhubala
Hi , I have an issue regarding connectivity between client and com server. I have a com server implemented in MFC dll having MFC as static library. The requirement is to write python wrapper to it . Using ctypes I wrote a wrapper to MFC dll which exports couple of functions for com initiali

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

2009-03-13 Thread Raymond Hettinger
[Lie Ryan] > A hyphotetical code using conv function and the microlanguage could look > like this: > >  >>> num = 213210.3242 >  >>> fmt = create_format(sep='-', decsep='@') >  >>> print fmt > 50|\/|3_v3ry_R34D4|3L3_C0D3 >  >>> '{0!{1}}'.format(num, fmt) > '213-...@3242' LOL, it's like APL all ove

Re: unbiased benchmark

2009-03-13 Thread Martin P. Hellwig
Lie Ryan wrote: But ruby don't bite... Neither does a python, it is a constrictor, meaning it has a firm grip on the modules imported :-) -- mph -- http://mail.python.org/mailman/listinfo/python-list

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

2009-03-13 Thread andrew cooke
Raymond Hettinger wrote: > [Lie Ryan] >> A hyphotetical code using conv function and the microlanguage could look >> like this: >> >>  >>> num = 213210.3242 >>  >>> fmt = create_format(sep='-', decsep='@') >>  >>> print fmt >> 50|\/|3_v3ry_R34D4|3L3_C0D3 >>  >>> '{0!{1}}'.format(num, fmt) >> '213-.

Re: Python/Django forum-building software Snap/SCT, any reviews?

2009-03-13 Thread Bruno Desthuilliers
John Crawford a écrit : I'm looking for good open-source software for forums. There is a *lot* out there, for instance Lussumo's Vanilla gets good reviews, but most are PHP-based, and I would obviously prefer to use Python, with or without Django. Two packages that are Django-based that I have

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

2009-03-13 Thread Paul Rubin
Raymond Hettinger writes: > The proposal is roughly: > If you want commas in the output, > put a comma in the format string. > It's not rocket science. What if you want to change the separator? Europeans usually use periods instead of commas: one thousand = 1.000. -- http://mail.python.org/m

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

2009-03-13 Thread Raymond Hettinger
[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')     # prop

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

2009-03-13 Thread Raymond Hettinger
[Paul Rubin] > What if you want to change the separator?  Europeans usually > use periods instead of commas: one thousand = 1.000. That is supported also. -- http://mail.python.org/mailman/listinfo/python-list

disabling compiler flags in distutils

2009-03-13 Thread Christian Meesters
Hoi, I've written an extension in C++ which compiles wonderfully. However, I want to compile it using a setup script with distutils and distutils gives the compiler the unwanted (!) flag "-Wstrict-prototypes", which is a flag only understood when compiling C. The C++ compiler runs, but issues

Re: Install NumPy in python 2.6

2009-03-13 Thread David Cournapeau
On Fri, Mar 13, 2009 at 8:20 PM, gopal mishra wrote: > > > error: Setup script exited with error: None numpy 1.2.1 does not officially support python 2.6. Specially on windows, there are some issues like this one. Numpy 1.3.0 (to be released 1st April 2009) will contain everything to be buildabl

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

2009-03-13 Thread Tim Rowe
2009/3/12 Raymond Hettinger : > 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 As far as

Install NumPy in python 2.6

2009-03-13 Thread gopal mishra
Hi, I am trying to install SciPy and NumPy in Python 2.6 (OS - Win XP). http://downloads.sourceforge.net/numpy/numpy-1.2.1.tar.gz http://downloads.sourceforge.net/scipy/scipy-0.7.0.tar.gz While installing numpy It gives following installation error. Running from numpy source directory.

Re: "import" not working?

2009-03-13 Thread Steve Holden
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 add a trailing backslash, though. >> >> Also my pr

Plugin based feature adding to web-application

2009-03-13 Thread Ravi Kumar
I need an architecture in a project using Django and Python + MySQL, so that when I put a python script in specified directory, that should be loaded and its methods/functions can be used. As far as i have thought on this, I am going to scan that particular directory, list out the files, import th

+1 QOTW...

2009-03-13 Thread skip
>From the PSF board candidates statements: Tim Peters == While my efforts to get the PSF recognized as a bank holding company (and so qualify for billions of dollars in US TARP aid) haven't yet succeeded, I'm apparently the only director who even thought about it --

Re: What happened to NASA at Python? :(

2009-03-13 Thread skip
>> I would have thought someone would have noticed by now. Am I the only >> person who uses Windows? Apparently just you and the guy who built the distribution. Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: default shelve on linux corrupts, does different DB system help?

2009-03-13 Thread skip
Paul> I have the problem that my shelve(s) sometimes corrupt (looks like Paul> it has after python has run out of threads). Paul> I am using the default shelve so on linux I get the dbhash Paul> version. Is there a different DB type I can choose that is known Paul> to be more

Re: Python/Django forum-building software Snap/SCT, any reviews?

2009-03-13 Thread Adrian Cherry
John Crawford wrote in news:newztoolz_rulz!_www.techsono.com_3319721838_653...@speakea sy.net: > > Two packages that are Django-based that I have found, are > Snap and SCT. They both look pretty good (and Snap was > influenced by Vanilla). Does anyone have any experience with > these packages,

Re: Plugin based feature adding to web-application

2009-03-13 Thread limodou
On Fri, Mar 13, 2009 at 8:31 PM, Ravi Kumar wrote: > I need an architecture in a project using Django and Python + MySQL, so that > when I put a python script in specified directory, that should be loaded and > its methods/functions can be used. > As far as i have thought on this, I am going to sc

Re: cross platform accessing paths (windows, linux ...)

2009-03-13 Thread David Smith
Vlastimil Brom wrote: > 2009/3/13 hendra kusuma : >> you may want to use os.sep to replace manually written "/" "\" ":" for each >> os >> I heard that unix/linux use "/" as directory separator while windows use "\" >> and mac os use ":" >> > Thanks for the notice about the ":" path separator on mac

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

2009-03-13 Thread Wolfgang Rohdewald
On Freitag, 13. März 2009, Raymond Hettinger wrote: > [Paul Rubin] > > What if you want to change the separator? Europeans usually > > use periods instead of commas: one thousand = 1.000. > > That is supported also. do you support just a fixed set of separators or anything? how about this: (Swi

Encoding/decoding: Still don't get it :-/

2009-03-13 Thread Gilles Ganault
Hello I must be dense, but I still don't understand 1) why Python sometimes barfs out this type of error when displaying text that might not be Unicode-encoded, 2) whether I should use encode() or decode() to solve the issue, or even 3) if this is a Python issue or due to APWS SQLite wrapper that

Re: converting a string to a function parameter

2009-03-13 Thread odeits
On Mar 13, 12: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(

Re: Encoding/decoding: Still don't get it :-/

2009-03-13 Thread Peter Otten
Gilles Ganault wrote: > I must be dense, but I still don't understand 1) why Python sometimes > barfs out this type of error when displaying text that might not be > Unicode-encoded, 2) whether I should use encode() or decode() to solve > the issue, or even 3) if this is a Python issue or due to A

Re: Input data from .txt file and object array problem

2009-03-13 Thread odeits
On Mar 12, 9:02 am, SamuelXiao wrote: > On Mar 12, 11:17 pm, Piet van Oostrum wrote: > > > > > > SamuelXiao (S) wrote: > > >S> I want to input data by using pickle > > >S> First of all, I have a database.txt > > >S> The content is like: > > >S> AAA,aaalink > > >S> BBB,bbblink > > >S> CCC,ccc

Re: Raw String Question

2009-03-13 Thread MRAB
andrew cooke wrote: MRAB wrote: andrew cooke wrote: MRAB wrote: [...] The other special case is with \u in a Unicode string: >>> ur"\u0041" u'A' this isn't true for 3.0: r"\u0041" '\\u0041' (there's no "u" because it's a string, not a bytes literal) and as far as i can tell, that's cor

Special keyword argument lambda syntax

2009-03-13 Thread Beni Cherniavsky
This proposal (a) ignores Guido's clear-cut decision that lambda is good as it is, (b) is weird in proposing a special-case syntax, (c) is several Python versions too late for a graceful transition by 3.0. But I don't won't to just throw the idea away, so I'm posting here. If there is serious posit

Python competition ROUND #1

2009-03-13 Thread vedrandekovic
Hello, (Competition language: English) First round of Python competition at "Python Evaluator" will be next Saturday at 17:00 ( UTC ). If you want to register: http://evaluator.vdekovic.net/index.php?select=register.php Rules: http://evaluator.vdekovic.net/index.php?select=rules.php http://eva

Re: Special keyword argument lambda syntax

2009-03-13 Thread Rhodri James
On Fri, 13 Mar 2009 14:49:17 -, Beni Cherniavsky wrote: Specification = 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

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

2009-03-13 Thread pruebauno
On Mar 13, 7:06 am, Tim Rowe wrote: > 2009/3/12 Raymond Hettinger : > > > 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.py

Re: Raw String Question

2009-03-13 Thread Lie Ryan
MRAB wrote: In Python 3.x a backslash doesn't have a special meaning in a raw string, except that it can prevent a following quote from ending the string, but the backslash is still included. Why? How useful is that? I think it would've been simpler if a backslash had _no_ special effect, not ev

Re: Special keyword argument lambda syntax

2009-03-13 Thread MRAB
Rhodri James wrote: On Fri, 13 Mar 2009 14:49:17 -, Beni Cherniavsky wrote: Specification = Allow keyword arguments in function call to take this form: NAME ( ARGUMENTS ) = EXPRESSION which is equivallent to the following: NAME = lambda ARGUMENTS: EXPRESSION exce

Memory efficient tuple storage

2009-03-13 Thread psaff...@googlemail.com
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 tuple of (chromosome, position)) and a list of data points. This has taught m

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

2009-03-13 Thread Tim Rowe
2009/3/13 : > I think this proposal is more for debugging big numbers and meant mostly > for programmers' eyes. We are already using the dot instead of comma > decimal separator in our programming languages that one more > Americanism won't kill us. If it were for the programmers' eyes then it wo

Re: converting a string to a function parameter

2009-03-13 Thread Scott David Daniels
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(True, type=rect, sizes=[3, 4]) I tr

Re: "import" not working?

2009-03-13 Thread Lie Ryan
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 add a trailing backslash, though. Also my preference (ex

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

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

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

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

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)

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

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

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:

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

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

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

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

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

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

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

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

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

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

  1   2   >