Re: iterator? way of generating all possible combinations?

2006-05-26 Thread [EMAIL PROTECTED]
hmmm, just needed better search words, thanks :) -- http://mail.python.org/mailman/listinfo/python-list

Re: iterator? way of generating all possible combinations?

2006-05-26 Thread [EMAIL PROTECTED]
Terry Reedy wrote: > > Are the dice identical or distinguishable (marked). In other words, with 2 > dice, is 1,2 the same as 2,1 or different? Note that in most dice games, > such as craps, the dice are not distinguished, but probability calculations > must treast them as if they were to get th

Re: access serial port in python

2006-05-26 Thread vipulagarwal . in
i can use the polling method to check for data on the serial port using pyserial...but i need to use the interrupt driven method .am workin on a windows platform -- http://mail.python.org/mailman/listinfo/python-list

Re: access serial port in python

2006-05-26 Thread vipulagarwal . in
i can use the polling method to check for data on the serial port using pyserial...but i need to use the interrupt driven method .am workin on a windows platform -- http://mail.python.org/mailman/listinfo/python-list

Re: iterator? way of generating all possible combinations?

2006-05-26 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ok, this is really irritating me. I'm sure there are different ways of > doing this - I'm interested in the algo, not the practical solution, > I'm more trying to play with iterators and recursion. I want to create > a program that g

Re: Looking for triangulator/interpolator

2006-05-26 Thread Grant Edwards
On 2006-05-27, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: >> I need to interpolate an irregularly spaced set of sampled >> points: Given a set of x,y,z points, I need to interpolate z >> values for a much finer x,y grid. > > How many x,y,z points do you have? I've got about 700 data points. T

Running External Commands + Seeing when they are Finished

2006-05-26 Thread Tommy B
I'm currently working on a script that I will run when I leave my computer on at night. It runs external commands like Ad-Aware, Spybot, AVG, Avast, and the like. The problem is, I want to know how to make it so that one command starts only after the last one finishes. When I run them, they end up

Re: John Bokma harassment

2006-05-26 Thread P.L.Hayes
"Mike Schilling" <[EMAIL PROTECTED]> writes: > "P.L.Hayes" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> >> I agree. I have already written to Dreamhost and I hope more people >> will do so. I have found some of what has been posted here quite >> astonishing and the actions of

Re: Looking for triangulator/interpolator

2006-05-26 Thread Grant Edwards
On 2006-05-27, Robert Kern <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: > >> I found another module that claims to do what I want >> >> http://www.cdc.noaa.gov/people/jeffrey.s.whitaker/python/griddata.html >> >> But, no matter what data I pass, I get either all zeros or all >> NaNs back. :/

Re: Looking for triangulator/interpolator

2006-05-26 Thread Grant Edwards
On 2006-05-27, Grant Edwards <[EMAIL PROTECTED]> wrote: > I found another module that claims to do what I want > > http://www.cdc.noaa.gov/people/jeffrey.s.whitaker/python/griddata.html > > But, no matter what data I pass, I get either all zeros or all > NaNs back. :/ Aaarrrggh. After some more s

Re: iterator? way of generating all possible combinations?

2006-05-26 Thread Raymond Hettinger
[EMAIL PROTECTED] wrote: > Ok, this is really irritating me. I'm sure there are different ways of > doing this - I'm interested in the algo, not the practical solution, > I'm more trying to play with iterators and recursion. I want to create > a program that generates every possible combination

iterator? way of generating all possible combinations?

2006-05-26 Thread [EMAIL PROTECTED]
Ok, this is really irritating me. I'm sure there are different ways of doing this - I'm interested in the algo, not the practical solution, I'm more trying to play with iterators and recursion. I want to create a program that generates every possible combination of a set of a n dice, with s sides

Re: PUDGE - Project Status, Alternative Solutions

2006-05-26 Thread George Sakkis
Ilias Lazaridis wrote: > Is there a similar tool available, with which I can generate python > documentation / websites or both based on templates and reST? rest2web (http://www.voidspace.org.uk/python/rest2web/) seems relevant, though the latest version is 0.4alpha so I'm not sure if it's stabl

Re: Looking for triangulator/interpolator

2006-05-26 Thread Robert Kern
Grant Edwards wrote: > I found another module that claims to do what I want > > http://www.cdc.noaa.gov/people/jeffrey.s.whitaker/python/griddata.html > > But, no matter what data I pass, I get either all zeros or all > NaNs back. :/ > > I'm 0 for 3 now. I pointed you to http://www.scipy.or

Re: Looking for triangulator/interpolator

2006-05-26 Thread Travis E. Oliphant
Grant Edwards wrote: > I need to interpolate an irregularly spaced set of sampled > points: Given a set of x,y,z points, I need to interpolate z > values for a much finer x,y grid. How many x,y,z points do you have? Did you try the fitpack function bisplrep in scipy? It can work well as long as

justfuckengoogleit.com

2006-05-26 Thread justfuckengoogleit
Got a dumb question to ask, http://www.justfuckengoogleit.com or www.justfuckinggoogleit.net -- http://mail.python.org/mailman/listinfo/python-list

Re: John Bokma harassment

2006-05-26 Thread Steve Holden
John Bokma wrote: > Eli Gottlieb <[EMAIL PROTECTED]> wrote: > > >>Who reads blogs? They're well known for housing crackpots far worse >>than Xah, and I estimate he doesn't want to associate himself with that >>sort. > > > Yup, he seems to be quite happy as a Usenet Kook > An area in which y

Re: Looking for triangulator/interpolator

2006-05-26 Thread Grant Edwards
On 2006-05-27, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2006-05-27, Grant Edwards <[EMAIL PROTECTED]> wrote: >> On 2006-05-26, Scott David Daniels <[EMAIL PROTECTED]> wrote: >> I tried using the scipy sandbox delaunay module, but the interpolators don't work: the natural neighbor int

Re: Looking for triangulator/interpolator

2006-05-26 Thread John Machin
Grant> OTOH, it looks like I'm screwed either way. My python interpolator is so hopelessly slow it's useless in practice. It can only process 4 points per second and I need to process arrays of 10,000 to 50,000 elements. :( Pardon my utter ignorance of scipy, but are neither psyco nor pyrex any u

Re: stupid perl question

2006-05-26 Thread John Machin
On 27/05/2006 9:51 AM, BJörn Lindqvist wrote: >> how can i split a string that contains white spaces and '_' >> >> any clue? > > If the white spaces and the '_' should be applied equivalently on the > input and you can enumerate all white space characters, you could do > like this: Yes, you could

Safe eval critique (homework done)

2006-05-26 Thread Babar K. Zafar
Hi guys! I know this subject has been beaten to death and I am not going to whine about lacking features for proper restricted execution in the Python runtime. It's the OS job, I get it. Anyways, I thought about using a restricted *subset* of the language for simple configuration scripts and stor

Re: Looking for triangulator/interpolator

2006-05-26 Thread Grant Edwards
On 2006-05-27, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2006-05-26, Scott David Daniels <[EMAIL PROTECTED]> wrote: > >>> I tried using the scipy sandbox delaunay module, but the >>> interpolators don't work: the natural neighbor interpolator >>> produces a surface with "holes" in it: the inter

Re: logging

2006-05-26 Thread Baurzhan Ismagulov
Hello Vinay, On Thu, May 25, 2006 at 10:14:00AM -0700, Vinay Sajip wrote: > I don't know what your logger hierarchy looks like: you could perhaps > log to child loggers of l01 ("l01.XXX"), or set all other loggers you > use to have a CRITICAL level, or filter them using a filter which > filters ou

Re: Thread vs. generator problem

2006-05-26 Thread Paul Rubin
"Tim Peters" <[EMAIL PROTECTED]> writes: > > g = remote_iterate(itertools.count) > > You didn't run this code, right? itertools.count() was intended. Sorry, I made a cut-and-paste error posting the message. My test case did use itertools.count(). > In any case, as when calling any generato

Re: stupid perl question

2006-05-26 Thread John Machin
On 27/05/2006 9:15 AM, M.N.A.Smadi wrote: > hi guys; > > sorry for sending a perl question here, but python guy "HAD TO" look at > perl code; > > how can i split a string that contains white spaces and '_' > > any clue? > > thanks > moe smadi Well the screamingly obvious way to do in Python w

Re: Looking for triangulator/interpolator

2006-05-26 Thread Grant Edwards
On 2006-05-26, Scott David Daniels <[EMAIL PROTECTED]> wrote: >> I tried using the scipy sandbox delaunay module, but the >> interpolators don't work: the natural neighbor interpolator >> produces a surface with "holes" in it: the interpolator returns >> NaNs for no reason for certain regions with

Re: stupid perl question

2006-05-26 Thread BJörn Lindqvist
> how can i split a string that contains white spaces and '_' > > any clue? If the white spaces and the '_' should be applied equivalently on the input and you can enumerate all white space characters, you could do like this: def split_helper(list, delims): if not delims: return list

Re: Looking for triangulator/interpolator

2006-05-26 Thread Scott David Daniels
Grant Edwards wrote: > I need to interpolate an irregularly spaced set of sampled > points: Given a set of x,y,z points, I need to interpolate z > values for a much finer x,y grid. > > I tried using the scipy sandbox delaunay module, but the > interpolators don't work: the natural neighbor interpo

stupid perl question

2006-05-26 Thread M.N.A.Smadi
hi guys; sorry for sending a perl question here, but python guy "HAD TO" look at perl code; how can i split a string that contains white spaces and '_' any clue? thanks moe smadi -- http://mail.python.org/mailman/listinfo/python-list

Re: John Bokma harassment

2006-05-26 Thread Mike Schilling
"P.L.Hayes" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > I agree. I have already written to Dreamhost and I hope more people > will do so. I have found some of what has been posted here quite > astonishing and the actions of certain people to be reprehensible: by > far the most

Re: Don't wish to give up on a Tkinter GUI Builder :(

2006-05-26 Thread vbgunz
> Ah, what I was referring to (somewhat in jest) was something to > automatically *write* the code needed by the application. Simply > executing it is easy enough and in fact Rapyd-Tk already does this via > the save-build-run project-menu choice. sorry I misunderstood you. -- http://mail.pytho

Looking for triangulator/interpolator

2006-05-26 Thread Grant Edwards
I need to interpolate an irregularly spaced set of sampled points: Given a set of x,y,z points, I need to interpolate z values for a much finer x,y grid. I tried using the scipy sandbox delaunay module, but the interpolators don't work: the natural neighbor interpolator produces a surface with "ho

Re: Thread vs. generator problem

2006-05-26 Thread Tim Peters
[Paul Rubin] > ... > When I try to do it in a separate thread: > > import time, itertools > def remote_iterate(iterator, cachesize=5): > # run iterator in a separate thread and yield its values > q = Queue.Queue(cachesize) > def f(): > print 'thread start

PUDGE - Project Status, Alternative Solutions

2006-05-26 Thread Ilias Lazaridis
What is going on with the pudge project? Mr. Patrik O'Brien (Orbtech LLC) had told me that there is no similar tool available within the python domain, thus I have invested some effort to create a Website template, and to enable pudge to generate colored code: http://audit.lazaridis.com/schevo

Re: Thread vs. generator problem

2006-05-26 Thread Robert Kern
Paul Rubin wrote: > As I understand it, generators are supposed to run til they hit a > yield statement: > >import time >def f(): > print 1 > time.sleep(3) > for i in range(2,5): > yield i > >for k in f(): > print k > > prints "1" immediately, sleeps for

Thread vs. generator problem

2006-05-26 Thread Paul Rubin
As I understand it, generators are supposed to run til they hit a yield statement: import time def f(): print 1 time.sleep(3) for i in range(2,5): yield i for k in f(): print k prints "1" immediately, sleeps for 3 seconds, then prints 2, 3, and 4 without pau

Re: Modify one character in a string

2006-05-26 Thread Scott David Daniels
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Roy Smith wrote: > >>> Also, how do I do this when dealing with a file ; which file mode >>> should I use and what function should I use to modify a single >>> character once in that file mode? >> This is a much more complicated question, b

Re: Modify one character in a string

2006-05-26 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Roy Smith wrote: >> Also, how do I do this when dealing with a file ; which file mode >> should I use and what function should I use to modify a single >> character once in that file mode? > > This is a much more complicated question, because it depends on the details > o

Re: access serial port in python

2006-05-26 Thread Larry Bates
pyserial? http://pyserial.sourceforge.net/ -Larry [EMAIL PROTECTED] wrote: > hi > i hav written a code in python to send an SMS from a nokia 3310 > connected to my PC... > i wanted to receive a msg on my PC. In order to do so, the PC must know > when it has to read data frm the serial port ...th

Re: hide python window, con'td

2006-05-26 Thread Larry Bates
It is just the nature of "things that run in the background all day" to be things that should probably be daemons or services. They almost always sleep, check, process, sleep, ... and as windows services do that better than processes in loops that sleep. They are daunting at first, but services ar

Re: write() vs. writelines()

2006-05-26 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Gregory Petrosyan wrote: > Thanks for your reply. I understand this fact, but I wonder why > writelines() works slowly -- I think C code can be optimised to work > faster than Python one. Is it correct that writelines(...) is just a > shorthand for > > for ch in ...: >

Re: Speed up this code?

2006-05-26 Thread John Machin
On 27/05/2006 6:57 AM, [EMAIL PROTECTED] wrote: > I have tried this comparison, with a version I've modified a bit, I > have encoutered a problem in sieve_all, for example with n=1, I > don't know why: It might have been better use of bandwidth to give details of the problem instead of all th

Re: hide python window, con'td

2006-05-26 Thread Robin Becker
Larry Bates wrote: > Something that runs all day in the background is a perfect candidate > for being turned into a Service. That and servicemanager has a good > way of managing the task so that it doesn't take up lots of excess > CPU cycles that a "normal" application would take while sleeping >

access serial port in python

2006-05-26 Thread vipulagarwal . in
hi i hav written a code in python to send an SMS from a nokia 3310 connected to my PC... i wanted to receive a msg on my PC. In order to do so, the PC must know when it has to read data frm the serial port ...thus an interrupt must be generated when the serial port receives data frm the phone .

Re: John Bokma harassment

2006-05-26 Thread P.L.Hayes
"Mumia W." <[EMAIL PROTECTED]> writes: > Mitch wrote: >> John Bokma wrote: >> [...] >>> You're mistaken. All you need to do is report it. After some time >>> Xah will either walk in line with the rest of the world, or has >>> found somewhere else to yell. As long as it's not my back garden >>> and

Re: OT: Quote ? [was: John Bokma harassment]

2006-05-26 Thread Mike Schilling
"John Bokma" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Mike Schilling" <[EMAIL PROTECTED]> wrote: > >> >> "John Bokma" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >>> "Chris Uppal" <[EMAIL PROTECTED]> wrote: >>> [apologies to the whole flaming crowd fo

Re: chop() and empty() functions

2006-05-26 Thread John Machin
On 27/05/2006 6:41 AM, Paul Rubin wrote: > John Machin <[EMAIL PROTECTED]> writes: >> What is the use case? Why write something like """empty(foo, 42, >> cmd="xyzzy")""" when you could merely write "pass" or nothing at all? > > The function might be a parameter to something. Please bear with me;

Re: chop() and empty() functions

2006-05-26 Thread Jeremy L. Moles
On Sat, 2006-05-27 at 06:22 +1000, John Machin wrote: > On 27/05/2006 2:54 AM, Jeremy L. Moles wrote: > > ["chop" snipped] > > > > > Furthermore, what do people think about the idea of adding a truly > > empty, no-op global lambda somewhere in Python? I use them a lot > > What is the use case?

Re: Speed up this code?

2006-05-26 Thread bearophileHUGS
I have tried this comparison, with a version I've modified a bit, I have encoutered a problem in sieve_all, for example with n=1, I don't know why: def sieve_all(n=100): # yield all primes up to n stream = iter(xrange(2, n)) while True: p = stream.next() yield p

Re: OT: Quote ? [was: John Bokma harassment]

2006-05-26 Thread John Bokma
"Mike Schilling" <[EMAIL PROTECTED]> wrote: > > "John Bokma" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> "Chris Uppal" <[EMAIL PROTECTED]> wrote: >> >>> [apologies to the whole flaming crowd for sending this to the whole >>> flaming crowd...] >>> >>> Geoffrey Summerhayes wro

Re: hide python window, con'td

2006-05-26 Thread Larry Bates
Something that runs all day in the background is a perfect candidate for being turned into a Service. That and servicemanager has a good way of managing the task so that it doesn't take up lots of excess CPU cycles that a "normal" application would take while sleeping or unnecessarily looping. Pi

Re: OT: Quote ? [was: John Bokma harassment]

2006-05-26 Thread Mike Schilling
"John Bokma" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Chris Uppal" <[EMAIL PROTECTED]> wrote: > >> [apologies to the whole flaming crowd for sending this to the whole >> flaming crowd...] >> >> Geoffrey Summerhayes wrote: >> >>> After you kill Navarth, will it be nothing but

Re: Speed up this code?

2006-05-26 Thread John Machin
On 26/05/2006 11:25 PM, Frank Millman wrote: > [EMAIL PROTECTED] wrote: >> If you are interested in such programs, you can take a look at this one >> too: >> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/366178 >> >> It requires more memory, but it's quite fast. >> >> Bye, >> bearophile >

Re: chop() and empty() functions

2006-05-26 Thread Paul Rubin
John Machin <[EMAIL PROTECTED]> writes: > What is the use case? Why write something like """empty(foo, 42, > cmd="xyzzy")""" when you could merely write "pass" or nothing at all? The function might be a parameter to something. -- http://mail.python.org/mailman/listinfo/python-list

Re: OLAP and pivot tables

2006-05-26 Thread Tim Churches
Ben Stroud wrote: > George Sakkis wrote: > >> After a brief search, I didn't find any python package related to OLAP >> and pivot tables. Did I miss anything ? To be more precise, I'm not so >> interested in a full-blown OLAP server with an RDBMS backend, but >> rather a pythonic API for construct

Re: chop() and empty() functions

2006-05-26 Thread John Machin
On 27/05/2006 2:54 AM, Jeremy L. Moles wrote: ["chop" snipped] > > Furthermore, what do people think about the idea of adding a truly > empty, no-op global lambda somewhere in Python? I use them a lot What is the use case? Why write something like """empty(foo, 42, cmd="xyzzy")""" when you cou

Re: how to clear up a List in python?

2006-05-26 Thread Erik Max Francis
vbgunz wrote: > Steve, I have no qualm with Fredrik over this '''if you don't know how > to do things, you don't need to post.''' but this ''' if you know why > this is about the dumbest way to do what you're doing, and you're > posted this on purpose, you really need to grow up.'''. > > The prob

Re: sort a dictionary by keys in specific order

2006-05-26 Thread Bruno Desthuilliers
spohle a écrit : > how do i get the result back into the dictionary ? > Python dicts (like almost any known hash-table) are *not* ordered. If you need an ordered dict, roll your own - this is quite easy. -- http://mail.python.org/mailman/listinfo/python-list

Re: sort a dictionary by keys in specific order

2006-05-26 Thread Bruno Desthuilliers
Tim Chase a écrit : (snip) > >> list = [key2, key3, key1] > > 1) it's bad practice to shadow the list() command... s/command/type/ > funky stuff can happen. indeed, if you shadow it with a non-compatible object !-) -- http://mail.python.org/mailman/listinfo/python-list

Re: dict literals vs dict(**kwds)

2006-05-26 Thread Bruno Desthuilliers
George Sakkis a écrit : > Bruno Desthuilliers wrote: > > >>George Sakkis a écrit : >> >>>The thing is there are four (at least?) ways to get a dict instance: >>> (snip) >>This actually makes 2 (two) ways of creating a dict: >>- the default call to type (ie : dict(...) >>- the syntactic sugar dic

Re: PIL problem with biprocessor hardware

2006-05-26 Thread [EMAIL PROTECTED]
oops. lost my train of thought. I was gonna say, I wonder if some of these image manipulation routines are using multiple threads? -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL problem with biprocessor hardware

2006-05-26 Thread [EMAIL PROTECTED]
I wonder if there are other threads accessing image? Maybe image isn't fully initialized by some other thread before this code accesses it? It's hard to say what's going wrong. I don't believe that an SMP system would have any bearing on an application unless it uses multiple threads of execution.

Re: Python for my mum

2006-05-26 Thread BartlebyScrivener
Cameron, The "7 Minutes To Hello World" IS the ActiveState distribution. It's just hand-holding, click here, click there, for the person who doesn't know what "Windows/x86" means on the install page, or perhaps doesn't know what to do with the interpreter once it's installed. -- http://mail.pyth

Re: Don't wish to give up on a Tkinter GUI Builder :(

2006-05-26 Thread Cam
Ah, what I was referring to (somewhat in jest) was something to automatically *write* the code needed by the application. Simply executing it is easy enough and in fact Rapyd-Tk already does this via the save-build-run project-menu choice. vbgunz wrote: > > As for the code to actually make the ap

Re: dict literals vs dict(**kwds)

2006-05-26 Thread George Sakkis
Duncan Booth wrote: > George Sakkis wrote: > > > Duncan Booth wrote: > > > >> George Sakkis wrote: > >> > >> > 2) restricting in a more serious sense: the future addition of > >> > optional keyword arguments that affect the dict's behaviour. Google > >> > for "default dict" or "dictionary accumula

Linking onClick event to other controls on the Frame

2006-05-26 Thread DataSmash
Hello, I've created a simple form with 2 radio boxes, 2 text boxes and a button. When I click the button, I'd like to write each "choice" to a text file. I can't figure out how to "link" the onClick event to the other 4 controls. Any help would be much appreciated! R.D. Harles import wx, sys cla

Re: dict literals vs dict(**kwds)

2006-05-26 Thread Paul Rubin
Duncan Booth <[EMAIL PROTECTED]> writes: > > d = dict(default=0) > > d['x'] += 3 > > > > more elegant than > > > > d = {} > > d.withdefault(0) > > d['x'] += 3 > > > Well you could have: > > d = dict.withdefault(0) > > but then you may have to start with an empty dictionary. What happens if >

Re: write() vs. writelines()

2006-05-26 Thread Gregory Petrosyan
Thanks for your reply. I understand this fact, but I wonder why writelines() works slowly -- I think C code can be optimised to work faster than Python one. Is it correct that writelines(...) is just a shorthand for for ch in ...: file.write(ch) ? -- http://mail.python.org/mailman/listinfo/

Re: chop() and empty() functions

2006-05-26 Thread Terry Reedy
"Jeremy L. Moles" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Furthermore, what do people think about the idea of adding a truly > empty, no-op global lambda somewhere in Python? In an important sense, there is no such object as a 'lambda' in Python. There are only function ob

Re: write() vs. writelines()

2006-05-26 Thread Fredrik Lundh
Gregory Petrosyan wrote: > My question is: why write(''.join(...)) works slowly than > writelines(...)? Here's the code: the first copies all the substring to a single string large enough to hold all the data, before handing it over to the file object, while the second just writes the substring

Re: sort a dictionary by keys in specific order

2006-05-26 Thread spohle
i write the dict out to a file, not with file methods but rather with an inhouse python code. unfortunatly the order plays a big role for that. -- http://mail.python.org/mailman/listinfo/python-list

Re: dict literals vs dict(**kwds)

2006-05-26 Thread Duncan Booth
George Sakkis wrote: > Duncan Booth wrote: > >> George Sakkis wrote: >> >> > 2) restricting in a more serious sense: the future addition of >> > optional keyword arguments that affect the dict's behaviour. Google >> > for "default dict" or "dictionary accumulator". >> >> There is nothing to stop

Re: list comprehensions put non-names into namespaces!

2006-05-26 Thread Just
In article <[EMAIL PROTECTED]>, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Mel Wilson" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Point of information, would this be the interpreter putting > > the result of its last calculation in _ ? > > Yes, [ ... ] No, actually. It'

write() vs. writelines()

2006-05-26 Thread Gregory Petrosyan
My question is: why write(''.join(...)) works slowly than writelines(...)? Here's the code: import sys import random #try: #import psyco #psyco.full() #except ImportError: #pass def encrypt(key, infile, outfile, bufsize=65536): random.seed(key) in_buf = infile.read(bufsize)

Re: Pyrex installation on windows XP: step-by-step guide

2006-05-26 Thread sturlamolden
Gonzalo Monzón wrote: > Does this happen if you're releasing, i.e. a built exe with py2exe, > where you supply the right crt? or if you do supply the right crt on the > application folder? ... It does not matter which crt you "supply". The dynamic linker will attempt to load the crt specified by

Re: Python for my mum

2006-05-26 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, vbgunz <[EMAIL PROTECTED]> wrote: >maybe you can tell your moms what to do and what binaries to download >or maybe you can download them for her and either send it to her >through email or put it on a disc for her... I understand the Windows >XP installation binary i

Re: list comprehensions put non-names into namespaces!

2006-05-26 Thread Terry Reedy
"Mel Wilson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Point of information, would this be the interpreter putting > the result of its last calculation in _ ? Yes, in interactive mode (but not in batch mode) it binds the valid name '_' to the result of statement expressions.

Re: sort a dictionary by keys in specific order

2006-05-26 Thread Tim Chase
> how do i get the result back into the dictionary ? Well, if you must, if you've just got the results in my previous post, you can take them and shove them back into a dict with results = [('key1','value1'),('key2','value2)] newDict = dict(results) If you're not doing anything

Re: sort a dictionary by keys in specific order

2006-05-26 Thread spohle
how do i get the result back into the dictionary ? -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL problem with biprocessor hardware

2006-05-26 Thread mardif
OK, this is the code: """ image is the object instance of Image class which contains all informations """ pil = Image.open( os.path.join( image.path,image.name ) ) if image.rotation_angle != 2: try: pil = pil.rotate( rotation_lev

Re: Tkinter canvas zooming (sortof)

2006-05-26 Thread Bob Greschke
"Bob Greschke" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I have a program that sucks in a list of equipment positions (Lats/Longs), >opens a Toplevel frame with a canvas set to, for example, 700x480 pixels, >and then does all of the calculations and plots the objects with 10-p

Re: sort a dictionary by keys in specific order

2006-05-26 Thread Paul Rubin
"spohle" <[EMAIL PROTECTED]> writes: > dic = {'key1':'value1', 'key2':'value2', 'key3':'value3'} > > list = [key2, key3, key1] Is this what you want? dic = {'key1':'value1', 'key2':'value2', 'key3':'value3'} keys = ['key2', 'key3', 'key1'] items = [dic[k] for k in keys] print ite

Re: sort a dictionary by keys in specific order

2006-05-26 Thread Tim Chase
> hi i have a normal dictionary with key and value pairs. now i wanna > sort by the keys BUT in a specific order i determine in a list !? any > ideas > > dic = {'key1':'value1', 'key2':'value2', 'key3':'value3'} > > list = [key2, key3, key1] 1) it's bad practice to shadow the list() command...f

sort a dictionary by keys in specific order

2006-05-26 Thread spohle
hi i have a normal dictionary with key and value pairs. now i wanna sort by the keys BUT in a specific order i determine in a list !? any ideas dic = {'key1':'value1', 'key2':'value2', 'key3':'value3'} list = [key2, key3, key1] -- http://mail.python.org/mailman/listinfo/python-list

chop() and empty() functions

2006-05-26 Thread Jeremy L. Moles
I've been using the following lambda/function for a number of months now (I got the idea from someone in #python, though I don't remember who): def chop(s, n): """Chops a sequence, s, into n smaller tuples.""" return zip(*[iter(s)] * n) ...or... chop = lambda s, n: zip(*[iter(s)

Re: how to clear up a List in python?

2006-05-26 Thread Duncan Smith
chris brat wrote: > Doesnt this do what the original poster is try accomplish? > Not what the OP asked for, no. Clearing a list implies that list1 should still be bound to the same list (which might be important if there are other names bound to the same list). If it wasn't important that it be

Re: John Bokma harassment

2006-05-26 Thread Frank Goenninger DG1SBG
John Bokma <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] (Bob Felts) wrote: > >> Count me among the clueless, then. I just wrote to DreamHost and asked >> that they reverse their decision to terminate his account. > > I am sure that DreamHost has quite a nice /dev/null for clueless idiots > li

Re: "Learning Python" 2nd ed. p479 error?

2006-05-26 Thread [EMAIL PROTECTED]
Looks like an error. I didn't see it the errata: http://www.oreilly.com/catalog/lpython2/errata/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Running Python scripts under a different user

2006-05-26 Thread Bernard Lebel
On 5/26/06, Laszlo Nagy <[EMAIL PROTECTED]> wrote: > For Windows, you can use the 'runas.exe' program. But it requires a > password too. > > From what you wrote, I think that you need to change architecture. You > should write your own service rather than write tricky programs. This > way you can

Re: Running Python scripts under a different user

2006-05-26 Thread Bernard Lebel
On 5/26/06, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > And as you refrain form telling us which OS you are running under [Bernard] The network file server is Red Hat Enterprise 4. The user workstation run through MS Windows XP Pro 32bit SP2, accessing the file server through Samba. one > can

Re: PIL problem with biprocessor hardware

2006-05-26 Thread [EMAIL PROTECTED]
> If this application work on a PC mono-processor, I don't have any >problems. >If this application work instead on a PC bi-processor, the process >elaborates an image "corrupted": Sounds like you've got some thread synch issue. On a mono-processor system, your threads are running serially, but on

Re: OLAP and pivot tables

2006-05-26 Thread Duncan Smith
George Sakkis wrote: > After a brief search, I didn't find any python package related to OLAP > and pivot tables. Did I miss anything ? To be more precise, I'm not so > interested in a full-blown OLAP server with an RDBMS backend, but > rather a pythonic API for constructing datacubes in memory, sl

Re: dict literals vs dict(**kwds)

2006-05-26 Thread George Sakkis
Bruno Desthuilliers wrote: > George Sakkis a écrit : > > The thing is there are four (at least?) ways to get a dict instance: > > > > In [1]: d1={'name':'mike', 'age':23} > > > > In [2]: d2=dict(d1) > > > > In [3]: d3=dict(**d1) > > > > In [4]: d4=dict(d1.items()) > > > > In [5]: d1==d2==d3==d4 >

Re: Software Needs Philosophers

2006-05-26 Thread Roedy Green
On 21 May 2006 02:15:31 -0700, "Xah Lee" <[EMAIL PROTECTED]> wrote, quoted or indirectly quoted someone who said : >FACT: Java has no first-class functions and no macros. This results in >warped code that hacks around the problem, and as the code base grows, >it takes on a definite, ugly shape, on

Re: __getattr__ and functions that don't exist

2006-05-26 Thread Bruno Desthuilliers
Erik Johnson a écrit : (snip) > I was thinking it would be clean to maintain an interface where you > could call things like f.set_Spam('ham') and implement that as self.Spam = > 'ham' If all you want to do is to assign 'ham' to self.spam, just do it - no need for a setter. And if you worry

Re: how to clear up a List in python?

2006-05-26 Thread chris brat
Doesnt this do what the original poster is try accomplish? Linnorms example - >>> list1 = [0,1,2,3] >>> list1 [0, 1, 2, 3] >>> list1 = [] >>> list1 [] >>> -- http://mail.python.org/mailman/listinfo/python-list

PIL problem with biprocessor hardware

2006-05-26 Thread mardif
Hi guys, I've a problem, but very big! So, i have a python/PIL application that manipulate images ( rotate, crop, save, etc etc ). If this application work on a PC mono-processor, I don't have any problems. If this application work instead on a PC bi-processor, the process elaborates an image "cor

Tkinter canvas zooming (sortof)

2006-05-26 Thread Bob Greschke
I have a program that sucks in a list of equipment positions (Lats/Longs), opens a Toplevel frame with a canvas set to, for example, 700x480 pixels, and then does all of the calculations and plots the objects with 10-pixel wide ovals and rectangles. Now I want to zoom in (or out), but I don't w

Re: how to clear up a List in python?

2006-05-26 Thread Mel Wilson
[EMAIL PROTECTED] wrote: > The original post only mentions deleting the values in the list, not > the list itself. Given that you want to keep the list and just ditch > the values it contains I'd go with: > > list1 = [] Depends what you mean by "keep the list". Consider class C (object):

Re: OT: Quote ? [was: John Bokma harassment]

2006-05-26 Thread John Bokma
"Chris Uppal" <[EMAIL PROTECTED]> wrote: > [apologies to the whole flaming crowd for sending this to the whole > flaming crowd...] > > Geoffrey Summerhayes wrote: > >> After you kill Navarth, will it be nothing but gruff and deedle >> with a little wobbly to fill in the chinks? > > Where does t

  1   2   >