Re: assignment in if

2006-05-02 Thread Ben Caradoc-Davies
Gary Wessle wrote: > is there a way to make an assignment in the condition of "if" No. > nx = re.compile('regex') > if x = nx.search(text): >funCall(text, x)) Use: nx = re.compile('regex') x = nx.search(text) if x: funCall(text, x) -- B

Re: Strange result with math.atan2()

2006-05-02 Thread Ben Caradoc-Davies
ISO C99 (ISO/IEC 9899:1999). See the manuals of some implementers who tabulate these special values: http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/atan2.3.html http://www.ugcs.caltech.edu/manuals/libs/mpfr-2.2.0/mpfr_22.html -- Ben Caradoc-Davies <[EMAIL PROTECTED]&

Re: __slots__

2006-03-25 Thread Ben Caradoc-Davies
do not use these tools? pychecker complains a lot when used on code that is poorly written and includes bad practices such as using builtin function names as local variable names. I consider pychecker's complaints in these cases to be a *feature*. -- Ben Caradoc-Davies <[EMAIL PROTECTED]&

Re: anonymous memory mapping

2006-03-20 Thread Ben Caradoc-Davies
are silently unsetting the MAP_SHARED bit and not setting the MAP_PRIVATE bit. Linux wants to know which you want. With Python 2.4 on Linux 2.6, both work: from mmap import mmap, MAP_ANONYMOUS, MAP_SHARED, MAP_PRIVATE m1 = mmap(-1, 1024, MAP_ANONYMOUS|MAP_PRIVATE) # no error m2 = mmap(-1, 1024, MA

Re: How to except the unexpected?

2006-03-03 Thread Ben Caradoc-Davies
James Stroud wrote: > except URLError, HTTPException: Aieee! This catches only URLError and binds the name HTTPException to the detail of that error. You must write except (URLError, HTTPException): to catch both. -- Ben Caradoc-Davies <[EMAIL PROTECTED]> http://wintersun.org/ &

Re: Cut and paste an EPS file

2005-12-02 Thread Ben Caradoc-Davies
ndingBox line in the EPS file. The importing application should honour this when determining the limits ofthe figure. See http://www.cs.indiana.edu/docproject/programming/postscript/eps.html and Google for more. %%BoundingBox coordinates are integers and are in points. -- Ben Carad

Re: Reading IEEE 754 format strings directly into a floating point array

2005-10-14 Thread Ben Caradoc-Davies
so make a format with (for example) ">"+"f"*n, and struct.unpack will return a tuple of length n. For large volumes of data, the array module may be more useful (as someone else has already noted). -- Ben Caradoc-Davies <[EMAIL PROTECTED]> http://wintersun.org/ &