Re: who can give me the detailed introduction of re modle?

2006-05-19 Thread vaibhav
easy and convenient way to get a good introduction for any module [especially if ur stuck and dont have internet connectivity]: 1. start python interpreter $ python 2. import the module and ask it for help :-) >>> import re >>> help(re) -vaibhav -- http://mail.python.org/mailman/listinfo/pytho

Re: who can give me the detailed introduction of re modle?

2006-05-19 Thread softwindow
thanks for your advice! :) -- http://mail.python.org/mailman/listinfo/python-list

Re: WTF? Printing unicode strings

2006-05-19 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Serge Orlov" <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > > > I'm using an OS X terminal to ssh to a Linux machine. > > > > > > In theory it should work out of the box. OS X terminal should set > > > enviromental variable LANG=en_US.utf-8, then ssh should tr

Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)

2006-05-19 Thread Duncan Booth
PoD wrote: > I think it is universally accepted that mixed tabs and spaces is indeed > **EVIL** > > I should have said any code using tabs exclusively. > Can you point at any significant body of publically visible Python code which uses tabs exclusively? All of the Python projects I've ever been

Re: Tkinter Dialog Management problems:

2006-05-19 Thread Eric Brunel
On Thu, 18 May 2006 11:52:54 -0400, Michael Yanowitz <[EMAIL PROTECTED]> wrote: > Thanks. That helped alot. No problem. > However it leaves a couple very minor problems which I think I can live > with. > 1) It brings up an empty additional 'main window'. >I have tried using the Tkinter.NoD

Re: Complex evaluation bug

2006-05-19 Thread Christophe
Gary Herron a écrit : > of wrote: > >> a = 1+3j >> complex(str(a)) >> >> Why does this not work ? It should >> >> > Says who? > By normal conventions in Python, "str" attempts only to make a "nice" > human readable representation. The function "repr" is usually expected > to provide output th

Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)

2006-05-19 Thread Christophe
PoD a écrit : > Maybe what Python should do (but never will given the obsession with using > spaces) is only allow one level of indentation increase per block so that > > def foo(): > return 'bar' > > would return a syntax error Which would make mandatory for indentation. What about some freed

Re: Getting URL's

2006-05-19 Thread softwindow
it is difficult to get all URL's in a page you can use sgmllib module to parse html files can get the standard href . -- http://mail.python.org/mailman/listinfo/python-list

Re: Complex evaluation bug

2006-05-19 Thread Fredrik Lundh
Christophe wrote: >> So, putting them together, you could expect >>eval(repr(a)) >> to reproduce a, and in fact it does so. > > Says who ? > > Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more informa

Re: Complex evaluation bug

2006-05-19 Thread Christophe
Fredrik Lundh a écrit : > Christophe wrote: > >>> So, putting them together, you could expect >>>eval(repr(a)) >>> to reproduce a, and in fact it does so. >> >> >> Says who ? >> >> Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] >> on win32 >> Type "help", "copyright", "

Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)

2006-05-19 Thread Sybren Stuvel
Duncan Booth enlightened us with: > Can you point at any significant body of publically visible Python > code which uses tabs exclusively? Everything Python at http://www.stuvel.eu/software > Also, in the open source universe you are quite likely to pull in > bits of code from other projects, and

Re: who can give me the detailed introduction of re modle?

2006-05-19 Thread Simon Brunning
On 18 May 2006 22:50:24 -0700, softwindow <[EMAIL PROTECTED]> wrote: > the re module is too large and difficult to study > > i need a detaild introduction. -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/b

Re: Opensource vs Microsoft, Wat do you think about opensource?

2006-05-19 Thread Sybren Stuvel
Ben Finney enlightened us with: > Please don't spam here to ask for discussion on another forum, on a > tangentially related topic. Hey, it's at least better than asking for a discussion on a tangentially related topic _here_ ;-) Sybren -- The problem with the world is stupidity. Not saying ther

Re: Newbie append() question

2006-05-19 Thread Sybren Stuvel
Brian Blazer enlightened us with: > def getCurrentClasses(): > classes = [] > print 'Please enter the class name. When finished enter D.' > while (c != "D"): No need for the parentheses, and 'c' doesn't have a value yet. If you add 'c=""' before the while-loop, it should

Segmenting a pickle stream without unpickling

2006-05-19 Thread Boris Borcic
Assuming that the items of my_stream share no content (they are dumps of db cursor fetches), is there a simple way to do the equivalent of def pickles(my_stream) : from cPickle import load,dumps while 1 : yield dumps(load(my_stream)) without the overhead associated with unpickl

Re: galaxql

2006-05-19 Thread Steve Holden
Further to my recent mention of galaxql as a SQL learning tool, I had the following feedback through holdenweb.com: > Below is the result of your feedback form. It was submitted by > jari komppa ([EMAIL PROTECTED]) on Friday, May 19, 2006 at 00:07:53 > ---

ftplib.ftpcp(), undocumented function?

2006-05-19 Thread swordsp
Hi all, I found this function recently when I read the source code of ftplib module, I almost omit it at all and have tried to write it myself for FXP work. It seems exist long long ago, but never appeared in any document, anyone knows why? Is its implementation broken or planed to be removed from

Re: WTF? Printing unicode strings

2006-05-19 Thread Serge Orlov
Ron Garret wrote: > In article <[EMAIL PROTECTED]>, > "Serge Orlov" <[EMAIL PROTECTED]> wrote: > > > Ron Garret wrote: > > > > > I'm using an OS X terminal to ssh to a Linux machine. > > > > > > > > In theory it should work out of the box. OS X terminal should set > > > > enviromental variable LAN

Re: Question about exausted iterators

2006-05-19 Thread Christophe
Terry Reedy a écrit : > "Christophe" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Instead of saying that all works as intended could you be a little >>helpful and tell me why it was intended in such an obviously broken way >>instead ? > > > I answered both your explicit and

Re: Segmenting a pickle stream without unpickling

2006-05-19 Thread Paul Rubin
Boris Borcic <[EMAIL PROTECTED]> writes: > def pickles(my_stream) : > from cPickle import load,dumps > while 1 : > yield dumps(load(my_stream)) > > without the overhead associated with unpickling objects > just to pickle them again ? I think you'd have to write something specia

Specific performance question - Python vs. Java

2006-05-19 Thread reinsn
Hi, I have got a specific question on performance: Is the overhead of object creation in Python lower than in Java? I mean, I would argue, in Java by object creation, the complete class is the model and all methods and attributes are generated for the object. In Python, methods and objects are onl

Re: Programming language productivity

2006-05-19 Thread malv
John Bokma wrote: > Connelly Barnes <[EMAIL PROTECTED]> wrote: > > > http://barnesc.blogspot.com/2006/05/programming-language-productivity.h > > tml > > C:3 hours to write the program, 5 hours to track down the memory leaks > Java: 4 hours to write the program, 6 hours to get all the exception

Re: Specific performance question - Python vs. Java

2006-05-19 Thread Diez B. Roggisch
reinsn wrote: > Hi, > > I have got a specific question on performance: Is the overhead of > object creation in Python lower than in Java? I mean, I would argue, in > Java by object creation, the complete class is the model and all > methods and attributes are generated for the object. > In Python

calling python functions using variables

2006-05-19 Thread creo
Hi all! this is a (relatively) newbie question I am writing a shell in Python and I am facing a problem The problem is, after taking the input from user, i have to execute the command which is a python function i invoke an 'ls' command like this commands.ls() where commands.py is a fil

Re: Windows Registry Dump

2006-05-19 Thread Dirk Hagemann
@Diez: I'm not trying to hack into somebody's computer - it is about collecting data from my company's anti-virus-parent-server. And all the information is only available in the registry (thanks Symantec...). @Tim, olso and Fredrik: THANKS - I will have a closer look at these modules. regards Dir

Re: calling python functions using variables

2006-05-19 Thread Peter Otten
creo wrote: > i invoke an 'ls' command like this > commands.ls() > where commands.py is a file in the same directory > > what i want to do is > commands.VARIABLE() > where VARIABLE holds the name of the function which i want to execute > and depends on what the user has typed You want getattr(c

RE: Windows Registry Dump

2006-05-19 Thread Tim Golden
[Dirk Hagemann] | @Diez: I'm not trying to hack into somebody's computer - it is about | collecting data from my company's anti-virus-parent-server. | And all the | information is only available in the registry (thanks Symantec...). | | @Tim, olso and Fredrik: THANKS - I will have a closer look

how to read a list from python in C?

2006-05-19 Thread Lialie KingMax
Hi, all I am writing a C extension with .Net. Now I have a list of points, like [(0.0, 0.0), (2.0, 3.0), (random x, random y)]. Is there a better way to translate it to an array than doing it one by one? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: calling python functions using variables

2006-05-19 Thread Ben Finney
Peter Otten <[EMAIL PROTECTED]> writes: > creo wrote: > > what i want to do is > > commands.VARIABLE() > > where VARIABLE holds the name of the function which i want to execute > > and depends on what the user has typed > > You want > > getattr(commands, VARIABLE)() You'll also need to anticipa

Re: who can give me the detailed introduction of re modle?

2006-05-19 Thread Kent Johnson
softwindow wrote: > the re module is too large and difficult to study > > i need a detaild introduction. > http://www.amk.ca/python/howto/regex/ Kent -- http://mail.python.org/mailman/listinfo/python-list

Python and Test Driven Development

2006-05-19 Thread Diego Torres Milano
First part of a series of articles about Python and Test Driven Development can be found at http://dtmilano.blogspot.com/2006/05/python-and-test-driven-development.html. These articles include some scripts to ease automatic test suite creation in Python. Comments are gladly welcome. -- htt

Re: Windows Registry Dump

2006-05-19 Thread Dirk Hagemann
Hi Tim! I want to do some analysis (as always ;-) ) and for that reason I think it's more practical to go trough a text-file. I can produce this text-file also by right-click on the key (the folder) in the registry and select "Export". There one can select Text-File and the place where to save th

RE: Windows Registry Dump

2006-05-19 Thread Tim Golden
[Dirk Hagemann] | I want to do some analysis (as always ;-) ) and for that | reason I think | it's more practical to go trough a text-file. I can produce this | text-file also by right-click on the key (the folder) in the registry | and select "Export". There one can select Text-File and the |

Re: calling python functions using variables

2006-05-19 Thread bruno at modulix
Ben Finney wrote: > Peter Otten <[EMAIL PROTECTED]> writes: (snip) >> >>You want >>getattr(commands, VARIABLE)() > > You'll also need to anticipate the situation where the value bound to > VARIABLE is not the name of an attribute in 'commands'. > > Either deal with the resulting NameError excepti

Re: who can give me the detailed introduction of re modle?

2006-05-19 Thread bruno at modulix
softwindow wrote: > the re module is too large and difficult to study Too bad. > i need a detaild introduction. That's fine. Then write it. Or pay someone to do so. Just for the record : that's the only answers you would have get on most usenet groups. Hopefully, c.l.py is a very friendly and t

Re: Which is More Efficient?

2006-05-19 Thread Dustan
Fredrik Lundh wrote: > Dustan wrote: > > > Obviously it takes a geek to know you have to time it, as opposed to > > any other task you could be talking about. > > wasn't the original question "my program uses a lot of CPU, and I want > to make it more efficient" ? what does "a lot of CPU" and "mo

Re: Which is More Efficient?

2006-05-19 Thread Dustan
Dustan wrote: > Fredrik Lundh wrote: > > Dustan wrote: > > > > > Obviously it takes a geek to know you have to time it, as opposed to > > > any other task you could be talking about. > > > > wasn't the original question "my program uses a lot of CPU, and I want > > to make it more efficient" ? wha

Encode exception for chinese text

2006-05-19 Thread Vinayakc
Hi all, I am new to python. I have written one small application which reads data from xml file and tries to encode data using apprpriate charset. I am facing problem while encoding one chinese paragraph with charset "gb2312". code is: encoded_str = str_data.encode("gb2312") The type of str_da

Re: Newbie append() question

2006-05-19 Thread Brian Blazer
Thanks guys. Your solutions worked. I'm still not sure why it was grabbing the prompt string though. Thanks again, Brian [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Encode exception for chinese text

2006-05-19 Thread swordsp
Are you sure all the characters in original text are in "gb2312" charset? Encoding with "utf8" seems work for this character (u'\xa0'), but I don't know if the result is correct. Could you give a subset of str_data in unicode? -- http://mail.python.org/mailman/listinfo/python-list

Re: WTF? Printing unicode strings

2006-05-19 Thread Serge Orlov
Serge Orlov wrote: > Ron Garret wrote: > > In article <[EMAIL PROTECTED]>, > > "Serge Orlov" <[EMAIL PROTECTED]> wrote: > > > > > Ron Garret wrote: > > > > > > I'm using an OS X terminal to ssh to a Linux machine. > > > > > > > > > > In theory it should work out of the box. OS X terminal should se

Re: Question about exausted iterators

2006-05-19 Thread [EMAIL PROTECTED]
Consider this example: >>> X = range(5) >>> Y = iter(X) >>> Z = iter(Y) As you can see, X is a container, and Y is an iterator. They are simliar in that "iter" works on them both. Cristoph claims that this causes confusion. Why? Because "iter" doesn't have the same meaning for both of them. For

Re: newb: comapring two strings

2006-05-19 Thread John Machin
> Use the levenshtein distance. Given the constraint that the two strings are the same length, I'm assuming (as other posters appear to have done) that "vary by only one character" precludes insertion and deletion operations. In that case, the problem can be solved in O(n) time by a simple loop w

memory error with zipfile module

2006-05-19 Thread Hari Sekhon
I do import zipfile zip=zipfile.ZipFile('d:\somepath\cdimage.zip') zip.namelist() ['someimage.iso'] then either of the two: A) file('someimage.iso','w').write(zip.read('someimage.iso')) or B) content=zip.read('someimage.iso') but both result in the same error: Traceback (most recent call l

Re: Which is More Efficient?

2006-05-19 Thread Max Erickson
"Dustan" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > > The task manager says "CPU Usage: 100%" when the program is > running, and only when the program is running. > > Efficiency is a measure of 2 things: CPU usage and time. If you > measure just time, you're not necessarily getting

Re: Encode exception for chinese text

2006-05-19 Thread Serge Orlov
Vinayakc wrote: > Hi all, > > I am new to python. > > I have written one small application which reads data from xml file and > tries to encode data using apprpriate charset. > I am facing problem while encoding one chinese paragraph with charset > "gb2312". > > code is: > > encoded_str = str_data.

How to append to a dictionary

2006-05-19 Thread Harlin Seritt
I have some code here: groups = {'IRISH' : 'green', 'AMERICAN' : 'blue'} I want to add another key: 'ITALIAN' : 'orange' How do I append this to 'groups'? Thanks, Harlin Seritt -- http://mail.python.org/mailman/listinfo/python-list

Re: How to append to a dictionary

2006-05-19 Thread Tim Chase
> groups = {'IRISH' : 'green', 'AMERICAN' : 'blue'} > > I want to add another key: 'ITALIAN' : 'orange' > > How do I append this to 'groups'? groups['ITALIAN'] = 'orange' as described at http://docs.python.org/tut/node7.html#SECTION00750 -tkc -- http://mail.python.org/mail

Re: How to append to a dictionary

2006-05-19 Thread Sybren Stuvel
Harlin Seritt enlightened us with: > I have some code here: > > groups = {'IRISH' : 'green', 'AMERICAN' : 'blue'} > > I want to add another key: 'ITALIAN' : 'orange' > > How do I append this to 'groups'? groups['ITALIAN'] = 'orange' Sybren -- The problem with the world is stupidity. Not saying t

Re: Newbie append() question

2006-05-19 Thread Sybren Stuvel
Brian Blazer enlightened us with: > I'm still not sure why it was grabbing the prompt string though. Me neither. Try it in a standalone script instead of an interactive session. Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity, but

Re: WTF? Printing unicode strings

2006-05-19 Thread Laurent Pointal
Ron Garret a écrit : > In article <[EMAIL PROTECTED]>, > Fredrik Lundh <[EMAIL PROTECTED]> wrote: > >> Ron Garret wrote: >> >> u'\xbd' >>> u'\xbd' >> print _ >>> Traceback (most recent call last): >>> File "", line 1, in ? >>> UnicodeEncodeError: 'ascii' codec can't encode character u'\

Re: who can give me the detailed introduction of re modle?

2006-05-19 Thread gene tani
softwindow wrote: > the re module is too large and difficult to study it's powerful, takes a little time to work with. Make yourself aware of the VERBOSE switch, RE debuggers in komodo and Wing, string functions/methods and when you need a full parser, also http://www.awaretek.com/tutorials.htm

Re: memory error with zipfile module

2006-05-19 Thread Ganesan Rajagopal
> Hari Sekhon <[EMAIL PROTECTED]> writes: > Traceback (most recent call last): > File "", line 1, in ? > File "D:\u\Python24\lib\zipfile.py", line 357, in read > bytes = dc.decompress(bytes) > MemoryError Looks like the .iso file is huge. Even if it's only a CD image (approx 650MB), r

problem with import autotest ...

2006-05-19 Thread bravegag
Hi all, Please beware I am new to Python and have little experience with it. I have a script that works just fine on linux but when I try to debug from Windows using Eclipse and PyDEV plugin then it does not work. The Python version is the same 2.3.x , and command line is roughly the same. from

Re: Encode exception for chinese text

2006-05-19 Thread Vinayakc
Yes serge, I have removed the first character but it is still giving encoding exception. -- http://mail.python.org/mailman/listinfo/python-list

Re: Encode exception for chinese text

2006-05-19 Thread John Machin
1. *By definition*, you can encode *any* Unicode string into utf-8. Proves nothing. 2. \u00a0 [no-break space] has no equivalent in gb2312, nor in the later gbk alias cp936. It does have an equivalent in the latest Chinese encoding, gb18030. 3. gb2312 is outdated. It is not really an "appropriate"

Python sqlite and regex.

2006-05-19 Thread Julien ARNOUX
Hi, I'd like to use regular expressions in sqlite query, I using apsw module but it doesn't work...Can you help me ? My script: import apsw import re path = 'db/db.db3' #regexp function (extract from python-list discusion) def regexp(expr, item): reg = re.compile(expr) return reg.match(i

Re: memory error with zipfile module

2006-05-19 Thread bruno at modulix
Hari Sekhon wrote: > I do > > import zipfile > zip=zipfile.ZipFile('d:\somepath\cdimage.zip') > zip.namelist() > ['someimage.iso'] > > then either of the two: > > A) file('someimage.iso','w').write(zip.read('someimage.iso')) > or > B) content=zip.read('someimage.iso') > > but both result in

Re: Encode exception for chinese text

2006-05-19 Thread Serge Orlov
Vinayakc wrote: > Yes serge, I have removed the first character but it is still giving > encoding exception. Then I guess this character was used as a poor man indentation tool at least in the beginning of your text. It's up to you to decide what to do with that character, you have several choices

Re: CFLAGS are not taken into account properly

2006-05-19 Thread Toon Knapen
[EMAIL PROTECTED] wrote: > Toon> But some other (but 'similar') functionality is broken. Now I > Toon> succeeded in compiling python. But when using distutils (e.g. when > Toon> installing numarray using the setup.py), python will compile the > Toon> files using the '-xarch=v9' opti

Re: Encode exception for chinese text

2006-05-19 Thread Vinayakc
Hey Serge, john, Thank you very much. I was really not aware of these facts. Anyways this is happening only for one in millions so I can ignore this for now. Thanks again, Vinayakc -- http://mail.python.org/mailman/listinfo/python-list

Re: Python sqlite and regex.

2006-05-19 Thread Dan Sommers
On Fri, 19 May 2006 14:47:10 +0200, Julien ARNOUX <[EMAIL PROTECTED]> wrote: > cur.execute("select foo from test where foo regex 'aa.[0-9])") > and the error is: > cur.execute('select foo from test where foo regex tata') > apsw.SQLError: SQLError: near "regex": syntax error I think you're missi

Re: Question about exausted iterators

2006-05-19 Thread Mel Wilson
[EMAIL PROTECTED] wrote: > Consider this example: > X = range(5) Y = iter(X) Z = iter(Y) > > As you can see, X is a container, and Y is an iterator. > They are simliar in that "iter" works on them both. > > Cristoph claims that this causes confusion. > Why? Because "iter" doesn't

noob import question

2006-05-19 Thread Brian Blazer
OK, I have a very simple class here: class Student: """Defines the student class""" def __init__(self, lName, fName, mi): self.lName = lName self.fName = fName self.mi = mi Then I have a small script that I am using as a test: from Student import * s1 = Stu

about py2exe, I installed it, but can't find py2exe.exe in my computer.

2006-05-19 Thread python
I installed it, but can't find py2exe.exe in my computer. why? And , when I execute "python setup.py py2exe" under command line, it prompt error:wrong command "py2exe" . -- http://mail.python.org/mailman/listinfo/python-list

Re: noob import question

2006-05-19 Thread Iain King
Brian Blazer wrote: > OK, I have a very simple class here: > > class Student: > """Defines the student class""" > > def __init__(self, lName, fName, mi): > self.lName = lName > self.fName = fName > self.mi = mi > > Then I have a small script that I am using as

Re: noob import question

2006-05-19 Thread Diez B. Roggisch
> I have tried to look up what is going on, but I have not found > anything. Would it be possible for someone to take a minute and give > an explanation? The from import <*|nameslist> syntax imports some or all names found in into the current modules namespace. Thus you can access your class.

Re: noob import question

2006-05-19 Thread Brian Blazer
Thank you for your responses. I had a feeling is had something to do with a namespace issue but I wasn't sure. You are right, I do come from a Java background. If it is poor form to name your class file the same as your class, can I ask what the standard is? Thanks again, Brian On May 19

Re: Programming language productivity

2006-05-19 Thread Harry George
"malv" <[EMAIL PROTECTED]> writes: [snip] > Once you get involved in larger projects, the dynamic nature of the > programming tool becomes much more important. I mean by this, the > ability to stop running code, modify or add to it and continue without > having to re-establish the state of the pro

Re: about py2exe, I installed it, but can't find py2exe.exe in my computer.

2006-05-19 Thread Fredrik Lundh
"python" wrote: > I installed it, but can't find py2exe.exe in my computer. why? why are you looking for an EXE file? py2exe is a Python module, not an application. > And , when I execute "python setup.py py2exe" under command line, it > prompt error:wrong command "py2exe" . you're supposed to

released: RPyC 2.60

2006-05-19 Thread gangesmaster
Remote Python Call (RPyC) has been released. this release introduces delivering objects, reducing memory consumption with __slots__, and several other new/improved helper functions. see the release notes and changelog (on the site) for more info. home: http://rpyc.wikispaces.com -tomer -- htt

Re: noob import question

2006-05-19 Thread Diez B. Roggisch
Brian Blazer wrote: > Thank you for your responses. I had a feeling is had something to do > with a namespace issue but I wasn't sure. > > You are right, I do come from a Java background. If it is poor form > to name your class file the same as your class, can I ask what the > standard is? Con

Re: Which is More Efficient?

2006-05-19 Thread Fredrik Lundh
Dustan wrote: > The task manager says "CPU Usage: 100%" when the program is running, > and only when the program is running. > > Efficiency is a measure of 2 things: CPU usage and time. If you measure > just time, you're not necessarily getting the efficiency. are you for real? -- http://m

Re: noob import question

2006-05-19 Thread PA
On May 19, 2006, at 15:33, Diez B. Roggisch wrote: > And it seems as if you have some JAVA-background, putting one class in > one > file called the same as the class. Don't do that, it's a stupid > restriction > in JAVA and should be avoided in PYTHON. Restrictive or not, what's so fundamental

Re: Script to make Windows XP-readable ZIP file

2006-05-19 Thread Grant Edwards
On 2006-05-19, softwindow <[EMAIL PROTECTED]> wrote: > Carl Banks is right That would be valuable information if we know what he was right about. -- Grant Edwards grante Yow! Bo Derek ruined at my life!

Re: calling python functions using variables

2006-05-19 Thread Grant Edwards
On 2006-05-19, bruno at modulix <[EMAIL PROTECTED]> wrote: >> Either deal with the resulting NameError exception (EAFP[0]) > > try: > getattr(commands, VARIABLE)() > except NameError: > print >> sys.stderr, "Unknown command", VARIABLE > >> or test >> first whether the attribute exists (LBYL[1]

Re: how to read a list from python in C?

2006-05-19 Thread skip
Lialie> I am writing a C extension with .Net. Now I have a list of Lialie> points, like [(0.0, 0.0), (2.0, 3.0), (random x, random y)]. Lialie> Is there a better way to translate it to an array than doing it Lialie> one by one? Are you passing a list as an argument to one of

Re: noob import question

2006-05-19 Thread Fredrik Lundh
"PA" <[EMAIL PROTECTED]> wrote: > Restrictive or not, what's so fundamentally devious in putting a class > declaration in a separate file whose name is that of the declared class > (class Queue -> Queue.py)? nothing. > Sounds like a handy way of organizing your code, no? sure, if you prefer to

Re: python vs perl lines of code

2006-05-19 Thread Terry Hancock
Edward Elliott wrote: >For inquiries into real-world code, it's enough to >believe that I'm not lying > Yeah, well, this is the internet -- I've gotten emails trying to sell me ex-soviet rocket-launchers and child porn.* So I don't make assumptions about people without some kind of evidence. Ther

Re: noob import question

2006-05-19 Thread bruno at modulix
Brian Blazer wrote: > OK, I have a very simple class here: > > class Student: class Student(object): > """Defines the student class""" > > def __init__(self, lName, fName, mi): > self.lName = lName > self.fName = fName > self.mi = mi Do yourself a favour: use me

Re: memory error with zipfile module

2006-05-19 Thread [EMAIL PROTECTED]
Take a look at the pywin32 extension, which I believe has some lower level memory allocation and file capabilities that might help you in this situation. If I'm completely wrong, someone please tell me XD. Of course, you could just make the read() a step process, reading, O lets say 8192 bytes at

Re: Tabs are *MISUNDERSTOOD*, *EVIL* AND *STUPID*, end of discussion. (Re: Tabs versus Spaces in Source Code)

2006-05-19 Thread Dave Hansen
On 19 May 2006 07:18:03 GMT in comp.lang.python, Duncan Booth <[EMAIL PROTECTED]> wrote: [...] >My experience of programming with either spaces or tabs has taught me >that tabs are evil not for themselves, but simply because no matter how >hard you try they always end up being mixed with spaces.

Re: the tostring and XML methods in ElementTree

2006-05-19 Thread Stefan Behnel
George Sakkis wrote: > Fredrik Lundh wrote: > >> [EMAIL PROTECTED] wrote: >> >>> I wanted to see what would happen if one used the results of a tostring >>> method as input into the XML method. What I observed is this: >>> a) beforeCtag.text is of type >>> b) beforeCtag.text when printed display

Re: [OT] noob import question

2006-05-19 Thread bruno at modulix
Brian Blazer wrote: please, dont top-post, and edit out irrelevant material > You are right, I do come from a Java background. Then you may want to read this: http://dirtsimple.org/2004/12/python-is-not-java.html HTH -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w

Re: number of different lines in a file

2006-05-19 Thread Terry Hancock
Fredrik Lundh wrote: >a for loop inside square brackets is a "list comprehension", and the >result is a list. if you use a list comprehension inside a function >call, the full list is built *before* the function is called. in this >case, this would mean that the entire file would be read into

how to make bibus with win32com into a exe file

2006-05-19 Thread oyster
Hi, everyone. http://bibus-biblio.sourceforge.net/ is a bibliographic and reference management software, which runs on windows/linux thru wxwidget. On windows, it uses win32com to insert reference into winword automatically. I have installed all the modules, and can launch and use bibus in my pyth

open file with whitespaces

2006-05-19 Thread mardif
Hi guys. I've a very big big big problem: I've in my windows computer a file named cicciobello.html, located in c:\documents and settings\username\desktop\cicciobello.html. Now, I MUST open this file with os.spawn(os.P_WAIT , because I must wait the user cancel the explorer window, ok? And so

Re: noob import question

2006-05-19 Thread bruno at modulix
PA wrote: > > On May 19, 2006, at 15:33, Diez B. Roggisch wrote: > >> And it seems as if you have some JAVA-background, putting one class in >> one >> file called the same as the class. Don't do that, it's a stupid >> restriction >> in JAVA and should be avoided in PYTHON. > > Restrictive or no

Re: import woe

2006-05-19 Thread Terry Hancock
vaibhav wrote: >4. add the root folder to your sys.path >so your jar.py file should have the following entries >from sys import path >path.append('../../../ROOT') > >note: i prefer relative paths > > Interesting that that works. I guess you could create a limited form of Zope acquisition type

CLAIM YOUR TWO FREE UNIVERSAL STUDIOS TICKETS!

2006-05-19 Thread SODIA17
  -- http://mail.python.org/mailman/listinfo/python-list

Re: WTF? Printing unicode strings

2006-05-19 Thread John Salerno
Fredrik Lundh wrote: > Ron Garret wrote: > > u'\xbd' >> u'\xbd' > print _ >> Traceback (most recent call last): >> File "", line 1, in ? >> UnicodeEncodeError: 'ascii' codec can't encode character u'\xbd' in >> position 0: ordinal not in range(128) > > so stdout on your machine is asci

SIGILL importing random

2006-05-19 Thread Mathias Waack
Hi all, I've embedded python into an older application and created some extensions to interact with the old data structures. Everythings works like a charm - beside a simple "import random". During import the whole process crashes with a SIGILL. I've found some older mails describing just the sam

Re: memory error with zipfile module

2006-05-19 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > Take a look at the pywin32 extension, which I believe has some lower > level memory allocation and file capabilities that might help you in > this situation. But then the solution would not be portable, which would be a shame since the zlib module (on which ZipFile reli

Re: memory error with zipfile module

2006-05-19 Thread Sion Arrowsmith
Hari Sekhon <[EMAIL PROTECTED]> wrote: >import zipfile >zip=zipfile.ZipFile('d:\somepath\cdimage.zip') >zip.namelist() >['someimage.iso'] [ ... ] >B) content=zip.read('someimage.iso') > >Traceback (most recent call last): > File "", line 1, in ? > File "D:\u\Python24\lib\zipfile.py", line 357

Re: open file with whitespaces

2006-05-19 Thread Christophe
mardif a écrit : > Hi guys. > I've a very big big big problem: > > I've in my windows computer a file named cicciobello.html, located in > c:\documents and settings\username\desktop\cicciobello.html. > > Now, I MUST open this file with os.spawn(os.P_WAIT , because I must > wait the user cance

Re: who can give me the detailed introduction of re modle?

2006-05-19 Thread John Salerno
softwindow wrote: > the re module is too large and difficult to study > > i need a detaild introduction. I don't know what your experience has been so far, but I have almost no programming experience beyond what I've taught myself, and I found the re module very easy to understand after reading

Re: open file with whitespaces

2006-05-19 Thread bruno at modulix
mardif wrote: > Hi guys. > I've a very big big big problem: I think a lot of people in the world would not find it so big wrt/ their own situation... > I've in my windows computer a file named cicciobello.html, located in > c:\documents and settings\username\desktop\cicciobello.html. > > Now,

Re: open file with whitespaces

2006-05-19 Thread Claudio Grondi
Christophe wrote: > mardif a écrit : > >> Hi guys. >> I've a very big big big problem: >> >> I've in my windows computer a file named cicciobello.html, located in >> c:\documents and settings\username\desktop\cicciobello.html. >> >> Now, I MUST open this file with os.spawn(os.P_WAIT , because

Re: Encode exception for chinese text

2006-05-19 Thread Martin v. Löwis
John Machin wrote: > 1. *By definition*, you can encode *any* Unicode string into utf-8. > Proves nothing. > 2. \u00a0 [no-break space] has no equivalent in gb2312, nor in the > later gbk alias cp936. It does have an equivalent in the latest Chinese > encoding, gb18030. Also, *by definition*, thou

Strange Memory Leaks

2006-05-19 Thread rodmc
I have written an application which seems to work fine most of the time and takes up about 26k when run. However when the PC (Windows 2k) is put to sleep/locked and the application is left to run it starts eating up memory, indeed about 400mb was the recent record. Is there any automated way of fi

  1   2   3   >