Re: Struct on on x86_64 mac os x

2009-10-21 Thread Mark Tolonen
"Tommy Grav" wrote in message news:d705ab12-0bee-495a-b1e5-c43245e40...@pha.jhu.edu... I have created a binary file that saves this struct from some C code: struct recOneData { char label[3][84]; char constName[400][6]; double timeData[3]; long int numConst;

Re: a simple unicode question

2009-10-21 Thread Scott David Daniels
George Trojan wrote: Scott David Daniels wrote: ... And if you are unsure of the name to use: >>> import unicodedata >>> unicodedata.name(u'\xb0') 'DEGREE SIGN' > Thanks for all suggestions. It took me a while to find out how to > configure my keyboard to be able to type the degree sign. I

Re: how to knock a page out of file cache

2009-10-21 Thread Ishwor Gurung
[...] > I thought of simply opening and writing to the file to dirty it's > pages, but there no guarantee that pdflush will have already written > the dirty pages to disk -pretty sure it depends on all the dirty ratio > and intervals. > > Does anybody know of a system call that will 'knock' the fil

Re: how to knock a page out of file cache

2009-10-21 Thread Ishwor Gurung
[...] > Also, are you looking for sync(2) http://linux.die.net/man/2/sync? Also, maybe mmap.flush([offset, size]) @ http://docs.python.org/library/mmap.html ? Get the file, mmap it and flush it. The docs has more info on flush(...) Afaik, ultimately the kernel will control the writebacks of dirt

Re: help to convert c++ fonction in python

2009-10-21 Thread Processor-Dev1l
On Oct 18, 8:13 am, Toff wrote: > On 18 oct, 02:13, geremy condra wrote: > > > > > On Sat, Oct 17, 2009 at 7:57 PM, David Robinow wrote: > > > On Sat, Oct 17, 2009 at 7:48 PM, geremy condra wrote: > > >> For the love of baby kittens, please, please, please tell me that > > >> you do not believe

Re: Simple audio

2009-10-21 Thread Peter Chant
Simon Forman wrote: > Someone else will probably give you better advice, but have you looked > at pygame? IIRC they have a pretty simple audio playback api. I'm using pygame for something else. Will it work without the graphics side being used? I suppose trying it is the best plan! Pete --

Re: Checking a Number for Palindromic Behavior

2009-10-21 Thread Lie Ryan
ru...@yahoo.com wrote: 1) It may look like a homework problem to you but it probably isn't. Seehttp://groups.google.com/group/comp.lang.python/msg/8ac6db43b09fdc92 Homework comes in many forms - school driven homework should be treated the same as self driven research, IMO. You're not doing it

Re: Struct on on x86_64 mac os x

2009-10-21 Thread Ulrich Eckhardt
Tommy Grav wrote: > I have created a binary file that saves this struct from some C code: > >struct recOneData { > char label[3][84]; > char constName[400][6]; > double timeData[3]; > long int numConst; > double AU; > double EMRAT; > long

md5 strange error

2009-10-21 Thread catalinf...@gmail.com
I have this error , what happen ? Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38) [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import md5 >>> pass = md5.new() File "", line 1 pass = md5.new() ^ SyntaxErr

Re: Checking a Number for Palindromic Behavior

2009-10-21 Thread Steven D'Aprano
On Tue, 20 Oct 2009 10:18:55 -0700, rurpy wrote: > 6) Please don't apply your abstract moral standards to > the entire rest of the world, knowing nothing about the particular > circumstances of the poster. Perhaps you should apply this rule to yourself, and stop telling us how to respond to pe

Re: Checking a Number for Palindromic Behavior

2009-10-21 Thread rurpy
Why *not* answering a question in comp.lang.python because you think it is homework is BAD. 1) It may look like a homework problem to you but it probably isn't. See http://groups.google.com/group/comp.lang.python/msg/8ac6db43b09fdc92 2) When you publicly accuse someone of "cheating" (and even

Re: Checking a Number for Palindromic Behavior

2009-10-21 Thread rurpy
On 10/20/2009 11:48 AM, Falcolas wrote: > On Oct 20, 11:18 am, ru...@yahoo.com wrote: >> Why *not* answering a question in comp.lang.python >> because you think it is homework is BAD. I got a little over-hyperbolic above and muddied the waters. More accurately, this should have been, "Why insistin

Re: Checking a Number for Palindromic Behavior

2009-10-21 Thread Falcolas
On Oct 20, 11:18 am, ru...@yahoo.com wrote: > Why *not* answering a question in comp.lang.python > because you think it is homework is BAD. > > 1) It may look like a homework problem to you but it >  probably isn't. >  Seehttp://groups.google.com/group/comp.lang.python/msg/8ac6db43b09fdc92 Homewor

Re: Struct on on x86_64 mac os x

2009-10-21 Thread Mark Dickinson
On Oct 20, 10:51 pm, Tommy Grav wrote: > I have created a binary file that saves this struct from some C code: > >    struct recOneData { >           char label[3][84]; >           char constName[400][6]; >         double timeData[3]; >       long int numConst; >         double AU; >         doubl

Text file to XML representation

2009-10-21 Thread kak...@gmail.com
Hello, I would like to make a program that takes a text file with the following representation: outlook = sunny | humidity <= 70: yes (2.0) | humidity > 70: no (3.0) outlook = overcast: yes (4.0) outlook = rainy | windy = TRUE: no (2.0) | windy = FALSE: yes (3.0) and convert it to xml fil

Re: Frameworks

2009-10-21 Thread Bruno Desthuilliers
Emmanuel Surleau a écrit : Emmanuel Surleau a écrit : Django : very strong integration, excellent documentation and support, huge community, really easy to get started with. And possibly a bit more mature and stable... One strong point in favour of Django: it follows Python's philosophy of "bat

Re: md5 strange error

2009-10-21 Thread Super Zyper
On 21 oct, 10:11, "catalinf...@gmail.com" wrote: > I have this error , what happen ? > > Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38) > [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2 > Type "help", "copyright", "credits" or "license" for more information.>>> > import md5 > >>> pass = md5.ne

Re: md5 strange error

2009-10-21 Thread Xavier Ho
On Wed, Oct 21, 2009 at 6:11 PM, catalinf...@gmail.com < catalinf...@gmail.com> wrote: > >>> pass = md5.new() > File "", line 1 >pass = md5.new() > ^ > SyntaxError: invalid syntax > pass is a keyword in Python, you can't use it as an identifier. Try password instead. Cheers, Xav --

Re: What is Islam?-1

2009-10-21 Thread omer azazi
On 12 أكتوبر, 05:42, TerryP wrote: > On Oct 11, 11:25 pm, omer azazi wrote: > > I appologise if I appear _rude_, but this is comp.lang.python -- it is > for the discussion of Python and related projects that were created by > men and women. A discussion about faith does not belong in > comp.lang.

Re: Struct on on x86_64 mac os x

2009-10-21 Thread Mark Dickinson
On Oct 21, 9:18 am, Mark Dickinson wrote: > On Oct 20, 10:51 pm, Tommy Grav wrote: > > >      def read_header(cls): > >          hdrData = "84s"*3 > >          constNData = "6s"*400 > > I'm confused:  why is this not "400s"*6 rather than "6s"*400? > Doesn't constName[400][6] mean 6 lots of constN

Re: a simple unicode question

2009-10-21 Thread Chris Jones
On Wed, Oct 21, 2009 at 12:20:35AM EDT, Nobody wrote: > On Tue, 20 Oct 2009 17:56:21 +, George Trojan wrote: [..] > > Where are the literals (i.e. u'\N{DEGREE SIGN}') defined? > > You can get them from the unicodedata module, e.g.: > > import unicodedata > for i in xrange(0x100

Re: md5 strange error

2009-10-21 Thread Tim Golden
catalinf...@gmail.com wrote: I have this error , what happen ? Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38) [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. import md5 pass = md5.new() File "", line 1 pass = md5.n

Re: md5 strange error

2009-10-21 Thread Kushal Kumaran
On Wed, Oct 21, 2009 at 1:41 PM, catalinf...@gmail.com wrote: > I have this error , what happen ? > > Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38) > [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. import md5 pa

Re: Unicode again ... default codec ...

2009-10-21 Thread Lele Gaifax
"Gabriel Genellina" writes: > DON'T do that. Really. Changing the default encoding is a horrible, > horrible hack and causes a lot of problems. > ... > More reasons: > http://tarekziade.wordpress.com/2008/01/08/syssetdefaultencoding-is-evil/ > See also this recent thread in python-dev: > http://c

Re: What is Islam?-1

2009-10-21 Thread Ben Finney
omer azazi writes: > On 12 أكتوبر, 05:42, TerryP wrote: > > On Oct 11, 11:25 pm, omer azazi wrote: > > > > I appologise if I appear _rude_, but this is comp.lang.python -- it > > is for the discussion of Python and related projects that were > > created by men and women. A discussion about fait

Re: Text file to XML representation

2009-10-21 Thread Bruno Desthuilliers
kak...@gmail.com a écrit : Hello, I would like to make a program that takes a text file with the following representation: outlook = sunny | humidity <= 70: yes (2.0) | humidity > 70: no (3.0) outlook = overcast: yes (4.0) outlook = rainy | windy = TRUE: no (2.0) | windy = FALSE: yes (3.

Re: a simple unicode question

2009-10-21 Thread Bruno Desthuilliers
beSTEfar a écrit : (snip) > When parsing strings, use Regular Expressions. And now you have _two_ problems For some simple parsing problems, Python's string methods are powerful enough to make REs overkill. And for any complex enough parsing (any recursive construct for example - think XML, H

Re: Struct on on x86_64 mac os x

2009-10-21 Thread Dave Angel
Mark Dickinson wrote: On Oct 20, 10:51 pm, Tommy Grav wrote: I have created a binary file that saves this struct from some C code: struct recOneData { char label[3][84]; char constName[400][6]; double timeData[3]; long int numConst; double AU;

Re: odd mmap behavior

2009-10-21 Thread Carl Banks
On Oct 20, 5:03 pm, Brett wrote: > I'm trying to read and write from /dev/mem on a linux system using the > mmap module. When I run this minimal example: > --- > import os, mmap > > MAP_MASK = mmap.PAGESIZE - 1 > > addr = 0x48088024 > > f = os.open("/dev/mem", os.O_RDWR

Re: PySide > PyQt

2009-10-21 Thread Carl Banks
On Oct 20, 6:45 pm, rm wrote: > On Oct 20, 6:14 pm, Robert Kern wrote: > > > On 2009-10-20 16:48 PM, rm wrote: > > > > Have you guys heard about PySide: > > > >http://www.pyside.org/ > > > > It is basically the same as PyQt (Qt bindings for Python), but > > > licensed with the LGPL instead of GPL

Re: SimpleXMLRPCServer clobbering sys.stderr? (2.5.2)

2009-10-21 Thread Brian Quinlan
Do you have some code that we could see that provokes the problem? Cheers, Brian Joseph Turian wrote: I was having a mysterious problem with SimpleXMLRPCServer. (I am using Python 2.5.2) The request handlers were sometimes failing without any error message to the log output. What I discovered

Re: odd mmap behavior

2009-10-21 Thread Brett
On Oct 21, 8:02 am, Carl Banks wrote: > On Oct 20, 5:03 pm, Brett wrote: > > > > > I'm trying to read and write from /dev/mem on a linux system using the > > mmap module. When I run this minimal example: > > --- > > import os, mmap > > > MAP_MASK = mmap.PAGESIZE - 1 >

Optimal Character recognition using python

2009-10-21 Thread pytart
Hello , I have a project to develop a basic character recognition module in python using backpropagation and artificial neural networks. I would be very helpful if u cud give me some helpful links for the project. I am having problems with the implementation part of the project, the backprop

Re: Optimal Character recognition using python

2009-10-21 Thread Diez B. Roggisch
pytart wrote: > Hello , >I have a project to develop a basic character recognition > module in python using backpropagation and artificial neural networks. > I would be very helpful if u cud give me some helpful links for the > project. I am having problems with the implementation part of

Re: odd mmap behavior

2009-10-21 Thread Carl Banks
On Oct 21, 6:50 am, Brett wrote: > I also posted this question to the linux-omap list and received some > helpful (and timely) assistance. I'm running this on an ARM (omap > 3530, gumstix). Here is the take-home message (from the omap technical > reference and reported to me > herehttp://www.spin

Re: Simple audio

2009-10-21 Thread AK Eric
Yep, you can run it without any kind of GUI to my knowledge. -- http://mail.python.org/mailman/listinfo/python-list

Re: PySide > PyQt

2009-10-21 Thread Robert Kern
On 2009-10-21 07:11 AM, Carl Banks wrote: One thing PySide has going against it is the shared library binaries are a lot larger than PyQT4's, because of its use of boost::python. Not a good thing for something that exists so that it can be put on a mobile device. I believe the consensus amongs

error when using Pmw.BLT

2009-10-21 Thread Yang
I tried to follow the following code demonstrating the use of Pwm.BLT: >>> from Tkinter import * >>> import Pmw >>> master = Tk() >>> g = Pmw.Blt.Graph( master ) I got the following error message after I typed the last line: Traceback (most recent call last): File "", line 1, in File "C:\Py

error when using Pmw.BLT

2009-10-21 Thread Yang Yang
Hello, I tried to follow the following code demonstrating the use of Pmw.BLT: >>> from Tkinter import * >>> import Pmw >>> master = Tk() >>> g = Pmw.Blt.Graph( master ) I got the following error message after I typed the last line: Traceback (most recent call last): File "", line 1, in File

Re: help to convert c++ fonction in python

2009-10-21 Thread geremy condra
On Wed, Oct 21, 2009 at 3:28 AM, Processor-Dev1l wrote: > On Oct 18, 8:13 am, Toff wrote: >> On 18 oct, 02:13, geremy condra wrote: >> >> >> >> > On Sat, Oct 17, 2009 at 7:57 PM, David Robinow wrote: >> > > On Sat, Oct 17, 2009 at 7:48 PM, geremy condra >> > > wrote: >> > >> For the love of b

Re: error when using Pmw.BLT

2009-10-21 Thread Robert Kern
On 2009-10-21 10:50 AM, Yang Yang wrote: Hello, I tried to follow the following code demonstrating the use of Pmw.BLT: >>> from Tkinter import * >>> import Pmw >>> master = Tk() >>> g = Pmw.Blt.Graph( master ) I got the following error message after I typed the last line: Traceback (most

Python Developer role in San Francisco

2009-10-21 Thread Jaime Bott
Hello: Would it be okay to post a San Francisco-based contract Python Developer role on this group list? Here is the link to the URL: http://docs.google.com/View?id=dtc9xms_77hsrm8pc3. Unfortunately since the company is in stealth, I can't give out to much info via email. You can find a bit more

Re: a simple unicode question

2009-10-21 Thread Nobody
On Wed, 21 Oct 2009 05:16:56 -0400, Chris Jones wrote: >> > Where are the literals (i.e. u'\N{DEGREE SIGN}') defined? >> >> You can get them from the unicodedata module, e.g.: >> >> import unicodedata >> for i in xrange(0x1): >>n = unicodedata.name(unichr(i),None) >>

Re: Checking a Number for Palindromic Behavior

2009-10-21 Thread rurpy
On 10/21/2009 01:40 AM, Lie Ryan wrote: > ru...@yahoo.com wrote: 1) It may look like a homework problem to you but it probably isn't. Seehttp://groups.google.com/group/comp.lang.python/msg/8ac6db43b09fdc92 >>> Homework comes in many forms - school driven homework should be >>> trea

Re: ANN: Testoob 1.15 released

2009-10-21 Thread Jorgen Grahn
On Mon, 2009-10-19, oripel wrote: > On Oct 14, 5:59 pm, Jorgen Grahn wrote: >> But this sentence on the home page >> >>     The documentation is sadly outdated, but may be >>     a starting point: >> >> made me stop looking.  As far as I can tell, you cannot even find out >> what's so advanced abo

Re: error when using Pmw.BLT

2009-10-21 Thread Yang
On Oct 21, 12:13 pm, Robert Kern wrote: > On 2009-10-21 10:50 AM, Yang Yang wrote: > > > > > Hello, > > > I tried to follow the following code demonstrating the use of Pmw.BLT: > > >  >>> from Tkinter import * > >  >>> import Pmw > >  >>> master = Tk() > >  >>> g = Pmw.Blt.Graph( master ) > > > I

Re: error when using Pmw.BLT

2009-10-21 Thread Robert Kern
On 2009-10-21 12:38 PM, Yang wrote: Here is another question on this. I am running Python 2.6.3 which uses Tcl 8.5. I could not find the BLT binary source for Tcl 8.5. The latest version is for Tcl 8.4. How could I install BLT? For example, can I change the default Tcl version that Python has ac

Re: Cpython optimization

2009-10-21 Thread Francesco Bochicchio
Il Wed, 21 Oct 2009 10:28:55 -0700, Qrees ha scritto: > Hello > > As my Master's dissertation I chose Cpython optimization. That's why i'd > like to ask what are your suggestions what can be optimized. Well, I > know that quite a lot. I've downloaded the source code (I plan to work > on Cpython 2

Windows file paths, again

2009-10-21 Thread Dan Guido
I'm trying to write a few methods that normalize Windows file paths. I've gotten it to work in 99% of the cases, but it seems like my code still chokes on '\x'. I've pasted my code below, can someone help me figure out a better way to write this? This seems overly complicated for such a simple prob

Re: a simple unicode question

2009-10-21 Thread rurpy
On Oct 21, 4:59 am, Bruno Desthuilliers wrote: > beSTEfar a écrit : > (snip) >  > When parsing strings, use Regular Expressions. > > And now you have _two_ problems > > For some simple parsing problems, Python's string methods are powerful > enough to make REs overkill. And for any complex enough

Re: best vi / emacs python features

2009-10-21 Thread Hans Georg Schaathun
On Wed, 07 Oct 2009 18:44:03 +0200, Jean-Michel Pichavant wrote: : When opposing vi to emacs, there's is no possibility you get : constructive and objective answer, because basically, what can do with : one, you can also do it with the other. You seem rather negative. I could not see any

Re: Windows file paths, again

2009-10-21 Thread Diez B. Roggisch
Dan Guido wrote: > I'm trying to write a few methods that normalize Windows file paths. > I've gotten it to work in 99% of the cases, but it seems like my code > still chokes on '\x'. I've pasted my code below, can someone help me > figure out a better way to write this? This seems overly complica

Re: convert pyc (python 2.4) to py

2009-10-21 Thread Peng Yu
On Tue, Oct 20, 2009 at 4:42 PM, Diez B. Roggisch wrote: > Peng Yu schrieb: >> >> I have a .pyc file generated by python 2.4. My current python is of >> version 2.6. I'm wondering how to generate the corresponding .py file >> from it. > > http://www.crazy-compilers.com/decompyle/ Is there any fre

Re: convert pyc (python 2.4) to py

2009-10-21 Thread Chris Rebert
On Wed, Oct 21, 2009 at 11:35 AM, Peng Yu wrote: > On Tue, Oct 20, 2009 at 4:42 PM, Diez B. Roggisch wrote: >> Peng Yu schrieb: >>> >>> I have a .pyc file generated by python 2.4. My current python is of >>> version 2.6. I'm wondering how to generate the corresponding .py file >>> from it. >> >>

equivalent to globals(), locals() for nonlocal variables?

2009-10-21 Thread geremy condra
I decided to play around with nonlocal declarations today, and was somewhat surprised when a call to nonlocals() resulted in 'nonlocals is not defined'. Is there an a standard equivalent to globals() or locals() for variables in outer nested scopes? Geremy Condra -- http://mail.python.org/mailman

Re: Windows file paths, again

2009-10-21 Thread Dan Guido
Hi Diez, The source of the string literals is ConfigParser, so I can't just mark them with an 'r'. config = ConfigParser.RawConfigParser() config.read(filename) crazyfilepath = config.get(name, "ImagePath") normalfilepath = normalize_path(crazyfilepath) The ultimate origin of the strings is the

Re: a splitting headache

2009-10-21 Thread David C Ullrich
On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote: > On Oct 20, 1:51 pm, David C Ullrich wrote: >> On Thu, 15 Oct 2009 18:18:09 -0700, Mensanator wrote: >> > All I wanted to do is split a binary number into two lists, a list of >> > blocks of consecutive ones and another list of blocks of cons

Re: Windows file paths, again

2009-10-21 Thread Anthony Tolle
On Oct 21, 3:20 pm, Dan Guido wrote: > Hi Diez, > > The source of the string literals is ConfigParser, so I can't just > mark them with an 'r'. > > config = ConfigParser.RawConfigParser() > config.read(filename) > crazyfilepath = config.get(name, "ImagePath") > normalfilepath = normalize_path(craz

Re: Windows file paths, again

2009-10-21 Thread Ethan Furman
Dan Guido wrote: I'm trying to write a few methods that normalize Windows file paths. I've gotten it to work in 99% of the cases, but it seems like my code still chokes on '\x'. I've pasted my code below, can someone help me figure out a better way to write this? This seems overly complicated for

Re: Frameworks

2009-10-21 Thread Emmanuel Surleau
> Emmanuel Surleau a écrit : > >> Emmanuel Surleau a écrit : > Django : very strong integration, excellent documentation and support, > huge community, really easy to get started with. And possibly a bit > more mature and stable... > >>> > >>> One strong point in favour of Django: it

Re: Windows file paths, again

2009-10-21 Thread Dan Guido
Hi Anthony, Thanks for your reply, but I don't think your tests have any control characters in them. Try again with a \v, a \n, or a \x in your input and I think you'll find it doesn't work as expected. -- Dan Guido On Wed, Oct 21, 2009 at 3:50 PM, Anthony Tolle wrote: > On Oct 21, 3:20 pm, D

Re: Object Relational Mappers are evil (a meditation)

2009-10-21 Thread Aaron Watters
On Oct 16, 10:35 am, mario ruggier wrote: > On Oct 5, 4:25 pm, Aaron Watters wrote: > > > Occasionally I fantasize about making a non-trivial change > > to one of these programs, but I strongly resist going further > > than that because the ORM meatgrinder makes it somewhere > > between extremely

Re: Windows file paths, again

2009-10-21 Thread Dave Angel
Dan Guido wrote: Hi Diez, The source of the string literals is ConfigParser, so I can't just mark them with an 'r'. config =onfigParser.RawConfigParser() config.read(filename) crazyfilepath =onfig.get(name, "ImagePath") normalfilepath =ormalize_path(crazyfilepath) The ultimate origin of the st

Re: Windows file paths, again

2009-10-21 Thread Lie Ryan
Dan Guido wrote: Hi Anthony, Thanks for your reply, but I don't think your tests have any control characters in them. Try again with a \v, a \n, or a \x in your input and I think you'll find it doesn't work as expected. A path read from a file, config file, or winreg would never contain contr

Re: Checking a Number for Palindromic Behavior

2009-10-21 Thread Tim Chase
ru...@yahoo.com wrote: On 10/21/2009 01:40 AM, Lie Ryan wrote: ru...@yahoo.com wrote: 1) It may look like a homework problem to you but it probably isn't. Seehttp://groups.google.com/group/comp.lang.python/msg/8ac6db43b09fdc92 Homework comes in many forms - school driven homework should be t

Re: Windows file paths, again

2009-10-21 Thread Dan Guido
I'm writing a test case right now, will update in a few minutes :-). I'm using Python 2.6.x I need to read these values in from a configparser file or the windows registry and get MD5 sums of the actual files on the filesystem and copy the files to a new location. The open() method completely barf

PyQt4 - remember widget positions

2009-10-21 Thread nusch
Is there any simple command which allows me to save position of all windows: QMainWindow, QDialogs and qdockwidgets with their sizes, dock state and positions ? Or do I need to store those values manually, how can I do it fast? -- http://mail.python.org/mailman/listinfo/python-list

Re: Checking a Number for Palindromic Behavior

2009-10-21 Thread Lie Ryan
ru...@yahoo.com wrote: On 10/21/2009 01:40 AM, Lie Ryan wrote: ru...@yahoo.com wrote: 1) It may look like a homework problem to you but it probably isn't. Seehttp://groups.google.com/group/comp.lang.python/msg/8ac6db43b09fdc92 Homework comes in many forms - school driven homework should be t

Re: Cpython optimization

2009-10-21 Thread Qrees
> If you don't know yet, you could find interesting this project: > >    http://code.google.com/p/unladen-swallow/ I know about this project. I'll have a look at it, but I'd like to create something of my own. > They too are trying to improve CPython speed. > > If you are thinking of language var

Re: Windows file paths, again

2009-10-21 Thread Terry Reedy
Dan Guido wrote: Hi Diez, The source of the string literals is ConfigParser, so I can't just mark them with an 'r'. Python string literals only exist in Python source code. Functions and methods only return *strings*, not literals. If you mistakenly put the str() representation of a string

Re: Windows file paths, again

2009-10-21 Thread Dan Guido
This doesn't give me quite the results I expected, so I'll have to take a closer look at my project as a whole tomorrow. The test cases clearly show the need for all the fancy parsing I'm doing on the path though. Looks like I'll return to this tomorrow and post an update as appropriate. Thanks fo

Re: which "dictionary with attribute-style access"?

2009-10-21 Thread Andreas Balogh
Gabriel, thanks for your hint. I've managed to create an implementation of an AttrDict passing Gabriels tests. Any more comments about the pythonicness of this implementation? class AttrDict(dict): """A dict whose items can also be accessed as member variables.""" def __init__(self, *ar

Re: a splitting headache

2009-10-21 Thread Mensanator
On Oct 21, 2:46 pm, David C Ullrich wrote: > On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote: > > On Oct 20, 1:51 pm, David C Ullrich wrote: > >> On Thu, 15 Oct 2009 18:18:09 -0700, Mensanator wrote: > >> > All I wanted to do is split a binary number into two lists, a list of > >> > blocks o

Re: The rap against "while True:" loops

2009-10-21 Thread Jorgen Grahn
On Wed, 2009-10-14, Steven D'Aprano wrote: ... > Setting up a try...except block is cheap in Python. According to my > tests, the overhead is little more than that of a single pass statement. > > But actually raising and catching the exception is not cheap. If you use > a lot of exceptions for f

Re: a simple unicode question

2009-10-21 Thread Terry Reedy
Nobody wrote: Just curious, why did you choose to set the upper boundary at 0x? Characters outside the 16-bit range aren't supported on all builds. They won't be supported on most Windows builds, as Windows uses 16-bit Unicode extensively: Python 2.5.1 (r251:54863, Apr 18 2007, 08

Re: How to schedule system calls with Python

2009-10-21 Thread Jorgen Grahn
On Thu, 2009-10-15, TerryP wrote: ... > launching external programs, irregardless of language, generally falls > into 3 major categories: > > 0.) blocks until program is done; like system > 1.) replaces your program with process, never returns; like exec > 2.) quickly return after asynchronou

Re: How to schedule system calls with Python

2009-10-21 Thread Jorgen Grahn
On Fri, 2009-10-16, Jeremy wrote: > On Oct 15, 6:32 pm, MRAB wrote: >> TerryP wrote: >> > On Oct 15, 7:42 pm, Jeremy wrote: >> >> I need to write a Python script that will call some command line >> >> programs (using os.system).  I will have many such calls, but I want >> >> to control when the c

Re: Windows file paths, again

2009-10-21 Thread Jerry Hill
On Wed, Oct 21, 2009 at 5:40 PM, Dan Guido wrote: > This doesn't give me quite the results I expected, so I'll have to > take a closer look at my project as a whole tomorrow. The test cases > clearly show the need for all the fancy parsing I'm doing on the path > though. To get back to what I thi

Re: md5 strange error

2009-10-21 Thread Stephen Fairchild
Tim Golden wrote: > catalinf...@gmail.com wrote: >> I have this error , what happen ? >> >> Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38) >> [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. > import md5 > pass =

Re: md5 strange error

2009-10-21 Thread Rhodri James
On Wed, 21 Oct 2009 23:28:24 +0100, Stephen Fairchild wrote: Tim Golden wrote: catalinf...@gmail.com wrote: I have this error , what happen ? Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38) [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2 Type "help", "copyright", "credits" or "license"

Re: Spam reported

2009-10-21 Thread Peter Pearson
On Wed, 21 Oct 2009 09:06:50 +1100, Ben Finney wrote: > Grant Edwards writes: >> On 2009-10-20, Peter Pearson wrote: >> >> > Reported to Google's groups-abuse. >> >> What are these postings supposed to mean? > > That the posting which started the thread (which you may or may not have > seen, so i

Re: Unicode again ... default codec ...

2009-10-21 Thread Gabriel Genellina
En Wed, 21 Oct 2009 06:24:55 -0300, Lele Gaifax escribió: "Gabriel Genellina" writes: DON'T do that. Really. Changing the default encoding is a horrible, horrible hack and causes a lot of problems. ... More reasons: http://tarekziade.wordpress.com/2008/01/08/syssetdefaultencoding-is-evil/ Se

Re: How to schedule system calls with Python

2009-10-21 Thread Al Fansome
Jorgen Grahn wrote: On Fri, 2009-10-16, Jeremy wrote: On Oct 15, 6:32 pm, MRAB wrote: TerryP wrote: On Oct 15, 7:42 pm, Jeremy wrote: I need to write a Python script that will call some command line programs (using os.system). I will have many such calls, but I want to control when the c

Re: mysql select some sort of caching

2009-10-21 Thread David Sfiligoi
On Wed, 21 Oct 2009 00:45:21 -0300, Gabriel Genellina wrote: > > If you want to keep the cursor open, you must commit the (implicit) > current transaction, even if it only contains selects (a rollback would > work too). > Alternatively, lower the transaction isolation level below "repeatable > rea

python, emacs, pylint, epylint, flymake

2009-10-21 Thread Richard Riley
I have asked in emacs help too, but basically does anyone here have pylint integrated with emacs so that you can actually read the error description? I am set up as described here:- http://tinyurl.com/yfshb5b or http://stackoverflow.com/questions/1259873/how-can-i-use-emacs-flymake-mode-for-pyt

How to write a facebook client?

2009-10-21 Thread holmes86
Hi,everyone I'm a python newbie,and I want to write a facebook client.But I don't know how to do it.Meanwhile I have any write web experience,so I also don't know how to analyse web page.Any help will be appreciate. -- http://mail.python.org/mailman/listinfo/python-list

Re: PyQt4 - remember widget positions

2009-10-21 Thread TerryP
On Oct 21, 9:04 pm, nusch wrote: > Is there any simple command which allows me to save position of all > windows:  QMainWindow, QDialogs and qdockwidgets with their sizes, > dock state and positions ? Or do I need to store those values > manually, how can I do it fast? Both fast and simple have

problems on installing PyGTK in Windows XP

2009-10-21 Thread Yang
Python 2.6.3 is installed on my Windows XP throught the binary file provided by Python.org. Then I followed the steps described here: http://faq.pygtk.org/index.py?req=show&file=faq21.001.htp to install PyGTK. However, I still get the following error: >>> import pygtk >>> pygtk.require('2.0') >>>

Re: Windows file paths, again

2009-10-21 Thread Dave Angel
Dan Guido wrote: This doesn't give me quite the results I expected, so I'll have to take a closer look at my project as a whole tomorrow. The test cases clearly show the need for all the fancy parsing I'm doing on the path though. Looks like I'll return to this tomorrow and post an update as app

Re: How to write a facebook client?

2009-10-21 Thread geremy condra
On Wed, Oct 21, 2009 at 9:45 PM, holmes86 wrote: > Hi,everyone > > I'm a python newbie,and I want to write a facebook client.But I don't > know how to do it.Meanwhile I have any write web experience,so I also > don't know how to analyse web page.Any help will be appreciate. > -- > http://mail.pyth

Re: Fallen Sword

2009-10-21 Thread Ben Finney
Richard Riley writes: > Ben Finney writes: > > Reported to service provider as spam. > > Please don't reply to SPAM. You just make it visible to those of us > with better filters. Hint : spammers do not read your reply. I didn't quote the spam except to be clear which message I'm responding to.

Re: Fallen Sword

2009-10-21 Thread Paul Huber
On Thu, 22 Oct 2009 14:00:03 +1100, Ben Finney wrote: >> Ben Finney writes: >> > Reported to service provider as spam. >> >> Please don't reply to SPAM. You just make it visible to those of us >> with better filters. Hint : spammers do not read your reply. > >I didn't quote the spam except to be

subprocess executing shell

2009-10-21 Thread Tim Arnold
Hi, I'm writing a script to capture a command on the commandline and run it on a remote server. I guess I don't understand subprocess because the code below exec's the user's .cshrc file even though by default shell=False in the Popen call. Here's the code. I put a line in my .cshrc file: echo '

Re: Cpython optimization

2009-10-21 Thread John Nagle
Qrees wrote: Hello As my Master's dissertation I chose Cpython optimization. That's why i'd like to ask what are your suggestions what can be optimized. Well, I know that quite a lot. I've downloaded the source code (I plan to work on Cpython 2.6 and I've downloaded 2.6.3 release). By looking at

Re: a splitting headache

2009-10-21 Thread John Yeung
On Oct 21, 5:43 pm, Mensanator wrote: > >>> '01110'.split('0') > > ['', '1', '', '', '', '11', ''] > > is a perfect example. It shows the empty strings > generated from the leading and trailing delimiters, > and also that you get 3 empty strings between the > '1's, not 4. When creating docume

Re: mysql select some sort of caching

2009-10-21 Thread Gabriel Genellina
En Wed, 21 Oct 2009 22:24:49 -0300, David Sfiligoi escribió: On Wed, 21 Oct 2009 00:45:21 -0300, Gabriel Genellina wrote: If you want to keep the cursor open, you must commit the (implicit) current transaction, even if it only contains selects (a rollback would work too). Alternatively, low

Re: which "dictionary with attribute-style access"?

2009-10-21 Thread Gabriel Genellina
En Wed, 21 Oct 2009 18:40:01 -0300, Andreas Balogh escribió: Gabriel, thanks for your hint. I've managed to create an implementation of an AttrDict passing Gabriels tests. Any more comments about the pythonicness of this implementation? class AttrDict(dict): """A dict whose items can

Re: What is Islam?-1

2009-10-21 Thread Jack Norton
omer azazi wrote: On 12 أكتوبر, 05:42, TerryP wrote: On Oct 11, 11:25 pm, omer azazi wrote: I appologise if I appear _rude_, but this is comp.lang.python -- it is for the discussion of Python and related projects that were created by men and women. A discussion about faith does not belong

Re: Cpython optimization

2009-10-21 Thread John Yeung
On Oct 22, 12:28 am, John Nagle wrote: >    The Shed Skin people would welcome some help. > >        http://shed-skin.blogspot.com/ People? It's one guy. It apparently started out as a Master's thesis as well. ;) I am a great admirer of the Shed Skin project, and I would be as happy as anyone

Re: a splitting headache

2009-10-21 Thread Carl Banks
On Oct 21, 12:46 pm, David C Ullrich wrote: > On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote: > > On Oct 20, 1:51 pm, David C Ullrich wrote: > > I'm not saying either behaviour is wrong, it's just not obvious that the > > one behaviour doesn't follow from the other and the documentation cou

  1   2   >