ANN: GMPY 1.11rc1 is available

2009-11-30 Thread casevh
Everyone, I'm pleased to annouce that a new version of GMPY is available. GMPY is a wrapper for the MPIR or GMP multiple-precision arithmetic library. GMPY 1.11rc1 is available for download from: http://code.google.com/p/gmpy/ In addition to support for Python 3.x, there are several new

[ANN] BleachBit 0.7.2

2009-11-30 Thread Andrew Ziem
BleachBit (a pure PyGTK app) deletes traces of online Internet usage and recovers wasted disk space. Highlight of changes since 0.7.1: * Clear Konqueror cache, cookies, and history * Improve notifications (show them less often and for shorter a period of time) * Show system information for

[ANN] pyxser-1.3r --- Python XML Serialization/Deserialization Extension

2009-11-30 Thread Daniel Molina Wegener
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hello Python Community. I'm pleased to announce pyxser-1.3r, a python extension which contains functions to serialize and deserialize Python Objects into XML. It is a model based serializer. Here is the ChangeLog entry for this release: - ---8---

Unpacking Tuples

2009-11-30 Thread Joel Davis
I hate to post such a simple Q and A here, but I seriously can't find it anywhere. Python (unsure of starting with which version) enables the remainder of the tuple to be placed in a catch-all, for example: myTuple = (1,2,3,4) varOne, varTwo, *remaindingTuple = myTuple. where the values left

Re: python and vc numbers

2009-11-30 Thread Daniel Dalton
On Mon, Nov 30, 2009 at 02:21:54PM +1300, Gregory Ewing wrote: I use to figure out what tty my program was invoked from? Here's one way: % python Python 2.5 (r25:51908, Apr 8 2007, 22:22:18) [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin Type help, copyright, credits or

Running function from Win32 dll

2009-11-30 Thread Nadav Chernin
Hi all, I want to run function from win32 dll. I used ctypes.windll.LoadLibrary to load the DLL. But I don't know how to select function and run it. Dll example attached (pylab.dll). It includes 2 functions: double Add(double a,double b) - adds 2 double numbers double

Re: Unpacking Tuples

2009-11-30 Thread Chris Rebert
On Mon, Nov 30, 2009 at 12:17 AM, Joel Davis callmeclaud...@gmail.com wrote: I hate to post such a simple Q and A here, but I seriously can't find it anywhere. Python (unsure of starting with which version) enables the remainder of the tuple to be placed in a catch-all, for example: myTuple

Re: Unpacking Tuples

2009-11-30 Thread Gary Herron
Joel Davis wrote: I hate to post such a simple Q and A here, but I seriously can't find it anywhere. Python (unsure of starting with which version) enables the remainder of the tuple to be placed in a catch-all, for example: myTuple = (1,2,3,4) varOne, varTwo, *remaindingTuple = myTuple.

Running function from win32 dll

2009-11-30 Thread Nadav Chernin
Hi all, I want to run function from win32 dll. I used ctypes.windll.LoadLibrary to load the DLL. But I don't know how to select function and run it. Thank you, Nadav -- http://mail.python.org/mailman/listinfo/python-list

Re: semantics of ** (unexpected/inconsistent?)

2009-11-30 Thread Gregory Ewing
Esmail wrote: Wow .. never heard of Concatenative_languages languages before or the distinction you make. Your distinction explains the behavior, but I find it somewhat counter-intuitive. You shouldn't find it any more surprising than the fact that a = 2 + 3 print a * 5 gives a

Re: Creating a local variable scope.

2009-11-30 Thread markolopa
Hi Steve! On Nov 30, 1:46 am, Steve Howell showel...@yahoo.com wrote: I occasionally make the error you make, but I think the real problem you are having is lack of attention to detail.  If name collisions are a common problem for you, consider writing shorter methods Yes, this could be a

Creating a datetime object from a C Extention

2009-11-30 Thread Gerhard Schmidt
HI, I'm writing a python C Extension and need to create datetime objects but when I call value = PyDateTime_FromDateAndTime(ti-tm_year+1900, ti-tm_mon, ti-tm_mday, ti-tm_hour, ti-tm_min, ti-tm_sec, u); I get an SegFault. ti = {tm_sec = 25, tm_min = 37, tm_hour = 8, tm_mday = 30, tm_mon = 10,

Re: delete column content

2009-11-30 Thread jessica
On 11月30日, 上午2时27分, Diez B. Roggisch de...@nospam.web.de wrote: Francesco Pietra schrieb: Hi: How to replace with blank the single-character in column 21 of a pdb file (in pdb numbering it is column 22). Attached is an incomplete exercise with slices. I am unable to get real plain text

Re: Creating a datetime object from a C Extention

2009-11-30 Thread Martin v. Löwis
I'm writing a python C Extension and need to create datetime objects but when I call value = PyDateTime_FromDateAndTime(ti-tm_year+1900, ti-tm_mon, ti-tm_mday, ti-tm_hour, ti-tm_min, ti-tm_sec, u); I get an SegFault. ti = {tm_sec = 25, tm_min = 37, tm_hour = 8, tm_mday = 30, tm_mon = 10,

Re: Creating a local variable scope.

2009-11-30 Thread markolopa
On Nov 30, 4:46 am, Dave Angel da...@ieee.org wrote: markolopa wrote: Antoher 15 minutes lost because of that Python feature... Is it only me??? Yep, I think so. Not very consoling but thanks anyway!...:-  You're proposing a much more complex scoping rule, where if a variable already

Re: ANN: GMPY 1.11rc1 is available

2009-11-30 Thread Nick Craig-Wood
casevh cas...@gmail.com wrote: I'm pleased to annouce that a new version of GMPY is available. GMPY is a wrapper for the MPIR or GMP multiple-precision arithmetic library. GMPY 1.11rc1 is available for download from: [snip] Future plans On releasing the GIL: I have compared releasing

Re: Creating a local variable scope.

2009-11-30 Thread Lie Ryan
On 11/30/2009 8:13 PM, markolopa wrote: On Nov 30, 4:46 am, Dave Angelda...@ieee.org wrote: markolopa wrote: Antoher 15 minutes lost because of that Python feature... Is it only me??? Yep, I think so. Not very consoling but thanks anyway!...:- You're proposing a much more complex

Re: python and vc numbers

2009-11-30 Thread Daniel Dalton
On Mon, Nov 30, 2009 at 07:20:59PM +1100, Daniel Dalton wrote: That did the trick, thanks, after I append [-2] Further testing under screen says otherwise -- it seems to give me the tty number, not the virtual console number. Is there any way to figure out what virtual console I'm am in so a

Re: Object Not Callable, float?

2009-11-30 Thread Nobody
On Mon, 30 Nov 2009 01:07:53 -0500, Mel wrote: In FORTRAN and PL/I words were un-reserved to a degree that's really bizarre. A short post can't begin to do it justice -- let's just mention that IF and THEN could be variable names, and DO 100 I=1.10 . The syntaxes were carefully crafted

Re: python and vc numbers

2009-11-30 Thread Chris Rebert
On Mon, Nov 30, 2009 at 2:02 AM, Daniel Dalton d.dal...@iinet.net.au wrote: On Mon, Nov 30, 2009 at 07:20:59PM +1100, Daniel Dalton wrote: That did the trick, thanks, after I append [-2] Further testing under screen says otherwise -- it seems to give me the tty number, not the virtual

Re: Creating a local variable scope.

2009-11-30 Thread Dave Angel
markolopa wrote: On Nov 30, 4:46 am, Dave Angel da...@ieee.org wrote: markolopa wrote: Antoher 15 minutes lost because of that Python feature... Is it only me??? Yep, I think so. Not very consoling but thanks anyway!...:- You're proposing a much more complex

Re: Creating a local variable scope.

2009-11-30 Thread Steven D'Aprano
On Mon, 30 Nov 2009 02:11:12 +0100, Alf P. Steinbach wrote: I think if one could somehow declare names as const (final, readonly, whatever) then that would cover the above plus much more. Having real constants is one feature that I miss. Because Python doesn't have constants, I find I've lost

Re: Creating a local variable scope.

2009-11-30 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Mon, 30 Nov 2009 02:11:12 +0100, Alf P. Steinbach wrote: I think if one could somehow declare names as const (final, readonly, whatever) then that would cover the above plus much more. Having real constants is one feature that I miss. Because Python doesn't

Re: python and vc numbers

2009-11-30 Thread Daniel Dalton
On Mon, Nov 30, 2009 at 02:26:14AM -0800, Chris Rebert wrote: Also, in my quickie newbie experimentation with `screen`, each screen window seems to get a unique tty#. Admittedly I am running OS X Correct (Which creates the problem) Perhaps if you could explain your problem in greater detail?

Re: Imitating tail -f

2009-11-30 Thread Paul Boddie
On 22 Nov, 05:10, exar...@twistedmatrix.com wrote: tail -f is implemented by sleeping a little bit and then reading to see if there's anything new. This was the apparent assertion behind the 99 Bottles concurrency example: http://wiki.python.org/moin/Concurrency/99Bottles However, as I

Re: Exec Statement Question

2009-11-30 Thread Victor Subervi
On Sun, Nov 29, 2009 at 10:23 PM, Dave Angel da...@ieee.org wrote: exec is a statement, and statements don't have return values. It's not a function, so there are no parentheses in its syntax, either. exec is also a technique of last resort; there's nearly always a better/safer/faster way

Re: Creating a local variable scope.

2009-11-30 Thread Alf P. Steinbach
* Jean-Michel Pichavant: Steven D'Aprano wrote: On Mon, 30 Nov 2009 02:11:12 +0100, Alf P. Steinbach wrote: I think if one could somehow declare names as const (final, readonly, whatever) then that would cover the above plus much more. Having real constants is one feature that I

Re: semantics of ** (unexpected/inconsistent?)

2009-11-30 Thread inhahe
one point of confusion could be the use of ** instead of superscript. it might make things a little bit more counterintuitive-looking than with superscripts, since the issue with would only apply to exponents, as -5*4 and a = -5 a*4 return the same answer, and superscripts make it a little

FW: IDE+hg

2009-11-30 Thread Dylan Palmboom
From: NiklasRTZ [mailto:nikla...@gmail.com] Sent: 26 November 2009 12:38 PM To: python-list@python.org Subject: Re: IDE+hg On Nov 25, 7:28 am, alex23 wuwe...@gmail.com wrote: NiklasRTZ nikla...@gmail.com wrote: no py IDE I found has easy hg access. ActiveState's Komodo IDE has support for

Brent's variation of a factorization algorithm

2009-11-30 Thread n00m
Maybe someone'll make use of it: def gcd(x, y): if y == 0: return x return gcd(y, x % y) def brent(n): c = 11 y, r, q, m = 1, 1, 1, 137 while 1: x = y for i in range(1, r + 1): y = (y * y + c) % n k = 0 while 1:

Cookie name and expiration

2009-11-30 Thread ShoqulKutlu
Hi, I'm testing the Cookie module's MarshalCookie in mod_python on my localhost environment. Everything looks ok and cookie set, get and update operations work well. But I'm not sure about the cookie name could be set by Cookie module. I mean the name of cookie file saved in the Temporary

Intro To Python Using Turtle Graphics

2009-11-30 Thread Lawrence D'Oliveiro
Done by Northland Polytechnic, available for download under CC-BY-NC-ND here http://www.archive.org/details/IntroductionToPythonUsingTurtleGraphics. Thanks to Colin Jackson for the link. -- http://mail.python.org/mailman/listinfo/python-list

Re: Access to file in Windows Xp

2009-11-30 Thread FelixCatus
On 27 Nov, 12:37, Jon Clements jon...@googlemail.com wrote: On Nov 27, 11:26 am, FelixCatus fram...@gmail.com wrote: Good morning to all, I have written a simple python script that extracts data from a lot (800Mb) of text files. Now... In Linux the extraction runs in more or less 1s in

Re: Can self crush itself?

2009-11-30 Thread n00m
Why would you want to do that in the first place? I don't know... :-) As Schoepenhauer put it: The man can do what he wants to do but he can't want to want what he wants to do -- http://mail.python.org/mailman/listinfo/python-list

Re: Can self crush itself?

2009-11-30 Thread n00m
Ok ok Of course, it's a local name; -- just my silly slip. And seems it belongs to no dict[]... Just an internal volatile elf -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a float to a formatted outside of print command

2009-11-30 Thread stephen_b
On Nov 23, 3:17 pm, Dan Bishop danb...@yahoo.com wrote: You meant: x = '%.1f' % y Thanks, I'm a dufus today. -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature request: String-inferred names

2009-11-30 Thread Bruno Desthuilliers
Lie Ryan a écrit : (snip) setattr, getattr, and delattr are already sugar for accessing instance.__dict__. They are actually much more than that - else descriptors and inheritance wouldn't work. -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature request: String-inferred names

2009-11-30 Thread Ben Finney
Cameron Simpson c...@zip.com.au writes: The Zen promotes the guideline that there should be only one (obvious) way to do most things and that's a surprisingly effective design rule. It's also important to realise that the Zen places the “preferably only one” in a parenthetical, and note that

Re: Feature request: String-inferred names

2009-11-30 Thread The Music Guy
P.S., not trying to start a flame war. It's just that I can't stand to keep silent on the matter any longer. -- Brad Harms -- http://mail.python.org/mailman/listinfo/python-list

Re: Filling in a tuple from unknown size list

2009-11-30 Thread Steven D'Aprano
On Fri, 27 Nov 2009 04:18:08 -0800, boblatest wrote: Here's my question: Given a list of onknown length, I'd like to be able to do the following: (a, b, c, d, e, f) = list If the list has fewer items than the tuple, I'd like the remaining tuple elements to be set to None. If the list is

reading from a text file

2009-11-30 Thread baboucarr sanneh
hi all i would like to create a python program that would read from a text file and returns one result at random. e.g in the text file i have these data 1.hello 2.my name 3.is 4.World Your help is highly appreciated..thnx in advance $LIM $...@dy

Re: Filling in a tuple from unknown size list

2009-11-30 Thread John Machin
On Nov 27, 11:18 pm, boblatest boblat...@googlemail.com wrote: Hello all, (sorry for posting from Google. I currently don't have access to my normal nntp account.) Here's my question: Given a list of onknown length, I'd like to be able to do the following: (a, b, c, d, e, f) = list If

Re: Go versus Brand X

2009-11-30 Thread J Kenneth King
a...@pythoncraft.com (Aahz) writes: Comparing Go to another computer language -- do you recognize it? http://www.cowlark.com/2009-11-15-go/ If you skip to the conclusion, you'll be better off. The author has an interesting point. Go (the language) is not really ground-breaking. I don't

Re: Go versus Brand X

2009-11-30 Thread Lie Ryan
J Kenneth King wrote: a...@pythoncraft.com (Aahz) writes: Comparing Go to another computer language -- do you recognize it? http://www.cowlark.com/2009-11-15-go/ If you skip to the conclusion, you'll be better off. The author has an interesting point. Go (the language) is not really

Re: High-performance Python websites

2009-11-30 Thread ShoqulKutlu
If you need an example one is in front of you and you are using it now. Google uses python at their thousands of servers. But as you see Google gains this performance from the power of hundreds of thousands servers. The main idea behind the Google search engine was indexing the whole web through

Re: How do I correctly download Wikipedia pages?

2009-11-30 Thread Steven D'Aprano
On Wed, 25 Nov 2009 19:58:57 -0800, ShoqulKutlu wrote: Hi, Try not to be caught if you send multiple requests :) Have a look at here: http://wolfprojects.altervista.org/changeua.php Thanks, that seems to work perfectly. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Detect Use of Unassigned(Undefined) Variable(Function)

2009-11-30 Thread Marco Mariani
Jon Clements wrote: pychecker returns test.py:3: No global (o) found for the above, and can be found at http://pychecker.sourceforge.net/ There's also pylint and another one whose name I can't remember... pyflakes. I use that one -- http://mail.python.org/mailman/listinfo/python-list

Re: IDE+hg

2009-11-30 Thread Günther Dietrich
In article qqitt6-ke@spamfence.net, Günther Dietrich gd_use...@spamfence.net wrote: Since no py IDE I found has easy hg access. Obviously, you didn't try Eclipse with PyDev (http://www.pydev.org) and Mercurial Eclipse (http://www.vectrace.com/mercurialeclipse/) plugins. This combination

Re: Python Statements/Keyword Localization

2009-11-30 Thread Marco Mariani
Terry Reedy wrote: A 'pro' argument: Python was designed for learning and is good for that and *is* used in schools down to the elementary level. But kids cannot be expected to know foreign alphabets and words whill still learning their own. I taught myself BASIC at 9 by reading magazines,

Re: Python-URL! - weekly Python news and links (Nov 24)

2009-11-30 Thread Bruno Desthuilliers
Cameron Laird a écrit : Grant Edwards on the best way to get help from this group :) http://groups.google.com/group/comp.lang.python/t/b8a0c32cae495522/21e80ac383745d88?#21e80ac383745d88 This one really deserves a POTM award !-) --

Re: Python-URL! - weekly Python news and links (Nov 24)

2009-11-30 Thread Jon Clements
On Nov 24, 8:21 pm, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: Cameron Laird a écrit :     Grant Edwards on the best way to get help from this group :)         http://groups.google.com/group/comp.lang.python/t/b8a0c32cae495522/21... This one really deserves a

Re: Python3 - encoding issues

2009-11-30 Thread DreiJane
No, sorry, i must correct me. There is a paragraph below on the quoted site. .index is still under Mutable sequence types - but bytes are treated below. -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting: too different times. Why?

2009-11-30 Thread Steven D'Aprano
On Sun, 22 Nov 2009 09:15:57 -0800, n00m wrote: Or take Drips by Eminem. What on earth do the drips mean? When you have a cold or flu, your nose drips. Some sexually transmitted diseases make your genitals drip. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting: too different times. Why?

2009-11-30 Thread n00m
Some sexually transmitted diseases make your genitals drip. I suspected this :-) Eminem is a famous misogynist -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to understand += better

2009-11-30 Thread Roy Smith
In article 4b0a01a...@dnews.tpgi.com.au, Lie Ryan lie.1...@gmail.com wrote: The semantic of the in-place operator is something like: x += y becomes x = x.__iadd__(y) thus foo.bar += baz becomes foo.bar = foo.bar.__iadd__(baz) So the call sequence is, foo.__getattr__('bar') == x

Re: Trying to understand += better

2009-11-30 Thread n00m
The first statement is creating a whole new list; Yes but *imo* not quite exactly so. We can't think of 2 lists as of absolutely independent things. ... x = [[0]] ... id(x) 19330632 ... id(x[0]) 19316608 ... z = x + [3] ... id(z) 19330312 ... id(z[0]) 19316608 ... ... z[0] is x[0] # ? True ...

Re: Trying to understand += better

2009-11-30 Thread Steve Howell
On Nov 22, 8:38 pm, Roy Smith r...@panix.com wrote: In article 4b0a01a...@dnews.tpgi.com.au, Lie Ryan lie.1...@gmail.com wrote: The semantic of the in-place operator is something like: x += y becomes x = x.__iadd__(y) thus foo.bar += baz becomes foo.bar = foo.bar.__iadd__(baz)

Re: TypeError: an integer is required

2009-11-30 Thread Nobody
On Sun, 22 Nov 2009 18:29:25 +, MRAB wrote: os.open(C://Users//lutfi//Documents//te//log.txt , a ) open(C://Users//lutfi//Documents//te//log.txt , a ) Backslashes need to be doubled; forward slashes don't. -- http://mail.python.org/mailman/listinfo/python-list

Re: delete column content

2009-11-30 Thread jessica
On 11月30日, 上午2时12分, Francesco Pietra francesco.pie...@accademialucchese.it wrote: Hi: How to replace with blank the single-character in column 21 of a pdb file (in pdb numbering it is column 22). Attached is an incomplete exercise with slices. I am unable to get real plain text with gmail.

Re: delete column content

2009-11-30 Thread jessica
On 11月30日, 上午2时48分, Vlastimil Brom vlastimil.b...@gmail.com wrote: 2009/11/29 Francesco Pietra francesco.pie...@accademialucchese.it: Hi: How to replace with blank the single-character in column 21 of a pdb file (in pdb numbering it is column 22). Attached is an incomplete exercise with

Re: hex int and string

2009-11-30 Thread 84715...@qq.com
On 11月27日, 下午4时54分, luca72 lucabe...@libero.it wrote: hello i have a problem i have this str = 'D3' and i need to trasform in 0xd3 type int and not type string how i can do this? if i do hex(int(str,16) ) i obtain a string and this is not what i need. thanks Luca p stronga title=sport

Re: hex int and string

2009-11-30 Thread 84715...@qq.com
On 11月27日, 下午6时59分, Marco Mariani ma...@sferacarta.com wrote: Ben Finney wrote: i'm using pyscard I don't know what that is; can you give a link to what you're referring to? Simple story: he has seen the examples with hex literals and didn't know what they were. p stronga title=sport

Re: hex int and string

2009-11-30 Thread jessica
On 11月27日, 下午6时59分, Marco Mariani ma...@sferacarta.com wrote: Ben Finney wrote: i'm using pyscard I don't know what that is; can you give a link to what you're referring to? Simple story: he has seen the examples with hex literals and didn't know what they were. http://www.mbthome.net/

Re: hex int and string

2009-11-30 Thread jessica
On 11月28日, 上午11时41分, 84715...@qq.com 84715...@qq.com wrote: On 11月27日, 下午4时54分, luca72 lucabe...@libero.it wrote: hello i have a problem i have this str = 'D3' and i need to trasform in 0xd3 type int and not type string how i can do this? if i do hex(int(str,16) ) i obtain a

Re: how to format a python source file with tools?

2009-11-30 Thread 84715...@qq.com
On 11月27日, 下午2时40分, 李白,字一日 calid...@gmail.com wrote: or is it possible for large source files? p stronga title=sport jersey href=http://www.jerseysup.com; target=sport jerseysport jersey/a/strong a title=sport jersey href=http://www.sport-jersey.net; target=sport jerseystrongsports jersey

Re: jython and java application

2009-11-30 Thread KB
Kutlu, I already have a first born, else I would name her after you. You are brilliant. That's what it was. Kudos. For future ref for fellow boneheads like me, in Eclipse, under Project properties, Jython Class Path, Add External JAR... Thanks a million! --

Re: jython and java application

2009-11-30 Thread ShoqulKutlu
Welcome a million :) On Nov 26, 5:33 am, KB ke...@nekotaku.com wrote: Kutlu, I already have a first born, else I would name her after you. You are brilliant. That's what it was. Kudos. For future ref for fellow boneheads like me, in Eclipse, under Project properties, Jython Class Path,

Re: need clarification on -0

2009-11-30 Thread Erik Max Francis
moijes12 wrote: I know the value -0 is quite meaningless and makes little sense.But I was just fiddling.I am unable to figure out the below result -0 and True 0 -- (Why is this 0 and not say True or False) -0 and false 0 -0 or True True Could someone please provide me some

Re: need clarification on -0

2009-11-30 Thread moijes12
On Nov 28, 12:55 pm, Erik Max Francis m...@alcyone.com wrote: moijes12 wrote: I know the value -0 is quite meaningless and makes little sense.But I was just fiddling.I am unable to figure out the below result -0 and True 0 -- (Why is this 0 and not say True or False) -0 and

Re: scanning under windows WIA with custom settings (dpi / etc )

2009-11-30 Thread r
On Nov 22, 11:32 am, News123 news...@free.fr wrote: - This script works fine for me under Windows 7, however I'm   unable to   specify additional parameters, like dpi and   color mode. I have found something interesting but have no idea HOW to implement it?? It seems the setting for the

Re: scanning under windows WIA with custom settings (dpi / etc )

2009-11-30 Thread r
more *maybe useful dump? for i in dev.Items: for p in i.Properties: if not p.IsReadOnly: print p.Name, '-', p.Value Color Profile Name - sRGB Color Space Profile Brightness - 0 Contrast - 0 Private Highlight Level - 0 Private Midtone Level - 0

The Strong Relationship between MatLab and MatPlotLib? What One Needs to Know?

2009-11-30 Thread W. eWatson
Although MatPlotLib has plenty of examples, they do not seem to cover the fundamentals like figure. It seems as though in someway this is dependent upon a user's knowledge of MatLab. Is this true, or oes MatPlotLib provide some description of how forming a figure works? --

Trying to understand += better

2009-11-30 Thread Roy Smith
If I've got an object foo, and I execute: foo.bar += baz exactly what happens if foo does not have a 'bar' attribute? It's pretty clear that foo.__getattr__('bar') gets called first, but it's a little murky after that. Assume for the moment that foo.__getattr__ ('bar') returns an object x. I

dbapi2 select where IN (...)

2009-11-30 Thread yota.n...@gmail.com
hello, I couldn't find how the dbapi2 planned to handle the sql IN statement. ex : SELECT * FROM table WHERE num IN (2,3,8,9); I'd be glad to take advantage of the ? mechanism, but what about tuples ! execute(SELECT * FROM table WHERE num IN ?; , ((2,3,8,9),))...fail... what would be the

multiprocessing.connection with ssl

2009-11-30 Thread Xavier
Hello I've hacked multiprocessing.connection (in a basic way) to allow ssl encryption using ssl.wrap_socket. Anybody knows how i can contribute this to main developers? Thanks in advance -- http://mail.python.org/mailman/listinfo/python-list

Completely OT

2009-11-30 Thread Victor Subervi
Hi; I need a recommendation. I want to print out data like this: td bgcolor='blue'a href='???'blue/a/td td bgcolor='red'a href='???'red/a/td and enable the user to select the various colors he wants to add to a list that would populate itself on the same page where the selections are, and then,

Can't print Chinese to HTTP

2009-11-30 Thread Gnarlodious
Hello. The upgrade to Python 3.1 has been disaster so far. I can't figure out how to print Chinese to a browser. If my script is: #!/usr/bin/python print(Content-type:text/html\n\n) print('晉') the Chinese string simply does not print. It works in interactive Terminal no problem, and also

Re: Can't print Chinese to HTTP

2009-11-30 Thread Martin v. Löwis
Gnarlodious wrote: Hello. The upgrade to Python 3.1 has been disaster so far. I can't figure out how to print Chinese to a browser. If my script is: #!/usr/bin/python print(Content-type:text/html\n\n) print('晉') the Chinese string simply does not print. It works in interactive Terminal

flattening and rebuilding a simple list of lists

2009-11-30 Thread Esmail
Hi, I have a list of lists. The number of sublists may vary. The sizes of the sublists may also vary. For instance, here I have a list with 3 sublists of differing sizes. [['a', 'b', 'c'], ['d', 'e'], ['f', 'g', 'h', 'i']] This list will never be any deeper than this one level. What I would

Re: reading from a text file

2009-11-30 Thread Olof Bjarnason
2009/11/27 baboucarr sanneh sanne...@hotmail.com: hi all i would like to create a python program that would read from a text file and returns one result at random. e.g in the text file i have these data 1.hello 2.my name 3.is 4.World Your help is highly appreciated..thnx in advance

Re: reading from a text file

2009-11-30 Thread Simon Brunning
2009/11/27 baboucarr sanneh sanne...@hotmail.com: hi all i would like to create a python program that would read from a text file and returns one result at random. This might be of use: http://code.activestate.com/recipes/426332/#c2 -- Cheers, Simon B. --

Re: how to format a python source file with tools?

2009-11-30 Thread Neil Cerutti
On 2009-11-27, Diez B. Roggisch de...@nospam.web.de wrote: The only thing that migh be automatized after a piece of code is valid is normalization, like de-tabifying or making everything based on 4 space characters indention. No idea if there is something out there that does that. In vim, you

Re: reading from a text file

2009-11-30 Thread Esmail
baboucarr sanneh wrote: i would like to create a python program that would read from a text file and returns one result at random. #!/usr/bin/env python # assuming the file fits into memory, and you are interested in # random lines from random import randrange f = open('data.txt') data =

problem with lambda / closures

2009-11-30 Thread Louis Steinberg
I have run into what seems to be a major bug, but given my short exposure to Python is probably just a feature: running Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin with file foo.py containing: == clip here

Re: flattening and rebuilding a simple list of lists

2009-11-30 Thread Peter Otten
Esmail wrote: Hi, I have a list of lists. The number of sublists may vary. The sizes of the sublists may also vary. For instance, here I have a list with 3 sublists of differing sizes. [['a', 'b', 'c'], ['d', 'e'], ['f', 'g', 'h', 'i']] This list will never be any deeper than this

TDD with nose or py.test

2009-11-30 Thread Lacrima
Hello! I am learning TDD with Python and there is not much information about this topic. Python is shipped with unittest module. That is fine, but I also discovered other libraries: nose and py.test. They promise to make life yet easier for a developer. But I still can't figure out, which

Re: problem with lambda / closures

2009-11-30 Thread Marco Mariani
Louis Steinberg wrote: I have run into what seems to be a major bug, but given my short exposure to Python is probably just a feature: Yes, it works as advertised :-/ which I would expect. Can anyone explain this or give me a workaround? like this? def p(d): print d l=[ ] for

Re: problem with lambda / closures

2009-11-30 Thread Duncan Booth
Louis Steinberg l...@cs.rutgers.edu wrote: == clip here def p(d): print d l=[ ] for k in [1,2,3]: l.append(lambda : p(k)) for f in l: f() == clip here I get output 3 3 3 instead of

Re: flattening and rebuilding a simple list of lists

2009-11-30 Thread Neil Cerutti
On 2009-11-30, Esmail ebo...@hotmail.com wrote: I have a list of lists. The number of sublists may vary. The sizes of the sublists may also vary. For instance, here I have a list with 3 sublists of differing sizes. [['a', 'b', 'c'], ['d', 'e'], ['f', 'g', 'h', 'i']] This list will never

Re: python logging filters

2009-11-30 Thread Vinay Sajip
On Nov 30, 6:52 am, Grimsqueaker grimsqueake...@gmail.com wrote: So would I be correct in saying that Filters apply only the the object they are attached to and have no effect on how messages are propagated through thelogginghierarchy? If this is the case my next question would be: How can I

Re: Imitating tail -f

2009-11-30 Thread exarkun
On 11:15 am, p...@boddie.org.uk wrote: On 22 Nov, 05:10, exar...@twistedmatrix.com wrote: tail -f is implemented by sleeping a little bit and then reading to see if there's anything new. This was the apparent assertion behind the 99 Bottles concurrency example:

Re: how to format a python source file with tools?

2009-11-30 Thread gil_johnson
On Nov 27, 9:58 am, Diez B. Roggisch de...@nospam.web.de wrote: [...] so i would like to have a tool to intelligently format the code for me and make the code more beautiful and automated. This is not possible. Consider the following situation: [...] Both are semantically radically

Re: * for generic unpacking and not just for arguments?

2009-11-30 Thread Steven D'Aprano
On Sun, 29 Nov 2009 13:45:18 -0600, Tim Chase wrote: The feature is available in Python 3.x: a, b, *c = 1, 2, 3, 4, 5 a, b, c (1, 2, [3, 4, 5]) a, *b, c = 1, 2, 3, 4, 5 a, b, c (1, [2, 3, 4], 5) This is a nice feature of 3.x but I'm disappointed (especially in light of the move to

Re: problem with lambda / closures

2009-11-30 Thread Louis Steinberg
I figured out the answer to my own query. In the original example (see below), there was only one binding for k, which was shared by all the closures, so they all saw the same value. Consider: def fie2(k): return lambda: fie3(k) def fie3(m): print m def fie1(j): return

Re: dbapi2 select where IN (...)

2009-11-30 Thread Gerhard Häring
yota.n...@gmail.com wrote: hello, I couldn't find how the dbapi2 planned to handle the sql IN statement. ex : SELECT * FROM table WHERE num IN (2,3,8,9); I'd be glad to take advantage of the ? mechanism, but what about tuples ! execute(SELECT * FROM table WHERE num IN ?; ,

Re: Exec Statement Question

2009-11-30 Thread Jean-Michel Pichavant
Victor Subervi wrote: if which == '': i = 0 all = '' while i len(meanings): table = '%s\n' % meanings[i] table += table\n tr\n td colspan='8' align='center'%s/td\n /tr % names[i] j = 0 for elt in code: if (j + 8) % 8 == 0: table += '

Re: reading from a text file

2009-11-30 Thread Tim Golden
Olof Bjarnason wrote: 2009/11/27 baboucarr sanneh sanne...@hotmail.com: hi all i would like to create a python program that would read from a text file and returns one result at random. e.g in the text file i have these data 1.hello 2.my name 3.is 4.World Your help is highly

Re: dbapi2 select where IN (...)

2009-11-30 Thread Duncan Booth
Gerhard Häring g...@ghaering.de wrote: execute(SELECT * FROM table WHERE num IN ?; , ((2,3,8,9),))...fail... [...] You cannot use parameter binding when the number of parameters is unknown in advance. So you'll have to create this part of the SQL query differently. For example:

Re: problem with lambda / closures

2009-11-30 Thread Benjamin Kaplan
On Monday, November 30, 2009, Louis Steinberg l...@cs.rutgers.edu wrote: I have run into what seems to be a major bug, but given my short exposure to Python is probably just a feature: running Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin

pywintypes error

2009-11-30 Thread koranthala
Hi, When I try to use Django with Apache and mod_python, I am facing an issue. Since this is a very usual configuration, I hope this issue is already solved. My web sites fail with the following error : C:\\Python24\\Lib\\site-packages\\win32\\lib\\pywintypes.py, line 124, in?\n

  1   2   3   >