HI

2004-12-07 Thread tboer
The message contains Unicode characters and has been sent as a binary attachment. 您在 2004-12-08 15:53:[EMAIL PROTECTED];的邮件中的附件[readme.scr]�有病毒[readme.scr:W32/Lovgate-V]。 安全邮件网关所�的�作是: clean -- http://mail.python.org/mailman/listinfo/pyth

use embedded python to build a dll

2004-12-07 Thread newbie
Hi all, I got a problem using the embedded python. I'll be appreciated if some one can show me the way. What i want is, 1.build a dll(test.dll/test.lib) which uses the embedded python, for example, i want to use the 're' module. 2.build a exe(usedll.exe) which uses that dll. 3.use py2exe to elimin

Re: Unknown locale nb_NO ?

2004-12-07 Thread Denis S. Otkidach
On Tue, 07 Dec 2004 17:06:12 +0100 Stas Z <[EMAIL PROTECTED]> wrote: > When I 'googled' for it, I saw that no_NO has become nn_NO/nb_NO. > However it strikes me as odd, that Python2.3.4 raises an exception when > querying for a valid locale. I tend to call it a bug :-( Is it valid? Have you trie

Re: converting textobject to name of other object.

2004-12-07 Thread Peter Otten
Lars Tengnagel wrote: > I'm trying to use the matrix variable to collect a matrix in the file > MatrixInfo which contains a lot of different matrices. Yhe commented line > is the problem. > HOW ??? > import re > import MatrixInfo > > class Diff: > def __init__(self,filobj,matrix='pam25

Re: simple GUI question

2004-12-07 Thread Roose
> You want somthing like: > > root = Tkinter.Tk() > root.withdraw() > msg = tkMessageBox.showwarning("Ooops", "Some warning") Awesome thanks! Any chance you know about the font thing : ) Nah I'll stop being lazy and hack it... but for some reason Tkinter doesn't jive with the way I think at all.

Re: Why I can't launch python 2.4 final IDLE?

2004-12-07 Thread Jean Brouwers
This is the second time you ask the same question. Did you miss the answer to the first one? This is a known problem. More details at /Jean Brouwers In article <[EMAIL PROTECTED]>, AnkyHe <[EMAIL PR

Re: memoize factorial example (was Re: decorators ?)

2004-12-07 Thread Terry Reedy
"Tim Peters" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Terry, since you're talking about "the rabbit problem", are you sure > you're talking about the factorial example? It sounds like you're > talking about the Fibonacci example. Of course. 0! is 1 multiplied by nothing (n

HTML Structure Extraction

2004-12-07 Thread dayzman
Hi, I'm going to write a program that extracts the structure of HTML documents. The structure would be in the form of a tree, separating the tags and grouping the start and end tags. I think I will use htmllib.HTMLParser, is it appropriate for my application? If so, I believe I will need to keep t

Re: after embedding and extending python (using swig) problem importing (non-core) modules

2004-12-07 Thread Donnie Leen
Du you use program in linux? I work in windows, but I think it's a way to tell your program the module path like this: char path[MAX_PATH], cpy_cmd[MAX_PATH]; GetCurrentDirectory( MAX_PATH, path ); sprintf( cpy_cmd, "sys.path.append(r\'%s\\modules\')", path ); PyRun_SimpleString("import sys");

Re: Python for Palm OS?

2004-12-07 Thread Paul McGuire
"Maurice LING" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Or has anyone envisioned anything? > > Cheers > Maurice I just envisioned myself sipping a Mai Tai on a white sand beach, the surf gently murmuring in my ears, while getting a backrub from Carmen Electra. -- Paul --

Your message to Magick-announce awaits moderator approval

2004-12-07 Thread magick-announce-bounces
Your mail to 'Magick-announce' with the subject Re: Thanks! Is being held until the list moderator can review it for approval. The reason it is being held: Post by non-member to a members-only list Either the message will get posted to the list, or you will receive notification of the

Re: after embedding and extending python (using swig) problem importing (non-core) modules

2004-12-07 Thread Donnie Leen
Du you use program in linux? I work in windows, but I think it's a way to tell your program the module path like this:    char path[MAX_PATH], cpy_cmd[MAX_PATH]; GetCurrentDirectory( MAX_PATH, path ); sprintf( cpy_cmd, "sys.path.append(r\'%s\\modules\')", path );    PyRun_SimpleStri

opinions comments needed for improving a simple template engine.

2004-12-07 Thread Wensheng
Hi, I wrote a small template engine called spytee. Like any template enigne, it take a text(html) template file as input, process the variable tags in the file, and display the resulted text. The difference from most templates are: you can edit the template file in the html editor(Frontpage, Dreamw

Re: after embedding and extending python (using swig) problem importing (non-core) modules

2004-12-07 Thread vincent wehren
stefan wrote: Hi Folks, I currenty extended some of my C++ functionality to python and also embedded python to use python functionality in my C++ system (and use as well these extended functions). While this works fine with the core python functionality, as soon as I run a script (on the embedded s

Re: regex for url paramter

2004-12-07 Thread Paul McGuire
"Robert Brewer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Andreas Volz wrote: > I try to extract a http target from a URL that is given as parameter. > urlparse couldn't really help me. I tried it like this > > url="http://www.example.com/example.html?url=http://www.exampl > e.org

Unicode docstrings in PyMethodDef?

2004-12-07 Thread Craig Ringer
Hi folks I'm currently working on a fairly well internationalised app that embeds a Python intepreter. I'd like to make the docstrings translatable, but am running into the issue that the translation function returns unicode data. Does anybody here know what encoding docstrings in PyMethodDef are

Re: Python for Palm OS?

2004-12-07 Thread Maurice LING
Peter Hansen wrote: Erik Max Francis wrote: I just got myself a new Treo 650 and was looking around for Python for Palm projects. The only ones I find are Pippy http://pippy.sourceforge.net/ and Python to Palm Pilot Port http://www.isr.uci.edu/projects/sensos/python/ both of which look t

Re: simple GUI question

2004-12-07 Thread vincent wehren
Roose wrote: I have been writing only command line programs in python, and I need a way to simply pop up a GUI dialog box, with an "OK" box. Simple huh? I have used tkMessageBox.showwarning. This works OK but it also pops up an empty frame -- i.e. it pops up 2 things. Is there a way to disable t

simple GUI question

2004-12-07 Thread Roose
I have been writing only command line programs in python, and I need a way to simply pop up a GUI dialog box, with an "OK" box. Simple huh? I have used tkMessageBox.showwarning. This works OK but it also pops up an empty frame -- i.e. it pops up 2 things. Is there a way to disable this, or is t

Re: Python installation breaks Outlook Express

2004-12-07 Thread JanC
Mike schreef: > I have the same problem. It isn't a problem with Outlook. It is with > Python. I loose my wired AND wireless connections. Removing Python > bringst them back to operational. > Mike I don't know about the wired/wireless connections above, but this: > M. Laymon wrote: >> I just

after embedding and extending python (using swig) problem importing (non-core) modules

2004-12-07 Thread stefan
Hi Folks, I currenty extended some of my C++ functionality to python and also embedded python to use python functionality in my C++ system (and use as well these extended functions). While this works fine with the core python functionality, as soon as I run a script (on the embedded system) which

Re: 3D plotting library / OpenGL

2004-12-07 Thread Mike C. Fletcher
I've got a collection of 3D libraries here: http://www.vrplumber.com/py3d.py?category=retained http://www.vrplumber.com/py3d.py?category=science My own OpenGLContext would likely handle what you've described. It's scenegraph based, can handle fairly large-ish worlds, allows for writing mou

Why I can't launch python 2.4 final IDLE?

2004-12-07 Thread AnkyHe
I downloaded the python 2.4 final from the offical website and installed it on WindowsXP+SP2 (Chinese version). There was not any problem in this process, but the IDLE can't be launched without any warnning. Is there anybody else encount this problem and how to resolve it? Thanks! -- http:

Re: 2D array

2004-12-07 Thread Steven Bethard
LutherRevisited wrote: I'm wanting to do something with a list that is basically a 2 dimensional array. I'm not so good with lists so can someone give me an example of how I might implement this in Python? thanks. If you're planning to do anything serious with a 2D array, you should probably loo

Re: Help with generators outside of loops.

2004-12-07 Thread Steven Bethard
Robert Brewer wrote: Christopher J. Bottaro wrote: I have a generator that works like this: for row in obj.ExecSQLQuery(sql, args): # process the row Now there are some querys that run where I know the result will only be a single row. Is there anyway to get that single row from the genera

Re: How is Python designed?

2004-12-07 Thread LutherRevisited
Kinda off subject, just thought I'd add that 0! = 1 for that recursion example, since that wasn't considered. Nice post though. -- http://mail.python.org/mailman/listinfo/python-list

Re: 3D plotting library / OpenGL

2004-12-07 Thread Robert Kern
Andrew Dalke wrote: I've been looking for a decent 3D plotting library with support for user selection that works under OpenGl, preferable with wxPython. For this first project I need to do a 3D scatter plot with different colors and glyphs (spheres, crosses, etc.) for the points. The axes will be

Re: memoize factorial example (was Re: decorators ?)

2004-12-07 Thread Fernando Perez
Fernando Perez wrote: > No, fact(0)==1 simply because any proper definition of a factorial has to > match > up with the gamma function (offset by one) at all non-negative integers. So > there's no room for any ambiguity here. I should have added a link to the ever-useful mathworld: http://mathw

Re: 3D plotting library / OpenGL

2004-12-07 Thread Fernando Perez
Andrew Dalke wrote: > I've been looking for a decent 3D plotting library with support > for user selection that works under OpenGl, preferable with wxPython. > > For this first project I need to do a 3D scatter plot with > different colors and glyphs (spheres, crosses, etc.) for the points. > The

Re: memoize factorial example (was Re: decorators ?)

2004-12-07 Thread Fernando Perez
Terry Reedy wrote: > > "Daniel 'Dang' Griffith" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> But the factorial example on the wiki has a defect. It incorrectly >> calculates factorial(0) as 0, when it should be 1. > > This is a matter of definition, and definitions apparentl

Syck (yaml) for win32?

2004-12-07 Thread Jane Austine
Hello. I love yaml. I've been using PyYaml and heard it's far behind Syck in its functionality and performance. I'd like to try Syck with python but I have to compile it for my windows machine -- and it seems a very difficult work :I don't use cygwin. Does anyone have the binaries for win32? Ja

2D array

2004-12-07 Thread LutherRevisited
I'm wanting to do something with a list that is basically a 2 dimensional array. I'm not so good with lists so can someone give me an example of how I might implement this in Python? thanks. -- http://mail.python.org/mailman/listinfo/python-list

3D plotting library / OpenGL

2004-12-07 Thread Andrew Dalke
I've been looking for a decent 3D plotting library with support for user selection that works under OpenGl, preferable with wxPython. For this first project I need to do a 3D scatter plot with different colors and glyphs (spheres, crosses, etc.) for the points. The axes will be labeled and I would

Re: memoize factorial example (was Re: decorators ?)

2004-12-07 Thread Tim Peters
[Daniel 'Dang' Griffith] >> But the factorial example on the wiki has a defect. It incorrectly >> calculates factorial(0) as 0, when it should be 1. [Terry Reedy] > This is a matter of definition, and definitions apparently differ. > fact(0) == 0 is a backward projection from the definition f(1)

Re: Book Recommendations

2004-12-07 Thread JanC
Nathan schreef: > The link doesn't work -- maybe because of the new google groups > interface? > Can you repost with a working link? I think it's this: -- JanC "Be strict when sending and tolerant when

Re: memoize factorial example (was Re: decorators ?)

2004-12-07 Thread Terry Reedy
"Daniel 'Dang' Griffith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > But the factorial example on the wiki has a defect. It incorrectly > calculates factorial(0) as 0, when it should be 1. This is a matter of definition, and definitions apparently differ. fact(0) == 0 is a b

deferred decorator

2004-12-07 Thread Bryan
i was intrigued with a recently posted cookbook recipe which implements deferred results with decorators: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/355651 the problem i see with this recipe is that the author only tested his code by printing the values which causes __getattr__ to b

Re: Python for Palm OS?

2004-12-07 Thread Peter Hansen
Erik Max Francis wrote: I just got myself a new Treo 650 and was looking around for Python for Palm projects. The only ones I find are Pippy http://pippy.sourceforge.net/ and Python to Palm Pilot Port http://www.isr.uci.edu/projects/sensos/python/ both of which look to be rather stale.

Python consultant

2004-12-07 Thread Adam
I know Java and C very well, and I've also decided to learn python. I am currently coding a web based massively multiplayer Nation Simulation with Python(that's how I learn languages, I undertake fairly large projects.) My friend and I have written a lot of it, and we started a project on sourcefor

Re: Import a module without executing it?

2004-12-07 Thread Kent Johnson
Jay O'Connor wrote: The real question, I suppose, is "what is a good technique to find what modules and classes implement or refer to particular names" You might like to try ctags. I have had a good experience with it. It's not as automatic as I would like - you have to build a cross-reference ta

Re: PIL for Windows for Python 2.4

2004-12-07 Thread Peter Hansen
Scott F wrote: As there is no build for Python 2.4, I attempted to put it together from source. Running setup.py build gives this error: Traceback (most recent call last): File "C:\tmp\PIL\Imaging-1.1.4\setup.py", line 60, in ? for line in open(os.path.join("libImaging", "ImConfig

Re: why python is slower than java?

2004-12-07 Thread JanC
Eric S. Johansson schreef: > nothing would compel anyone to pay anything. But I could see eventually > folks being rated on whether or not they do pay. If you've got someone > who's always asking time-consuming questions and not paying anything, it > would be totally appropriate to filter out

concurrent telnet sessions/consoles

2004-12-07 Thread Tony Pryor
hello, is anyone using python to spawn multiple concurrent telnet client consoles? i've tried to use concurrent telnet consoles in perl and feel like i'm getting snared by library idiosyncrasies. tony -- http://mail.python.org/mailman/listinfo/python-list

Re: Upgrading Python Article

2004-12-07 Thread Jive
I had to back out of 2.4. In time I'll upgrade. It's not really fair to blame windoze for the incompatibility. It is possible to make software backward compatible with shared libraries. But you need a plan. The windoze plan is based on COM in its various guises. Of course, it's not standard o

Problem while trying to extract a directory from a zipfile.

2004-12-07 Thread ralobao
I have this code: try: file = zipfile.ZipFile(nome_arquivo) Gauge.start() #inicia o Gauge for element in file.namelist(): try: newFile = open(diretorio + element,"wb") except: newFile = open(diretorio + element + '

Re: Help with generators outside of loops.

2004-12-07 Thread David Eppstein
In article <[EMAIL PROTECTED]>, "Robert Brewer" <[EMAIL PROTECTED]> wrote: > > But I'm guessing that you can't index into a generator as if > > it is a list. > > row = obj.ExecSQLQuery(sql, args).next() I've made it a policy in my own code to always surround explicit calls to next() with try

Re: Import a module without executing it?

2004-12-07 Thread Jay O'Connor
Lonnie Princehouse wrote: The real question, I suppose, is "what is a good technique to find what modules and classes implement or refer to particular names" I think your best bet is still to import the module and introspect it. It will execute some code, but (by convention) simply importing a mod

Re: Import a module without executing it?

2004-12-07 Thread Lonnie Princehouse
> The real question, I suppose, is "what is a good technique to find what > modules and classes implement or refer to particular names" I think your best bet is still to import the module and introspect it. It will execute some code, but (by convention) simply importing a module doesn't usually un

RE: Help with generators outside of loops.

2004-12-07 Thread Robert Brewer
Christopher J. Bottaro wrote: > I have a generator that works like this: > > for row in obj.ExecSQLQuery(sql, args): > # process the row > > Now there are some querys that run where I know the result > will only be a > single row. Is there anyway to get that single row from the generato

Help with generators outside of loops.

2004-12-07 Thread Christopher J. Bottaro
I have a generator that works like this: for row in obj.ExecSQLQuery(sql, args): # process the row Now there are some querys that run where I know the result will only be a single row. Is there anyway to get that single row from the generator without having to use it in a for loop? I wa

Re: Help with super()

2004-12-07 Thread Christopher J. Bottaro
Thank you everyone for the help, that cleared it up for me. Andy Gross wrote: > > Florian, > > See: http://www.python.org/doc/newstyle.html > > /arg > > > On Dec 7, 2004, at 5:38 AM, Florian Lindner wrote: > >> Steven Bethard schrieb: >>> Christopher J. Bottaro wrote: Why don't this co

Pmw.ScrolledText

2004-12-07 Thread Donald L. Dietmeyer
I am attempting to put together a "dumb terminal" using a Pmw.ScrolledText to communicate via a serial port with a box that does the echoing of characters it receives. How can I stop the ScrolledText from echoing characters typed to it? Or lacking that, how can I know when a character has been ec

Python for Palm OS?

2004-12-07 Thread Erik Max Francis
I just got myself a new Treo 650 and was looking around for Python for Palm projects. The only ones I find are Pippy http://pippy.sourceforge.net/ and Python to Palm Pilot Port http://www.isr.uci.edu/projects/sensos/python/ both of which look to be rather stale. They're both bas

Re: Python 2.3.5 ?

2004-12-07 Thread It's me
Not to mention that there are packages out there that doesn't work (yet) with 2.4. Pynum is one such package. -- It's me "Larry Bates" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Just because 2.4 arrives doesn't mean that ALL work is stopped > on 2.3. It is quite common to ha

Re: sys.stdin.read question

2004-12-07 Thread It's me
Yes, if I run the script from the command prompt, it works. I was running it inside the Python IDE. Thanks, -- It's me "Grant Edwards" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 2004-12-07, It's me <[EMAIL PROTECTED]> wrote: > > >> Dunno. Works fine for me under 2.3.4, a

Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread Steven Bethard
It's me wrote: For simplicity sake, let's say I need to do something like this (for whatever reason): If I had a situation like this, I'd probably store my 'variables' as keys in a dict, e.g.: >>> bindings = {} >>> for i in range(3): ... name = raw_input('Name: ') ... value = int(raw_i

RE: regex for url paramter

2004-12-07 Thread Robert Brewer
Andreas Volz wrote: > I try to extract a http target from a URL that is given as parameter. > urlparse couldn't really help me. I tried it like this > > url="http://www.example.com/example.html?url=http://www.exampl > e.org/exa > mple.html" > > p = re.compile( '.*url=') > url = p.sub( '', url) >

regex for url paramter

2004-12-07 Thread Andreas Volz
Hi, I try to extract a http target from a URL that is given as parameter. urlparse couldn't really help me. I tried it like this url="http://www.example.com/example.html?url=http://www.example.org/exa mple.html" p = re.compile( '.*url=') url = p.sub( '', url) print url > http://www.example.org/e

Re: Python 2.3.5 ?

2004-12-07 Thread Larry Bates
Just because 2.4 arrives doesn't mean that ALL work is stopped on 2.3. It is quite common to have releases overlap. The very newest release is put out (2.4) , but bugs are still being fixed in older (2.3). Larry Bates Luis M. Gonzalez wrote: I'm confussed... Python 2.4 (final) hs been released a

Re: Python 2.3.5 ?

2004-12-07 Thread Tim Peters
[Luis M. Gonzalez] > I'm confussed... > Python 2.4 (final) hs been released a few days ago, but now I > see that Python 2.3.5 is being worked on. > Why? What does it mean? Just that enough volunteers exist interested in producing another bugfix release for the 2.3 line. It will probably be the la

converting textobject to name of other object.

2004-12-07 Thread Lars Tengnagel
I'm trying to use the matrix variable to collect a matrix in the file MatrixInfo which contains a lot of different matrices. Yhe commented line is the problem. HOW ??? import re import MatrixInfo class Diff: def __init__(self,filobj,matrix='pam250',begin=0,end='none'): self.fil

Re: Sorting in huge files

2004-12-07 Thread Larry Bates
Paul, I can pretty much promise you that it you really have 10^8 records they should be put into a database and let the database do the sorting by creating indexes on the fields that you want. Something like MySQL should do nicely and is free. http://www.mysql.org Python has good interface to mysql

memoize factorial example (was Re: decorators ?)

2004-12-07 Thread Daniel 'Dang' Griffith
On Tue, 30 Nov 2004 19:38:46 GMT, "Paul McGuire" <[EMAIL PROTECTED]> wrote: >"km" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> Hi all, >> was going thru the new features introduced into python2.4 version. >> i was stuck with 'decorators' - can someone explain me the need of su

Re: Sorting in huge files

2004-12-07 Thread Scott David Daniels
Paul wrote: I have a large database of 15GB, consisting of 10^8 entries of approximately 100 bytes each. or 10 gigabytes of data. A few thoughts on this: - Space is not going to be an issue. I have a Tb available. I presume this is disk space, not memory. If you do have a Tb of RAM and you are us

Re: sys.stdin.read question

2004-12-07 Thread Lars Tengnagel
Hej Caleb and others I've been strugling with the same problem where i try to use popen3 to run a program. If I use a piped commandline the program can read the file without problems but in the IDLE and with popen it comes with an error. I haven't been able to read the stdin either so the proble

Re: Import a module without executing it?

2004-12-07 Thread Andy Gross
So, in Smalltalk, the way you find out about what's in the system is reflection...you ask the classes what methods they implement (if looking for 'implementors'), you ask the methods for the source and can string search the code (if looking for senders). There's no real way to get the source cod

Re: PDF count pages

2004-12-07 Thread davidb
Andreas Lobinger wrote: > > Jose Benito Gonzalez Lopez wrote: > > Does anyone know how I could do in order > > to get/count the number of pages of a PDF file? > > Like this ? [...] > >>> import pdffile > >>> pf = pdffile.pdffile('../rfc1950.pdf') > >>> import pages > >>> pp = pages.pages(pf) >

Re: PDF count pages

2004-12-07 Thread davidb
Andreas Lobinger wrote: > > Jose Benito Gonzalez Lopez wrote: > > Does anyone know how I could do in order > > to get/count the number of pages of a PDF file? > > Like this ? [...] > >>> import pdffile > >>> pf = pdffile.pdffile('../rfc1950.pdf') > >>> import pages > >>> pp = pages.pages(pf) >

Python 2.3.5 ?

2004-12-07 Thread Luis M. Gonzalez
I'm confussed... Python 2.4 (final) hs been released a few days ago, but now I see that Python 2.3.5 is being worked on. Why? What does it mean? -- http://mail.python.org/mailman/listinfo/python-list

Python 2.3.5 ?

2004-12-07 Thread Luis M. Gonzalez
I'm confussed... Python 2.4 (final) hs been released a few days ago, but now I see that Python 2.3.5 is being worked on. Why? What does it mean? -- http://mail.python.org/mailman/listinfo/python-list

Re: sys.stdin.read question

2004-12-07 Thread Grant Edwards
On 2004-12-08, Caleb Hattingh <[EMAIL PROTECTED]> wrote: > It runs properly in a shell (bash), but on another matter: > > '>>> r=sys.stdin.read(1) > g > '>>> r > 'g' > '>>> r=sys.stdin.read(5) > 1234567890 > '>>> r > '\n1234' > '>>> > > What exactly happened to my 1234567890? I understand that I

Re: sys.stdin.read question

2004-12-07 Thread Grant Edwards
On 2004-12-07, It's me <[EMAIL PROTECTED]> wrote: >> Dunno. Works fine for me under 2.3.4, and according to the >> docs, should work under 2.4. >> >> What do you get when you do this: >> >> import sys > > Done that. > >> type(sys.stdin) > > I get: > > > >> dir(sys.stdin) > > I get: > > ['_

Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread It's me
Thanks for all the replies and yes I realize the associated issue of doing something like this. For simplicity sake, let's say I need to do something like this (for whatever reason): In situations like this, I wouldn't know the name of the variable in Python I need to use ahead of time and so

Re: Win32 Libs for 2.4

2004-12-07 Thread Robin Becker
Martin v. Löwis wrote: Robin Becker wrote: I don't think this forces the linker to load stuff from this module although I can see that it might be dangerous depending on which obj files are seen first. I think you are wrong. In the object, there will be simply a linker command line option encode

Re: Import a module without executing it?

2004-12-07 Thread Jay O'Connor
[EMAIL PROTECTED] wrote: Functions and classes are created during the very execution you're trying to skip so there's no precise way to do what you want. That said, you can parse the code without executing it, and that will give you some information about defined functions and classes. It will _n

Re: Sorting in huge files

2004-12-07 Thread Steven Bethard
Paul wrote: Is this reasonnable to do on 10^8 elements with repeats in the keys? I guess I should just try and see for myself. Yeah, that's usually the right solution. I didn't comment on space/speed issues because they're so data dependent in a situation like this, and without actually looking

Re: Sorting in huge files

2004-12-07 Thread Paul
I really do need to sort. It is complicated and I haven't said why, but it will help in finding similar keys later on. Sorry I can't be more precise, this has to do with my research. Your two other suggestions with itertools and operator are more useful, but I was mostly wondering about performanc

Re: sys.stdin.read question

2004-12-07 Thread It's me
"Grant Edwards" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 2004-12-07, It's me <[EMAIL PROTECTED]> wrote: > > Why do I get an "AttributeError: read" message when I do: > > > > import sys > > r=sys.stdin.read() > > Dunno. Works fine for me under 2.3.4, and according to

Re: cookie lib policy how-tp?

2004-12-07 Thread Marc Christiansen
Riko Wichmann <[EMAIL PROTECTED]> wrote: > Jonathan Ellis wrote: >> >> Sounds like your first step should be to identify yourself as IE. >> >> opener = urllib2.build_opener(...) >> opener.addheaders = [("User-Agent", "whatever IE calls itself these >> days")] >> >> -Jonathan >> > > Tried that

Re: [BUG] IMO, but no opinions? Uncle Tim? was: int(float(sys.maxint)) buglet ?

2004-12-07 Thread Tim Peters
[Tim Peters] >> ... there's no promise anywhere, e.g., that Python will return an int >> whenever it's physically possible to do so. [Bengt Richter] > Ok, I understand the expediency of that policy, but what is now the meaning > of int, in that case? Is it now just a vestigial artifact on the way

Re: Sorting in huge files

2004-12-07 Thread Paul
I really do need to sort. It is complicated and I haven't said why, but it will help in finding similar keys later on. Sorry I can't be more precise, this has to do with my research. Your two other suggestions with itertools and operator are more useful, but I was mostly wondering about performanc

Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread It's me
Yes, Russell, what you suggested works. I have to chew more on the syntax to see how this is working. because in the book that I have, it says: exec code [ in globaldict [, localdict] ] ... -- It's me "Russell Blau" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "It's me"

Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread Steven Bethard
It's me wrote: How do I do something like this: I know that a = 3 y = "a" print eval(y) would give me a print out of 3 - but how do I do something to the effect of: eval(y) = 4# hopefully the value of a gets changed to 4 Generally, if you find yourself doing this, you may want t

Re: sys.stdin.read question

2004-12-07 Thread Caleb Hattingh
It runs properly in a shell (bash), but on another matter: '>>> r=sys.stdin.read(1) g '>>> r 'g' '>>> r=sys.stdin.read(5) 1234567890 '>>> r '\n1234' '>>> What exactly happened to my 1234567890? I understand that I am only taking 5 characters, but where does the newline (\n) come from? Is that a

Re: Sorting in huge files

2004-12-07 Thread Steven Bethard
Paul wrote: I expect a few repeats for most of the keys, and that s actually part of what I want to figure out in the end. (Said loosely, I want to group all the data entries having "similar" keys. For this I need to sort the keys first (data entries having _same_ key), and then figure out which ke

Re: sys.stdin.read question

2004-12-07 Thread Caleb Hattingh
Hi You are probably typing this within IDLE. Try it after starting python in a shell like DOS or Bash. Should work then (works for me, and I also get the AttributeError in IDLE. Thanks Caleb On Tue, 07 Dec 2004 21:15:51 GMT, It's me <[EMAIL PROTECTED]> wrote: Why do I get an "AttributeError:

Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread Craig Ringer
On Wed, 2004-12-08 at 05:12, It's me wrote: > There are many situations where this is useful. For instance, you might be > getting an input which is a string representing the name of a variable and > you wish to evaluate the expression (like a calculator application, for > instance). While I do

Re: Import a module without executing it?

2004-12-07 Thread finite . automaton
Functions and classes are created during the very execution you're trying to skip so there's no precise way to do what you want. That said, you can parse the code without executing it, and that will give you some information about defined functions and classes. It will _not_ give you actual funct

Re: sys.stdin.read question

2004-12-07 Thread Grant Edwards
On 2004-12-07, It's me <[EMAIL PROTECTED]> wrote: > Why do I get an "AttributeError: read" message when I do: > > import sys > r=sys.stdin.read() Dunno. Works fine for me under 2.3.4, and according to the docs, should work under 2.4. What do you get when you do this: import sys type(sy

Re: Import a module without executing it?

2004-12-07 Thread Andy Gross
On Dec 7, 2004, at 4:20 PM, Steven Bethard wrote: If you have source control over this file, you could write it with the more standard idiom... I should have mentioned this first. If you're just trying to avoid existing top-level code from being executed, use the if __name__ == "__main__" idiom

Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread Erik Max Francis
It's me wrote: In REXX, for instance, one can do a: interpret y' = 4' Since y contains a, then the above statement amongs to: a = 4 The direct equivalent in Python would be a = 3 y = 'a' exec '%s = 4' % y The better question would be whether or not this as useful as

Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread Russell Blau
"It's me" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > In REXX, for instance, one can do a: > > interpret y' = 4' > > Since y contains a, then the above statement amongs to: > > a = 4 > > There are many situations where this is useful. For instance, you might be > getti

Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread Caleb Hattingh
Sure, ok, I think I am with you now. You get a (e.g.) variable name as a string, and you KNOW how to evaluate it with "eval", but you also want to be able to assign back to (through) the string representation? One way (if I understand you correctly) is with the globals or locals dicts. Try

Re: Import a module without executing it?

2004-12-07 Thread Steven Bethard
Jay O'Connor wrote: -- def test(var): print var #main test(3) -- I want to be able to import this module so I can see "ah ha, this module defines a function called 'test'", but I don't want the code at the bottom executed during the import. If you have

Re: Import a module without executing it?

2004-12-07 Thread Andy Gross
Here's a quick example that will pull out all functions defined in the top-level of a module: --- #/usr/bin/env python from compiler import parse, walk from compiler.visitor import ASTVisitor testdata = r''' def aFunction(anArg): return anArg + 1 ''' class SimpleVisitor(ASTVisitor): def v

sys.stdin.read question

2004-12-07 Thread It's me
Why do I get an "AttributeError: read" message when I do: import sys r=sys.stdin.read() ?? I've tried: r=sys.stdin.read(80) r=sys.stdin.read(1) same error message. I couldn't find any reference to this function in my Python book (they have the stdout but not in). Some sample

Re: error on crude test of embedding python in c++ HELP PLEASE

2004-12-07 Thread Donnie Leen
Got it, thanks :) -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread It's me
"Caleb Hattingh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi It's me > > > > > a = 3 > > y = "a" > > print eval(y) > > > > To get 'a' to be 4 here, you would say > > a = 4 > Obviously but that's not what I wish to do. > I am not sure why you would want to do othe

Re: Import a module without executing it?

2004-12-07 Thread Caleb Hattingh
Andy thx for that. I had a file called 'tktest.py' lying around, and I did: '>>> a = compiler.parseFile('tktest.py') And "a" looks something like this: *** Stmt([Import([('Tkinter', None)]), Function(None, 'add_rows', ['w', 'titles', 'rows'], [], 0, None, Stmt([Discard(CallFunc(Getattr(Name('w')

Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread Caleb Hattingh
Hi It's me a = 3 y = "a" print eval(y) To get 'a' to be 4 here, you would say a = 4 I am not sure why you would want to do otherwise? Perhaps you could sketch out a little more about what you are trying to do? That would help a lot. Are you aiming for something like point

  1   2   >