Russell Warren:
> I'm actually running both... but I would think that once os.remove
> returns that the file is actually gone from the hdd. Why would either
> application be blocking access to a non-existent file?
Does it actually tell you the target is the problem? I see an
"OSError: [Errn
How about write mode? Changing r to w doesn't work...
[EMAIL PROTECTED] wrote:
> manuhack wrote:
> > I copied the lines
> >
> > f=open('/tmp/workfile', 'w')
> > print f
> > f.close()
> >
> > from Python 2.4 Documentation 7.2. But it said IOerror No such file or
> > directory" '/tmp/workfile'
> >
manuhack wrote:
> I copied the lines
>
> f=open('/tmp/workfile', 'w')
> print f
> f.close()
>
> from Python 2.4 Documentation 7.2. But it said IOerror No such file or
> directory" '/tmp/workfile'
>
> Is it something about the os? I'm using Python 2.4 under WinXP.
> Thanks. Without / I can open
HI,
I'm having trouble writing to a MySql db using python and the MySQLdb
module. Here is the code:
import MySQLdb
base = MySQLdb.connect(host="localhost", user="blah", passwd="blah",
db="test_py")
cursor = base.cursor()
cursor.execute("INSERT INTO table (field) VALUES (int)")
this does not work
"Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote:
8<
| point). Its not only important that the threads die, but that they die
| with grace. There's lots of cleanup work that has to be done when
| things exit or things end up in an
I copied the lines
f=open('/tmp/workfile', 'w')
print f
f.close()
from Python 2.4 Documentation 7.2. But it said IOerror No such file or
directory" '/tmp/workfile'
Is it something about the os? I'm using Python 2.4 under WinXP.
Thanks. Without / I can open it.
--
http://mail.python.org/mail
Paddy wrote:
> Hi,
> I am trying to work out why I get UnboundLocalError when accessing an
> int from a function where the int is at the global scope, without
> explicitly declaring it as global but not when accessing a list in
> similar circumstances.
>
> The documentation: http://docs.python.org
Peter Otten wrote:
> [EMAIL PROTECTED] wrote:
> Bound methods are limited to one implicit parameter. What you need is
> partial function application:
>
> >>> def f(a, b, c):
> ... return a + b + c
> ...
> >>> def partial(f, *args):
> ... def g(*more):
> ... return f(*args+more
Hey Steve,
Yes, I agree with you. The lack of checking can get confusing fast.
It's not about typing without errors. Regardless of how you train as
long as you're human you WILL make typos.
Also having to check whether a name has already existed can be a major
pain in the butt with Python. With J
Carl Banks wrote:
> Greg Ewing wrote:
> > The characters come out slightly
> > higglety-pigglety -- randomly displaced up or down
> > a pixel or so from the baseline.
> It would depend on how you're displaying them, I would think.
I've seen the same thing happen two different ways:
* Rendering wi
Sybren Stuvel wrote:
>
> Steve Jobless enlightened us with:
> > The first case can be just a typo, like:
> >
> > x.valeu = 5
> >
> > I make typos all the time. Without a spell checker, this message
> > would be unreadable :).
>
> Then learn to read what you type, as you type it. Typing without
> >
> > >>> print "%10.3f" % 1.2345# seems like a bug
> >
> > 1.234
> >
> > the first one, print knows enough to recognize and print it as 1.2345.
> > however, in the second line, when it is round off, it doesn't know it
> > is 1.2345 any more.
That is because it isn't 1.2345 anymore. 1.2
Gerhard Fiedler wrote:
> Carl J. Van Arsdall wrote:
> > Well, I guess I'm thinking of an event driven mechanism, kinda like
> > setting up signal handlers. I don't necessarily know how it works under
> > the hood, but I don't poll for a signal. I setup a handler, when the
> > signal comes, if it
On Wed, 2006-07-26 at 20:18 -0700, John Machin wrote:
> [EMAIL PROTECTED] wrote:
> > I know this is a trivial function, and I've now spent more time
> > searching for a surely-already-reinvented wheel than it would take to
> > reinvent it again, but just in case... is there a published,
> > open-so
[EMAIL PROTECTED] wrote:
> I know this is a trivial function, and I've now spent more time
> searching for a surely-already-reinvented wheel than it would take to
> reinvent it again, but just in case... is there a published,
> open-source, function out there that takes a string in the form of
> "h
Carl J. Van Arsdall wrote:
> Alright, based a on discussion on this mailing list, I've started to
> wonder, why use threads vs processes.
In many cases, you don't have a choice. If your Python program
is to run other programs, the others get their own processes.
There's no threads option on that.
On 2006-07-26 21:38:06, Carl J. Van Arsdall wrote:
>>> Also, threading's condition and event constructs are used a lot
>>> (i talk about it somewhere in that thing I wrote). They are easy to use
>>> and nice and ready for me, with a server wouldn't I have to have things
>>> poll/wait for messa
John Henry wrote:
>
>>Carl,
>> OS writers provide much more tools for debugging, tracing, changing
>>the priority of, sand-boxing processes than threads (in general) It
>>*should* be easier to get a process based solution up and running
>>andhave it be more robust, when compared to a threaded sol
Paul McGuire wrote:
> Comparitive timing of pyparsing vs. re comes in at about 2ms for pyparsing,
> vs. 0.13 for re's, so about 15x faster for re's. If psyco is used (and we
> skip the first call, which incurs all the compiling overhead), the speed
> difference drops to about 7-10x. I did try com
I know this is a trivial function, and I've now spent more time
searching for a surely-already-reinvented wheel than it would take to
reinvent it again, but just in case... is there a published,
open-source, function out there that takes a string in the form of
"hh:mm:ss" (where hh is 00-23, mm is
Greg Ewing wrote:
> Whenever I try to use the FreeSans font with SDL,
> either through PyGame or Soya, I get disappointing
> results. The characters come out slightly
> higglety-pigglety -- randomly displaced up or down
> a pixel or so from the baseline.
>
> Something about the calculation of the
Patch / Bug Summary
___
Patches : 401 open ( +3) / 3342 closed ( +8) / 3743 total (+11)
Bugs: 896 open ( -8) / 6035 closed (+24) / 6931 total (+16)
RFE : 224 open ( +2) / 233 closed ( +2) / 457 total ( +4)
New / Reopened Patches
__
pkgutil.w
>> >>> r = re.compile(r'(?:\([^\)]*\)|\[[^\]]*\]|\S)+')
>> >>> r.findall(s)
>>['(a c)b(c d)', 'e']
>
> Ah, it's exactly what I want! I thought the left and right
> sides of "|" are equal, but it is not true.
In theory, they *should* be equal. I was baffled by the nonparity
of the situation. Yo
Hi all,
ive been trying to create a thumbnail using the ffmpeg converter
running the ffmpeg.exe using the subprocess module with the following
code
>>> import subprocess
>>> p = subprocess.Popen(["ffmpeg.exe -i video.mpg", "-f mjpeg -ss 5 -vframes
>>> 1 -s 160x120 -an video.gif"], shell=True, s
[EMAIL PROTECTED] wrote:
> I do understand (and verified) that if I define f2 within f1, it works
> as expected. But in the "learning pyton 2nd edition" at page 205 it is
> said that "Programs are much simpler if you do not nest defs within
> defs" (juste before the code mentioned in my initial me
Whenever I try to use the FreeSans font with SDL,
either through PyGame or Soya, I get disappointing
results. The characters come out slightly
higglety-pigglety -- randomly displaced up or down
a pixel or so from the baseline.
Something about the calculation of the font height
seems to be off, too
Bruno Desthuilliers wrote:
> Gerhard Fiedler wrote:
> > On 2006-07-25 04:06:24, Steve Holden wrote:
> >
> >
> >>Dennis Lee Bieber wrote:
> >>
> >>>On Mon, 24 Jul 2006 17:35:50 -0300, Gerhard Fiedler <[EMAIL PROTECTED]>
> >>>declaimed the following in comp.lang.python:
> >>>
> >>>
> It is surpr
[EMAIL PROTECTED] wrote:
> how about the discrepancy between
>
> >>> print 1.2345
>
> 1.2345
>
> >>> print "%10.3f" % 1.2345# seems like a bug
>
> 1.234
>
> the first one, print knows enough to recognize and print it as 1.2345.
> however, in the second line, when it is round off, it doesn
Sybren Stuvel wrote:
> It has nothing to do with the print command, and everything with
> floating point precision. See http://docs.python.org/tut/node16.html
how about the discrepancy between
>>> print 1.2345
1.2345
>>> print "%10.3f" % 1.2345# seems like a bug
1.234
the first one
Thank you all for the replies, i now have a better solution.
Cheers
--
http://mail.python.org/mailman/listinfo/python-list
Gerhard Fiedler wrote:
> On 2006-07-26 19:08:44, Carl J. Van Arsdall wrote:
>
>
>> Also, threading's condition and event constructs are used a lot
>> (i talk about it somewhere in that thing I wrote). They are easy to use
>> and nice and ready for me, with a server wouldn't I have to have thi
On 2006-07-26 19:08:44, Carl J. Van Arsdall wrote:
> Also, threading's condition and event constructs are used a lot
> (i talk about it somewhere in that thing I wrote). They are easy to use
> and nice and ready for me, with a server wouldn't I have to have things
> poll/wait for messages?
Ho
Simon Forman wrote:
>
> Do ','.join(clean) to make a single string with commas between the
> items in the set. (If the items aren't all strings, you'll need to
> convert them to strings first.)
>
And if the items themselves could contain commas, or quote characters,
you might like to look at the
[EMAIL PROTECTED] wrote:
> Hello,
>
> I have some lists for which I need to remove duplicates. I found the
> sets.Sets() module which does exactly this
I think you mean that you found the sets.Set() constructor in the set
module.
If you are using Python 2.4, use the built-in set() function instead
On 2006-07-26 21:02:59, John Henry wrote:
> Granted. Threaded program forces you to think and design your
> application much more carefully (to avoid race conditions, dead-locks,
> ...) but there is nothing inherently *non-robust* about threaded
> applications.
You just need to make sure that ev
[EMAIL PROTECTED] wrote:
> Hello,
>
> I have some lists for which I need to remove duplicates. I found the
> sets.Sets() module which does exactly this, but how do I get the set
> back out again?
>
> # existing input: A,B,B,C,D
> # desired result: A,B,C,D
>
> import sets
> dupes = ['A','B','B','C'
Jaroslaw Zabiello wrote:
> >> Ruby
> >> has nice security system (private, protected, public scopes for methods and
> >> attributes,
> >
> > This is not "security", this is data-hiding.
>
> No. Data hiding are in Python. Ruby uses security similiar to Java. If the
> class has method marked as priva
>
> Carl,
> OS writers provide much more tools for debugging, tracing, changing
> the priority of, sand-boxing processes than threads (in general) It
> *should* be easier to get a process based solution up and running
> andhave it be more robust, when compared to a threaded solution.
>
> - Paddy
The write accepts strings only, so you may do:
out.write( repr(list(clean)) )
Notes:
- If you need the strings in a nice order, you may sort them before
saving them:
out.write( repr(sorted(clean)) )
- If you need them in the original order you need a stable method, you
can extract the relevant co
Michael Yanowitz wrote:
> Hello:
>
> For some reason I can't figure out how to split
> a 4-byte (for instance) float number (such as 3.14159265359)
> into its 4-bytes so I can send it via a socket to another
> computer.
> For integers, it is easy, I can get the 4 bytes by anding like:
> byte1
Hello,
I have some lists for which I need to remove duplicates. I found the
sets.Sets() module which does exactly this, but how do I get the set
back out again?
# existing input: A,B,B,C,D
# desired result: A,B,C,D
import sets
dupes = ['A','B','B','C','D']
clean = sets.Set(dupes)
out = open('cl
thebjorn wrote:
> John Machin wrote:
> > thebjorn wrote:
> [...]
> > >
> > > def age(born):
> > > now = date.today()
> > > birthday = date(now.year, born.month, born.day)
> >
> > Bad luck if the punter was born on 29 Feb and the current year is not a
> > leap year.
>
> Good catch! Tha
[EMAIL PROTECTED] writes:
> > Have you looked at POSH yet? http://poshmodule.sf.net
>
> Paul, have you used POSH? Does it work well? Any major gotchas?
I haven't used it. I've been wanting to try. I've heard it works ok
in Linux but I've heard of problems with it under Solaris.
Now that I un
Paddy wrote:
> Pierre Thibault wrote:
> > Hello!
> >
> > I am currently trying to port a C++ code to python, and I think I am stuck
> > because of the very different behavior of STL iterators vs python
> > iterators. What I need to do is a simple arithmetic operations on objects
> > I don't know.
On 2006-07-26 17:33:19, Carl J. Van Arsdall wrote:
> Alright, if you read all that, thanks, and thanks for your input. Whether
> or not I've agreed with anything, me and a few colleagues definitely
> discuss each idea as its passed to us. For that, thanks to the python
> list!
I think you should
> Are you running a background file accessing tool like Google Desktop
> Search or an anti-virus application? If so, try turning them off as a test.
I'm actually running both... but I would think that once os.remove
returns that the file is actually gone from the hdd. Why would either
applica
Hi Folks,
Just before I write a script, I want to see if anyone has beaten me to
it as it seems a common scenario :-)
I want a script ot copy files and folders from say C: to Z: but only
copy files that are writable (i.e. Read Only flag not set).
xcopy has let me down :-(
Thanks,
Davy Mitchell
Jaroslaw Zabiello <[EMAIL PROTECTED]> writes:
> On Mon, 24 Jul 2006 14:23:21 +0200, Sybren Stuvel wrote:
>
> > Another reason for me not to use Ruby, is that there is no distinction
> > between those two lines of code:
> >
> > x = somefunc
> > x = somefunc()
>
> It has no meaning. Just use alwa
Jaroslaw Zabiello wrote:
> On Wed, 26 Jul 2006 18:20:44 +0200, Bruno Desthuilliers wrote:
[Quoting JZ...]
> >> Ruby
> >> has nice security system (private, protected, public scopes for methods and
> >> attributes,
> >
> > This is not "security", this is data-hiding.
>
> No. Data hiding are in Pyt
Hi.
The webpage you need to parse is not very wellformed (I think), but
no problem. perhaps the best option is to locate the portion of HTML yo
want, in this case from "Actual Pitching
Statistics " to "". Between this you have a few entries
like this one: " 19 http://www.baseballprospectus.com/d
Pierre Thibault wrote:
> Hello!
>
> I am currently trying to port a C++ code to python, and I think I am stuck
> because of the very different behavior of STL iterators vs python
> iterators. What I need to do is a simple arithmetic operations on objects
> I don't know. In C++, the method doing th
Joe Knapka <[EMAIL PROTECTED]> writes:
> John J. Lee wrote:
>
> > The fact that "open classes" are apparently thought to be a good thing
> > in Ruby puzzles (and worries) me.
>
> This objection strikes me as having the same
> nature as, "Python's lack of strong protection for
> class members puz
Russell Warren:
> I've been having a hard time tracking down a very intermittent problem
> where I get a "permission denied" error when trying to rename a file to
> something that has just been deleted (on win32).
Are you running a background file accessing tool like Google Desktop
Search or
On 2006-07-26 17:50:43, thebjorn wrote:
> I don't agree that the irregular sized months cause a problem in this
> case. They do cause a problem if you're asking "when is today + one
> month?", i.e. there isn't an unambiguous answer to that question in
> general (e.g. if today was January 31). We'r
Peter TB Brett wrote:
> Although the PyQt documentation indicates that QGLWidget & friends have
> been ported to Python for the PyQt bindings, I'm not entirely sure what's
> necessary to make the normal OpenGL/GLUT interface available.
>
> Does PyQt work okay with PyOpenGL? Or is a more complicat
Simon Forman schrieb:
> Wolfgang wrote:
>> Hi Simon,
>>
>> I did not know that library! I'm still new to python and I still have
>> problems to find the right commands.
>
> Welcome. : ) Python comes with "batteries included". I'm always
> finding cool new modules myself, and I've been using it f
Carl J. Van Arsdall wrote:
> Alright, based a on discussion on this mailing list, I've started to
> wonder, why use threads vs processes. So, If I have a system that has a
> large area of shared memory, which would be better? I've been leaning
> towards threads, I'm going to say why.
>
> Process
Hi folks,
Although the PyQt documentation indicates that QGLWidget & friends have
been ported to Python for the PyQt bindings, I'm not entirely sure what's
necessary to make the normal OpenGL/GLUT interface available.
Does PyQt work okay with PyOpenGL? Or is a more complicated workaround
needed
Oops - minor correction... xmlrpclib is fine (I think/hope). It is
SimpleXMLRPCServer that currently has issues. It uses
thread-unfriendly sys.exc_value and sys.exc_type... this is being
corrected.
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin wrote:
> "Carl J. Van Arsdall" <[EMAIL PROTECTED]> writes:
>
>> Processes seem fairly expensive from my research so far. Each fork
>> copies the entire contents of memory into the new process.
>>
>
> No, you get two processes whose address spaces get the data. It's
> done with
Paul Rubin wrote:
> "Carl J. Van Arsdall" <[EMAIL PROTECTED]> writes:
>
>> Alright, so manually running builds is going to be crazy and
>> unmanageable. So what the people who came before me did to manage
>> this scenario was to fork on thread per build. The threads invoke a
>> series of calls
Hello,
I am doing some extreme use of optparse, that is, extending it as explained
on
http://docs.python.org/lib/optparse-other-reasons-to-extend-optparse.html
I have subclassed OptionParser and Option. MyOptionParser uses MyOption as
option_class and in Python 2.4 it works. But I have to target Py
On Wed, 26 Jul 2006 09:08:55 -0400, Brett g Porter <[EMAIL PROTECTED]>
wrote:
Brett,
Thanks a bunch for the explanation!
Regards,
squid.
--
http://mail.python.org/mailman/listinfo/python-list
> Another issue is the libraries you use. A lot of them aren't
> thread safe. So you need to watch out.
This is something I have a streak of paranoia about (after discovering
that the current xmlrpclib has some thread safety issues). Is there a
list maintained anywhere of the modules that are are
Ah, I had just made the same change!
from pyparsing import *
wrd = Word(alphas)
parenList = "(" + SkipTo(")") + ")"
brackList = "[" + SkipTo("]") + "]"
listExpr = ZeroOrMore( Combine( OneOrMore( parenList | brackList | wrd ) ) )
t = "a (b c) d [e f g] h i(j k) l [m n o]p q r[s] (t u)v(w) (x)(y)
I've been having a hard time tracking down a very intermittent problem
where I get a "permission denied" error when trying to rename a file to
something that has just been deleted (on win32).
The code snippet that gets repeatedly called is here:
...
if os.path.exists(oldPath):
os.remove(o
Paul Rubin wrote:
> Have you looked at POSH yet? http://poshmodule.sf.net
Paul, have you used POSH? Does it work well? Any major
gotchas?
I looked at the paper... well, not all 200+ pages, but I checked
how they handle a couple parts that I thought hard and they
seem to have good ideas. I didn
bruce wrote:
>
[Quoting "david"...]
> > I am trying to automate navigating to urls (all from a txt file) 1 at a time
> > in Firefox and then killing firefox before navigating to the next. I think I
> > might have to use PyXPCOM to do this but I have never used this package and
> > cannot find any
"Tim Chase" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm sure there's a *much* more elegant pyparsing solution to
> this, but I don't have the pyparsing module on this machine.
> It's much better/clearer and will be far more readable when
> you come back to it later.
>
> Howeve
Tim Chase wrote:
> Ah...the picture is becoming a little more clear:
>
> >>> r = re.compile(r'(?:\([^\)]*\)|\[[^\]]*\]|\S)+')
> >>> r.findall(s)
> ['(a c)b(c d)', 'e']
>
> It also works on my original test data, and is a cleaner regexp
> than the original.
>
> The clearer the problem, the clearer
Simon Forman wrote:
> What are the desired results in cases like this:
>
> "(a b)[c d]" or "(a b)(c d)" ?
["(a b)[c d]"], ["(a b)(c d)"]
--
http://mail.python.org/mailman/listinfo/python-list
Qiangning Hong wrote:
> Tim Chase wrote:
> > >>> import re
> > >>> s ='a (b c) d [e f g] h ia abcd(b c)xyz d [e f g] h i'
> > >>> r = re.compile(r'(?:\S*(?:\([^\)]*\)|\[[^\]]*\])\S*)|\S+')
> > >>> r.findall(s)
> > ['a', '(b c)', 'd', '[e f g]', 'h', 'ia', 'abcd(b c)xyz', 'd',
> > '[e f g]', 'h
Bruno Desthuilliers wrote:
[...]
> Possible solution:
>
> import mx.DateTime as dt
> def age(date):
> return dt.Age(dt.today(), date).years
> born = dt.Date(1967, 5, 1)
> assert age(born) == 39
dealbreaker:
>>> age(datetime.date(1970,5,2))
Traceback (most recent call last):
File "", line 1,
> but it can't pass this one: "(a c)b(c d) e" the above regex
> gives out ['(a c)b(c', 'd)', 'e'], but the correct one should
> be ['(a c)b(c d)', 'e']
Ah...the picture is becoming a little more clear:
>>> r = re.compile(r'(?:\([^\)]*\)|\[[^\]]*\]|\S)+')
>>> r.findall(s)
['(a c)b(c d)', 'e']
I
John Machin wrote:
> thebjorn wrote:
[...]
> >
> > def age(born):
> > now = date.today()
> > birthday = date(now.year, born.month, born.day)
>
> Bad luck if the punter was born on 29 Feb and the current year is not a
> leap year.
Good catch! Thanks!
[..]
> Holy code bloat, Batman! T
Simon Forman wrote:
> def splitup(s):
> return re.findall('''
> \S*\( [^\)]* \)\S* |
> \S*\[ [^\]]* \]\S* |
> \S+
> ''', s, re.VERBOSE)
Yours is the same as Tim's, it can't handle a word with two or more
brackets pairs, too.
I tried to change the "\S*\([^\)]*
"Carl J. Van Arsdall" <[EMAIL PROTECTED]> writes:
> Alright, so manually running builds is going to be crazy and
> unmanageable. So what the people who came before me did to manage
> this scenario was to fork on thread per build. The threads invoke a
> series of calls that look like
>
> os.syste
HI
Thanks for the help.
I tried that , now getting a different error
>>> test=open("/Volumes/TINTZ;P3/DT Hot Folder
test/Justin_Test.pDF","r")
>>> type(test)
>>> webbrowser.open("file://Volumes/TINTZ;P3/DT Hot Folder
test/Justin_Test.pDF")
Traceback (most recent call last):
File "", l
Tim Chase wrote:
> >>> import re
> >>> s ='a (b c) d [e f g] h ia abcd(b c)xyz d [e f g] h i'
> >>> r = re.compile(r'(?:\S*(?:\([^\)]*\)|\[[^\]]*\])\S*)|\S+')
> >>> r.findall(s)
> ['a', '(b c)', 'd', '[e f g]', 'h', 'ia', 'abcd(b c)xyz', 'd',
> '[e f g]', 'h', 'i']
>
[...]
> However, the above
Qiangning Hong wrote:
> faulkner wrote:
> > re.findall('\([^\)]*\)|\[[^\]]*|\S+', s)
>
> sorry i forgot to give a limitation: if a letter is next to a bracket,
> they should be considered as one word. i.e.:
> "a(b c) d" becomes ["a(b c)", "d"]
> because there is no blank between "a" and "(".
This
> "a (b c) d [e f g] h i"
> should be splitted to
> ["a", "(b c)", "d", "[e f g]", "h", "i"]
>
> As speed is a factor to consider, it's best if there is a
> single line regular expression can handle this. I tried
> this but failed:
> re.split(r"(?![\(\[].*?)\s+(?!.*?[\)\]])", s). It work
Thanks for the answers.
I do understand (and verified) that if I define f2 within f1, it works
as expected. But in the "learning pyton 2nd edition" at page 205 it is
said that "Programs are much simpler if you do not nest defs within
defs" (juste before the code mentioned in my initial message).
"Carl J. Van Arsdall" <[EMAIL PROTECTED]> writes:
> Processes seem fairly expensive from my research so far. Each fork
> copies the entire contents of memory into the new process.
No, you get two processes whose address spaces get the data. It's
done with the virtual memory hardware. The data i
want to take a text file (which has a list of urls) and have my script go through them 1 by one using Firefox.
So for instance, if the first two urls in my list were:
www.google.com
www.amazon.com
I would want to spawn firefox and load www.google.com. Once google loads, I would like to kill
[EMAIL PROTECTED] wrote:
> Carl J. Van Arsdall wrote:
>
>> [EMAIL PROTECTED] wrote:
>>
>>> Carl J. Van Arsdall wrote:
>>>
>>> I don't get what threading and Twisted would to do for
>>> you. The problem you actually have is that you sometimes
>>> need terminate these other process running ot
Could someone please spare a .i file with an example doctest that
works? I tried as follows and it fails:
1) I have an osi.i file that generates osi.py and _osi.so. At the very
end I added:
...
%pythoncode %{
def _test():
import doctest
doctest.testfile('testOsi.txt')
if __name__ == "__ma
Roy Smith wrote:
> "thebjorn" <[EMAIL PROTECTED]> wrote:
>
> > def age(born):
> > now = date.today()
> > birthday = date(now.year, born.month, born.day)
> > return now.year - born.year - (birthday > now and 1 or 0)
>
> I don't get that last line. There's two things in particula
faulkner wrote:
> er,
> ...|\[[^\]]*\]|...
> ^_^
That's why it is nice to use re.VERBOSE:
def splitup(s):
return re.findall('''
\( [^\)]* \) |
\[ [^\]]* \] |
\S+
''', s, re.VERBOSE)
Much less error prone this way
--
- Justin
--
http://mail.python.org/mai
faulkner wrote:
> re.findall('\([^\)]*\)|\[[^\]]*|\S+', s)
sorry i forgot to give a limitation: if a letter is next to a bracket,
they should be considered as one word. i.e.:
"a(b c) d" becomes ["a(b c)", "d"]
because there is no blank between "a" and "(".
--
http://mail.python.org/mailman/listi
er,
...|\[[^\]]*\]|...
^_^
faulkner wrote:
> re.findall('\([^\)]*\)|\[[^\]]*|\S+', s)
>
> Qiangning Hong wrote:
> > I've got some strings to split. They are main words, but some words
> > are inside a pair of brackets and should be considered as one unit. I
> > prefer to use re.split, but haven'
[EMAIL PROTECTED] wrote:
[...]
> def f1() :
> x=88
> f2()
> def f2() :
> print 'x=',x
> f1()
>
> that returns an error saying that "NameError: global name 'x' is not
> defined". I expected f2 to "see" the value of x defined in f1 since it
> is nested at runtime.
Ah, no, Python uses "s
[EMAIL PROTECTED] wrote:
> I have a problem understanding the scope of variable in nested
> function. I think I got it nailed to the following example copied from
> Learning Python 2nd edition page 205. Here is the code.
>
> def f1() :
> x=88
> f2()
> def f2() :
> print 'x=',x
> f1()
re.findall('\([^\)]*\)|\[[^\]]*|\S+', s)
Qiangning Hong wrote:
> I've got some strings to split. They are main words, but some words
> are inside a pair of brackets and should be considered as one unit. I
> prefer to use re.split, but haven't written a working one after hours
> of work.
>
> Exam
[EMAIL PROTECTED] wrote:
> I have a problem understanding the scope of variable in nested
> function. I think I got it nailed to the following example copied from
> Learning Python 2nd edition page 205. Here is the code.
>
> def f1() :
> x=88
> f2()
> def f2() :
> print 'x=',x
> f1()
>
I've got some strings to split. They are main words, but some words
are inside a pair of brackets and should be considered as one unit. I
prefer to use re.split, but haven't written a working one after hours
of work.
Example:
"a (b c) d [e f g] h i"
should be splitted to
["a", "(b c)", "d", "[e
http://cheeseshop.python.org/pypi/functional
learn lisp/scheme!
http://cs.wwc.edu/KU/PR/Scheme.html
Peter Otten wrote:
> [EMAIL PROTECTED] wrote:
>
> > I want to have a bound method that "fixes" more than one parmeter of a
> > funtion. LEt me post an example.
> >
> > def f(a, b, c):
> > retu
I have a problem understanding the scope of variable in nested
function. I think I got it nailed to the following example copied from
Learning Python 2nd edition page 205. Here is the code.
def f1() :
x=88
f2()
def f2() :
print 'x=',x
f1()
that returns an error saying that "NameError:
[EMAIL PROTECTED] wrote:
> Please, confirm me one thing. According to Python documentation for
> Windows the objects .pyd and .dll have the same characteristics. I
> observed that in Python24 it does not produce errors when importing
> xx.dll or xx.pyd, however in python25b2, it only accepts nto im
Michael Yanowitz wrote:
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf
> Of Simon Forman
> Sent: Wednesday, July 26, 2006 2:56 PM
> To: python-list@python.org
> Subject: Re: Splitting a float into bytes:
>
>
> Michael Yanowitz wrote:
> > Hello:
> >
> > F
[EMAIL PROTECTED] wrote:
> I want to have a bound method that "fixes" more than one parmeter of a
> funtion. LEt me post an example.
>
> def f(a, b, c):
> return a + b + c
>
> I can do:
> fplus10 = f(10)
> and then call f with 2 params and it works.
>
> But, how can I fix 2 params:
> fplus1
1 - 100 of 232 matches
Mail list logo