Re: strings for beginers

2009-03-07 Thread Tim Wintle
On Sat, 2009-03-07 at 12:53 -0800, Sapote wrote: > I have an incrementing variable disc_num that I could insert in the > line below to create discspanisoX.iso where X is incrementing... > > burn_cmd = "mkisofs -udf -o /home/donkey/discspaniso.iso -graft- > points --path-list %s" %(temp_list)

Re: Can Python do shopping cart?

2009-03-06 Thread Tim Wintle
d a wrapper to files on disk - then it's just your OS's limits that hold it back - so python is turing/register complete. Tim Wintle -- http://mail.python.org/mailman/listinfo/python-list

Re: Roulette wheel

2009-03-04 Thread Tim Wintle
On Wed, 2009-03-04 at 18:02 +, mattia wrote: > ri = randint(0, len(rw) - 1) > print("Random index:", rw[ri], ", value:", pop[rw[ri]]) you probably want random.choice(rw) -- http://mail.python.org/mailman/listinfo/python-list

Re: Pickle Problem

2009-03-03 Thread Tim Wintle
efines it) Exceptions are just classes, so you'll have to import and reference it like you'd reference any other class you import. Hope that helps Tim Wintle -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to parse a function-call-like string?

2009-02-26 Thread Tim Wintle
On Thu, 2009-02-26 at 21:39 +, Tim Wintle wrote: > On Thu, 2009-02-26 at 21:29 +, m...@pixar.com wrote: > > "junkpkg.f1", ['aaa','with,comma'] oops - missed this one, ignore my last reply. -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to parse a function-call-like string?

2009-02-26 Thread Tim Wintle
ot;, [] > "junkpkg.f1", ['aaa'] > "junkpkg.f1", ['aaa','bbb'] > "junkpkg.f1", ['aaa','bbb','ccc'] > "junkpkg.f1", ['aaa','with,comma'] > quick and dirty for s in string_list: if "(" in s and s[-1] == ")": parts = s.split("(") fn, args = s[0],s[1][:-1].split(",") Tim Wintle -- http://mail.python.org/mailman/listinfo/python-list

Re: Run a python script as an exe and run a new process from it

2009-02-26 Thread Tim Wintle
On Thu, 2009-02-26 at 06:00 -0800, venutaurus...@gmail.com wrote: > Thanks for the reply, >Being a newbie to python, I am finding it difficult to > understand the logic even after thorough reading of comments. Is there > any simpler way where I can just run a python script from the main

Re: Run a python script as an exe and run a new process from it

2009-02-26 Thread Tim Wintle
On Thu, 2009-02-26 at 04:55 -0800, venutaurus...@gmail.com wrote: > Hello all, >I've a strange requirement where I need to run a python > script just as we run an exe (by double clicking through windows > explorer or by typing the script name at command prompt). I don't know how windows

Re: more on unescaping escapes

2009-02-23 Thread Tim Wintle
ngs in the interpreter it includes escape characters, when it is printed though the output is straight to stdout and isn't escaped. Hope that helps, Tim Wintle -- http://mail.python.org/mailman/listinfo/python-list

Re: Challenge: Please break this! [Python Security]

2009-02-23 Thread Tim Wintle
On Mon, 2009-02-23 at 13:20 -0800, Paul McNett wrote: > tav wrote: > > I'm keen to know your experiences even if you don't manage to write to > > the filesystem -- and especially if you do! > > Does it count when it breaks some standard libs that aren't even trying to > write to > the filesystem

Re: Challenge: Please break this! [Python Security]

2009-02-23 Thread Tim Wintle
,"w") f.write("oops") f.close() > Dinner and drinks on me for an evening -- when you are next in London > or I am in your town -- to the first person who manages to break > safelite.py and write to the filesystem. I'm in London on Wednesday ;-) Unfortunately I

Re: Python shell scripting and errors

2009-02-23 Thread Tim Wintle
On Mon, 2009-02-23 at 09:12 -0800, Phillip B Oldham wrote: > I've got a python script running as a daemon (using someone else's > daemon module). It runs fine for a while, but will occasionally balk > and die. Since its running in the background, I'm getting no error > from it. > > What's the best

Re: Forwarding keyword arguments from one function to another

2009-02-22 Thread Tim Wintle
g the parameter "string" as the first parameter, and then a sequence of keyword arguments taken from kwds, which will be passed separately. This is what the second form expects, but not what the first one expects. Tim Wintle -- http://mail.python.org/mailman/listinfo/python-list

Re: code challenge: generate minimal expressions using only digits 1,2,3

2009-02-20 Thread Tim Wintle
On Fri, 2009-02-20 at 16:38 +, Nigel Rantor wrote: > Luke Dunn wrote: That was my initial thought when I read this too - but I'm not certain that is guaranteed to find a solution (i.e. a solution that's optimal). I'd welcome a proof that it will though, a few minutes thought hasn't found a

Re: Will multithreading make python less popular?

2009-02-19 Thread Tim Wintle
mounts of code into my 4mb level-2 cache *on my laptop*! That's a huge impact for numerical work. (3) Multiple cores scale processing power linearly at best with the number of cores (since you're normally going to be IO based at some point). Perhaps the GIL will be relaxed a bit, but it&#x

Re: Will multithreading make python less popular?

2009-02-19 Thread Tim Wintle
e in Python. Yes, we're coming to a point where we're going to have tens of cores in a chip, but by that time someone far cleverer than me (possibly someone who's on this list) will have solved that problem. The top experts in many fields use Python, and if they weren'

Re: os.fdopen giving "Invalid Argument" from pipes

2009-02-19 Thread Tim Wintle
On Thu, 2009-02-19 at 11:50 -0500, Jean-Paul Calderone wrote: > You got server_send and logger_receive backwards Doh! > (also, i before e *except* after c et cetera). Flip 'em around and > all is well. Thanks - never was great at speling :-) Tim -- http://mail.python.org/mailman/listinfo/pyt

os.fdopen giving "Invalid Argument" from pipes

2009-02-19 Thread Tim Wintle
Was wondering if someone could point out what the stupid thing I'm doing wrong is: {{{ import os, time def run_multi_proc(): server_send, logger_recieve = os.pipe() pid = os.fork() if pid == 0: # we are the logger #os.close(server_send) logger_recieve = os.fdop

Re: Revision Control

2009-02-18 Thread Tim Wintle
On Wed, 2009-02-18 at 09:08 -0800, Sam Clark wrote: > Any suggestions for a beginer on what to use for version control? > It's just me, the lone person programming. I've already nailed one > "version" of my code accidentaly. MS VSS is too expensive for the > stuff I'm doing, plus I really don't l

Re: Searching Google?

2009-02-18 Thread Tim Wintle
On Wed, 2009-02-18 at 13:36 +0100, Johannes Bauer wrote: > Curt Hash schrieb: > > > You just need to change your User-Agent so that Google doesn't know a > > Python script is making the request: > > Why would Google not send a response if the User-Agent header field is > not a recognized browser?

Re: memory recycling/garbage collecting problem

2009-02-18 Thread Tim Wintle
On Tue, 2009-02-17 at 17:04 +0100, Christian Heimes wrote: > Tim Wintle wrote: > > Basically malloc() and free() are computationally expensive, so Python > > tries to call them as little as possible - but it's quite clever at > > knowing what to do - e.g. if a list ha

Re: memory recycling/garbage collecting problem

2009-02-17 Thread Tim Wintle
On Tue, 2009-02-17 at 00:40 -0800, Chris Rebert wrote: > > > > 'gc.collect()' -- I believe, but I'm not the specialist in it. > > If I understand correctly, that only effects objects that are part of > a reference cycle and doesn't necessarily force the freed memory to be > released to the OS. I

Re: Speedup Bitmap Parser

2009-02-17 Thread Tim Wintle
on is often better left to C (or compiled extensions to python in Cython etc.) than done in Python - it's just too tough to do pointer-magic in Python. You may find that so much time is being spent by your application in the ".create_line" method that there's no other opti

Re: Module to read/write MIDI ?

2009-02-16 Thread Tim Wintle
> I had my first look around pypi.python.org/pypi yesterday and didn't > see anything. Is there a MIDI-module for Python ? If not, I'll > email Sean to ask if he'd mind me translating his module into Python3... This is the only project I have seen

Re: thread. question

2009-02-13 Thread Tim Wintle
On Mon, 2009-02-09 at 21:02 +0100, Christian Heimes wrote: > The module was renamed to _thread to stop people from using it directly. > The extension module is the interface to some low level types and > functions. Especially the usage of thread.start_new_thread is > problematic, since it bypasses

Re: thread. question

2009-02-09 Thread Tim Wintle
Thanks for both replies, On Mon, 2009-02-09 at 15:59 +0100, Christian Heimes wrote: > You shouldn't use the thread module directly. It's not meant to be used > by a user. Please stick to the threading module. You won't notice a > slowdown, trust me :) I'm aware that thread is being renamed to _thr

thread. question

2009-02-09 Thread Tim Wintle
(assuming they very infrequently block)? Since if you use the thread module direct the code doesn't seem to escape from C during the acquire() etc. or am I missing something important? Thanks, Tim Wintle -- http://mail.python.org/mailman/listinfo/python-list

<    1   2