Re: Generators vs. Functions?

2006-02-05 Thread Steven D'Aprano
On Sun, 05 Feb 2006 03:31:24 +, Neil Schemenauer wrote: > Peter Hansen <[EMAIL PROTECTED]> wrote: >> More precisely, the state of the function is *saved* when a yield >> occurs, so you certainly don't *recreate* it from scratch, but merely >> restore the state, and this should definitely be

Re: Does Python support a peek like method for its file objects?

2006-02-05 Thread Steven D'Aprano
On Sun, 05 Feb 2006 05:45:24 +, Avi Kak wrote: > Hello: > > Does Python support a peek like method for its file objects? > > I'd like to be able to look at the next byte in a disk file before > deciding whether I should read it with, say, the read() method. > Is it possible to do so

Re: Does Python support a peek like method for its file objects?

2006-02-05 Thread Steven D'Aprano
On Sun, 05 Feb 2006 19:25:21 +1100, Steven D'Aprano wrote: > On Sun, 05 Feb 2006 05:45:24 +, Avi Kak wrote: > >> Hello: >> >> Does Python support a peek like method for its file objects? >> >> I'd like to be able to look at the next byte in a disk file before >> deciding whether I sho

Re: Does Python support a peek like method for its file objects?

2006-02-05 Thread Blair P. Houghton
Avi Kak wrote: > Hello: > > Does Python support a peek like method for its file objects? > > I'd like to be able to look at the next byte in a disk file before > deciding whether I should read it with, say, the read() method. > Is it possible to do so in Python? > > Your answer would be m

Re: Does Python support a peek like method for its file objects?

2006-02-05 Thread Blair P. Houghton
Here's a version that should work in text mode as well: fp = file("some file on disk", "r") b = "" while 1: p = fp.tell() # peek at the next byte; moves file position only if a byte is read c = fp.read(1) # decide whether to read it if c == "?": # pretend we never read

Re: Generators vs. Functions?

2006-02-05 Thread Fredrik Lundh
Steven D'Aprano wrote: > So on the basis of my tests, there is a small, but significant speed > advantage to _calling_ a function versus _resuming_ a generator. now add state handling to your micro-benchmark, and see if the function example still runs faster. (hint: functions and generators do d

Re: OO conventions

2006-02-05 Thread Blair P. Houghton
Alex Martelli wrote: > As you see, static methods have a small extra lookup cost (a couple > hundred nanoseconds on my oldish laptop); I would've expected the opposite effect...I guess the runtime considers instances more active than the static portion of a class. > "Premature > optimization is

ActiveGrid and Python Frameworks.

2006-02-05 Thread Ravi Teja
Why is no one talking about ActiveGrid, which at least on the surface seems to be the most polished way to build web applications in Python so far. They have a sound financial backing, $10 million when I last heard, made news on non-Python circles, have a relatively friendly authoring environment

Re: how to run BeautifulSoup in Jython

2006-02-05 Thread Diez B. Roggisch
ye juan schrieb: > Hi, > > Anyone tries to use BeautifulSoup ( > http://www.crummy.com/software/BeautifulSoup/ ) in > Jython? I can not run that ,the error that Jython > gives me is: unpack sequence too long. You've asked that on th jython mailing list and got a negative answer. What makes you

jython newbee general question docu / os.fstat

2006-02-05 Thread Mark Fink
Hi there, unfortunately I am new to Jython and my "Jython Essentials" book is still in the mail. I looked into the Jython API Doc but could not find the information. I am porting a Python library to Jython and some parts are missing. My question basically is where do I find information on what to

Re: Generators vs. Functions?

2006-02-05 Thread Duncan Booth
Steven D'Aprano wrote: t1.timeit() > 0.63980388641357422 ... t2.timeit() > 0.82081794738769531 > > So on the basis of my tests, there is a small, but significant speed > advantage to _calling_ a function versus _resuming_ a generator. I get the same, but the difference is much less on

Booksigning Party at PyCon This Year!

2006-02-05 Thread Jeff Rush
Because many authors of books related to Python will be in attendance at PyCon, we would like to organize a book signing activity. It seems logical to hold it Saturday night at the party at the Nerdbooks.com bookstore. Bring your own books or buy new ones in the store! And if you're an author

Re: Generators vs. Functions?

2006-02-05 Thread Steven D'Aprano
On Sun, 05 Feb 2006 09:49:21 +0100, Fredrik Lundh wrote: > Steven D'Aprano wrote: > >> So on the basis of my tests, there is a small, but significant speed >> advantage to _calling_ a function versus _resuming_ a generator. > > now add state handling to your micro-benchmark, and see if the funct

rexec in jython??

2006-02-05 Thread Mark Fink
Hi there, I at the moment port a library from Python to Jython (at lease I try to do so :-))). The library uses the Rexec to form a type adapter to cast parameters given as text into the according Jython type. I learned rexec is not available in Jython. Is something that is commonly used in Jython

rexec in jython??

2006-02-05 Thread Mark Fink
Hi there, I at the moment port a library from Python to Jython (at lease I try to do so :-))). The library uses the Rexec to form a type adapter to cast parameters given as text into the according Jython type. I learned rexec is not available in Jython. Is something that is commonly used in Jython

Re: jython newbee general question docu / os.fstat

2006-02-05 Thread Diez B. Roggisch
Mark Fink schrieb: > Hi there, > > unfortunately I am new to Jython and my "Jython Essentials" book is > still in the mail. I looked into the Jython API Doc but could not find > the information. > I am porting a Python library to Jython and some parts are missing. My > question basically is where

New Mailing List for PyCon Technology and Conference Software

2006-02-05 Thread Jeff Rush
I have arranged for the creation of a new mailing list under python.org for the discussion of software development for PyCon, of any type and for any year. We've been sending a lot of email privately and making the process more visible would be good I think. There are a few disjoint efforts an

Re: rexec in jython??

2006-02-05 Thread Mark Fink
sorry for the double post! It is the r_eval() functionality of the rexec module I am looking forward to replace -- http://mail.python.org/mailman/listinfo/python-list

Re: rexec in jython??

2006-02-05 Thread Mark Fink
this is really funny... I tried to use eval(String) as an replacement. It works now but the calculation results from my tests are not as expected: 2 + 3 = 23 !!! 2 - 3 = 2-3... I have the feeling that there is a really easy solution for this. Unfortunately I have no enough experience -- http://ma

Re: fairly large webapp: from Java to Python. experiences?

2006-02-05 Thread AdSR
Giovanni Bajo wrote: > Also Python code is pretty bare-metal, so that > file.write or socket.write go to the syscall immediately. Try that in Java and > you'll find 30 layers of complex abstractions for doubtful benefits and > obvious > slowness. +1 QOTW (I'd recommend the whole post but it might

Re: rexec in jython??

2006-02-05 Thread Diez B. Roggisch
Mark Fink wrote: > this is really funny... > I tried to use eval(String) as an replacement. It works now but the > calculation results from my tests are not as expected: 2 + 3 = 23 !!! 2 > - 3 = 2-3... > I have the feeling that there is a really easy solution for this. > Unfortunately I have no en

Re: Webmail with Python

2006-02-05 Thread Thomas Guettler
On Sat, 04 Feb 2006 15:50:00 -0600, Larry Bates wrote: > Thomas Guettler wrote: >> Hi, >> >> Is there an application like Squirrelmail[1] written in python? >> >> I want to access IMAP folder with a web-browser. >> >> Google shows me some dead projects. Most webmail applications >> seem to be w

Re: Python vs C for a mail server

2006-02-05 Thread Magnus Lycka
John J. Lee wrote: > I guess the same is true of Python in some respects: it's still > incrementally changing (more than C++, I guess), and isn't all that > much younger than C++ (around 15 and 23 years old respectively). But C++ is almost entirely backwards compatible with C, which adds another d

Re: rexec in jython??

2006-02-05 Thread Mark Fink
This is the original code section of the library including the comments: class AutoAdapter(TypeAdapter): """ This adapter returns a type based on the format of the table cell contents, following python's rules for literals (plus a few others). We could fall back on this when we don'

Best way of finding terminal width/height?

2006-02-05 Thread Joel Hedlund
Hi all! I use python for writing terminal applications and I have been bothered by how hard it seems to be to determine the terminal size. What is the best way of doing this? At the end I've included a code snippet from Chuck Blake 'ls' app in python. It seems to do the job just fine on my com

Re: rexec in jython??

2006-02-05 Thread Diez B. Roggisch
Mark Fink wrote: > This is the original code section of the library including the > comments: > class AutoAdapter(TypeAdapter): > """ > This adapter returns a type based on the format of the table cell > contents, following python's rules for literals (plus a few > others). > We co

Re: Compiling

2006-02-05 Thread Magnus Lycka
Simon Faulkner wrote: > Pardon me if this has been done to death but I can't find a simple > explanation. > > I love Python for it's ease and speed of development especially for the > "Programming Challenged" like me but why hasn't someone written a > compiler for Python? > > I guess it's not

Interpreting Unicode scripts

2006-02-05 Thread Keith MacDonald
Hello, I am considering embedding Python in a C++ application, which works internally in UTF-16. The only API I can find for running scripts is PyRun_SimpleString(const char*). Does that mean that Python is unable to execute scripts containing characters from more than one code page? Thanks,

NumPy error

2006-02-05 Thread jason
Hello: I am using the following versions of Python and packages on Windows XP (SP2): Python 2.4.2 NumPy 0.9.4.win32-py2.4 SciPy 0.4.4 for Python 2.4 and Pentium 4/SSE2 In the Python Shell I am running the following: >>> from scipy.optimize import fmin >>> def rosen(x): return su

Re: Interpreting Unicode scripts

2006-02-05 Thread Fredrik Lundh
Keith MacDonald wrote: > I am considering embedding Python in a C++ application, which works > internally in UTF-16. The only API I can find for running scripts is > PyRun_SimpleString(const char*). Does that mean that Python is unable to > execute scripts containing characters from more than on

Re: Compiling

2006-02-05 Thread Ravi Teja
>> For short : this was kind of a joke... I understand that what you were looking for is a 'native code' compiler. AFAIK, this could of course be done, but due to Python's very dynamic nature, it's not sure this would lead to drastically better performances. This is a standard response to a rather

Re: Compiling

2006-02-05 Thread Fredrik Lundh
Ravi Teja wrote: > This is a standard response to a rather frequent question here. But I > am not sure I ever understood. Scheme / Lisp are about as dynamic as > Python. if that were fully true, it would be fairly trivial to translate Python to scheme or lisp and compile it. > Another standard r

Re: NumPy error

2006-02-05 Thread Diez B. Roggisch
jason wrote: > Hello: > > I am using the following versions of Python and packages on Windows XP > (SP2): > > Python 2.4.2 > NumPy 0.9.4.win32-py2.4 > SciPy 0.4.4 for Python 2.4 and Pentium 4/SSE2 I fell for that yesterday. Cost me two hours. You have to install NumPy 0.9.2. Make sure you clea

Re: rexec in jython??

2006-02-05 Thread Mark Fink
:-))) it works! I replaced it to "return eval(s)" and the results look extremely well guess I should get one of this crystal balls myself. one minor issue is still left: correct me if I am wrong: result of 2/-3 is 0 (at least this is how it is defined in the testcase) In Jython 2.1.3: >>> 2/-3 -1

Re: Best way of finding terminal width/height?

2006-02-05 Thread Grant Edwards
On 2006-02-05, Joel Hedlund <[EMAIL PROTECTED]> wrote: > I use python for writing terminal applications and I have been > bothered by how hard it seems to be to determine the terminal > size. What is the best way of doing this? The way used in the code you found. Alternatively, yould use ncurses,

Re: Compiling

2006-02-05 Thread Diez B. Roggisch
> This is a standard response to a rather frequent question here. But I > am not sure I ever understood. Scheme / Lisp are about as dynamic as > Python. Yet they have quite efficient native compilers. Ex: Bigloo > Scheme. If you provide the necessary annotations for optimization. Not sure about ru

Re: New Python.org website ?

2006-02-05 Thread Fredrik Lundh
> > If you build it, they will come. > http://pydotorg.dyndns.org:8000 -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python.org website ?

2006-02-05 Thread Chris Ditze-Stephan
Hi Fredrik Lundh schrieb: > > > > If you build it, they will come. > > > > http://pydotorg.dyndns.org:8000 Have access-problem. It's dnynds.org. Perhabs not everytime Online? bye Chris Ditze-Stephan > > ___ Chris Ditze-Stephan Zentric -- http://mail.python.org/mailman/listinfo/python

Re: New Python.org website ?

2006-02-05 Thread Fredrik Lundh
Chris Ditze-Stephan wrote: > > http://pydotorg.dyndns.org:8000 > Have access-problem. > It's dnynds.org. no, it's dyndns.org. did you make that typo in the browser too ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Thread imbalance

2006-02-05 Thread Ivan Voras
Peter Hansen wrote: > Ivan, what makes you say that Python is bad for threads? Did the > qualifcation "concurrently executing/computing" have some significance > that I missed? Because of the GIL (Giant interpreter lock). It can be a matter of opinion, but by "good threading implementation" I

Importing a class, please help...

2006-02-05 Thread anon
Hi, Newbie to Python and I have a question please. I am using Windows XP, SPE 0.8.2.a and Python24. I have done this: import sys print sys.path no problem there, sys imports just fine. I have a folder that I called c\JavaProjects\PythonTesting and it shows up in the output from sys.path ab

Re: Importing a class, please help...

2006-02-05 Thread Jorge Godoy
"anon" <[EMAIL PROTECTED]> writes: > to do an Import on it. This is where things fail. I cannot see the > contents of my Jar. What am I missing here? That JARs are for Java and yo're using Python? -- Jorge Godoy <[EMAIL PROTECTED]> "Quidquid latine dictum sit, altum sonatur." - Qualq

Learning Python

2006-02-05 Thread Byte
I know this is probably a stupid question, but I'm learning Python, and am trying to get the if function to work with letters/words. Basicly, I'm trying to write a script that when run, says Please enter your name: Then, if the user types myself as the name , the output is OK. Thats all I want it

Re: Importing a class, please help...

2006-02-05 Thread Xavier Morel
anon wrote: > Would somebody please drop me a hint, please? > Yeah, the definition of "JAR" is Java ARchive, why the hell would a Python script be able to read a JAR in the first place (truth is it is, a JAR file is nothing but a renamed ZIP, therefore the zipfile module allows you to read it's

Re: Learning Python

2006-02-05 Thread epost2
try: x = raw_input("Please enter your name: ") -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python

2006-02-05 Thread Xavier Morel
Byte wrote: > x = input(raw_input("Please enter your name: ")) > if x==myself: print 'OK' > > It kinda works - I can get to the please enter your name bit but then > it simply reprints your input as output. Someone please HELP! > --> C:\>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.13

Re: Generators vs. Functions?

2006-02-05 Thread Neil Schemenauer
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > Have you actually measured this, or are you just making a wild > guess? I haven't timed it until now but my guess it not so wild. I'm pretty familiar with the generator implementation (having written the initial version of it). In Python 2.3, resuming

Re: Learning Python

2006-02-05 Thread Florian Nykrin
Hi Byte! Your code should look like this: x = raw_input('Please enter your name: ') if x == 'myself': print 'OK' Because myself should be a string and not a variable name, you have to put it in quotes. Regards, Florian. -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python support a peek like method for its file objects?

2006-02-05 Thread Scott David Daniels
Avi Kak wrote: > Does Python support a peek like method for its file objects? A short answer is, "No, it does not." Peek was (I believe) put into Pascal to simplify certain problems; language processing , for example, is drastically simplified by 1-character look-ahead. Pascal was designed as

Re: Learning Python

2006-02-05 Thread Byte
Florian Nykrin, that works! Thanks! p.s. Xavier Morel, you seem to be using Windows, not Linux, and I got the idea of stacking input on a raw_input from the official Python Tutorial. -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python

2006-02-05 Thread Ivan Shevanski
On 2/5/06, Ivan Shevanski <[EMAIL PROTECTED]> wrote: On 2/5/06, Florian Nykrin <[EMAIL PROTECTED] > wrote: Hi Byte!Your code should look like this:x = raw_input('Please enter your name: ')if x == 'myself': print 'OK' Because myself should be a string and not a variable name, you have toput it

Re: Learning Python

2006-02-05 Thread Ivan Shevanski
On 2/5/06, Ivan Shevanski <[EMAIL PROTECTED]> wrote: On 2/5/06, Ivan Shevanski <[EMAIL PROTECTED] > wrote: On 2/5/06, Florian Nykrin <[EMAIL PROTECTED] > wrote: Hi Byte!Your code should look like this:x = raw_input('Please enter your name: ')if x == 'myself': print 'OK' Because myself shou

Re: Learning Python

2006-02-05 Thread Fredrik Lundh
Byte wrote: > p.s. Xavier Morel, you seem to be using Windows, not Linux, and I got > the idea of stacking input on a raw_input from the official Python > Tutorial. link, please. -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python

2006-02-05 Thread Luis M. González
Use "input" to enter numbers, and "raw_input" to enter strings. For example: x = input('Enter your age: ') y = raw_input('Enter your name: ') -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python

2006-02-05 Thread Fredrik Lundh
Byte wrote: > p.s. Xavier Morel, you seem to be using Windows, not Linux what makes you think that basic Python functions work in radically different ways on different platforms ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Interpreting Unicode scripts

2006-02-05 Thread Keith MacDonald
That document did help, thanks, although I was initially disconcerted to see that it's written in the future tense. Anyway, it works with Python 2.4. Keith MacDonald "Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > reading PEP 263 might help: > >http://www.py

Re: NumPy error

2006-02-05 Thread jason
Thanks. After executing the first line, I now get: >>> from scipy.optimize import fmin Overwriting fft= from scipy.fftpack.basic (was from numpy.dft.fftpack) Overwriting ifft= from scipy.fftpack.basic (was from numpy.dft.fftpack) And then I get the following result: >>> xopt = fmin(rosen, x

Re: Learning Python

2006-02-05 Thread Byte
>what makes you think that basic Python functions work in radically different ways on different platforms ? Assumption. Im also new to programing, so could do something stupid like think a Windows path is a command/input/etc. (really, ive done things like that before.) Now, im running this on a t

Re: Learning Python

2006-02-05 Thread Byte
http://docs.python.org/tut/node6.html#SECTION00610 -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python

2006-02-05 Thread Alex Martelli
Byte <[EMAIL PROTECTED]> wrote: > http://docs.python.org/tut/node6.html#SECTION00610 I think you're confusing the tutorial's use of: int(raw_input(... which means "get a string from the user and turn it into an integer" (a very common idiom), with your use of: input(raw_inp

how to kill a python process?

2006-02-05 Thread MackS
Hello! This question does not concern programming in python, but how to manage python processes. Is there a way to "name" a python process? At least on Linux, if I have two python programs running, they both run under the name "python" #pidof program1.py [empty line] #pidof program1.py [empty lin

Re: Learning Python

2006-02-05 Thread Xavier Morel
Byte wrote: > p.s. Xavier Morel, you seem to be using Windows, not Linux > I don't see how this may even remotely be relevant, Python is cross platform and (mostly) works the same regardless of the OS > I got > the idea of stacking input on a raw_input from the official Python > Tutorial. >

Re: Learning Python

2006-02-05 Thread Xavier Morel
Byte wrote: > http://docs.python.org/tut/node6.html#SECTION00610 > --> >>> x = int(raw_input("Please enter an integer: ")) <-- Unless my eyes fail me, it's written "int", not "input", the goal of this line is to convert the return value of raw_input (a string) into an integer.

Re: Learning Python

2006-02-05 Thread Byte
Thanks, never knew that, but they are using raw_input as a stack, aren't they? -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python

2006-02-05 Thread Xavier Morel
Byte wrote: > Assumption. Im also new to programing, so could do something stupid > like think a Windows path is a command/input/etc. (really, ive done > things like that before.) > Don't assume anything when you have no reason to, and especially don't assume that a cross-platform programming lan

Re: Learning Python

2006-02-05 Thread Byte
Yes, sorry, didnt realise diffrence between int and input. Since i'm such an idiot at this, any links to sites for people who need an unessicerily gentle learning curve? -- http://mail.python.org/mailman/listinfo/python-list

Re: Compiling

2006-02-05 Thread Ravi Teja
Fredrik Lundh wrote: > Ravi Teja wrote: > > > This is a standard response to a rather frequent question here. But I > > am not sure I ever understood. Scheme / Lisp are about as dynamic as > > Python. > > if that were fully true, it would be fairly trivial to translate Python to > scheme or lisp a

Re: NumPy error

2006-02-05 Thread Diez B. Roggisch
from scipy.optimize import fmin > Overwriting fft= from scipy.fftpack.basic (was > from numpy.dft.fftpack) > Overwriting ifft= from scipy.fftpack.basic (was > from numpy.dft.fftpack) > > And then I get the following result: > xopt = fmin(rosen, x0) > Optimization terminated successf

Re: how to kill a python process?

2006-02-05 Thread Diez B. Roggisch
MackS schrieb: > Hello! > > This question does not concern programming in python, but how to manage > python processes. Is there a way to "name" a python process? At least > on Linux, if I have two python programs running, they both run under > the name "python" > > #pidof program1.py > [empty li

Back-end for python.org

2006-02-05 Thread Steven Bethard
Fredrik Lundh wrote: >> >> If you build it, they will come. >> > > http://pydotorg.dyndns.org:8000 Very cool. I'd love to see something like this on the actual website... Is the hope that in the real python.org version edits will show up immediately, as they do in your version? Or that the

Re: NumPy error

2006-02-05 Thread Robert Kern
jason wrote: > Thanks. > > After executing the first line, I now get: > from scipy.optimize import fmin > > Overwriting fft= from scipy.fftpack.basic (was > from numpy.dft.fftpack) > Overwriting ifft= from scipy.fftpack.basic (was > from numpy.dft.fftpack) > > And then I get the followi

Re: Thread imbalance

2006-02-05 Thread Peter Hansen
Ivan Voras wrote: > Peter Hansen wrote: >>Ivan, what makes you say that Python is bad for threads? Did the >>qualifcation "concurrently executing/computing" have some significance >>that I missed? > > Because of the GIL (Giant interpreter lock). > ... > Much can be said about "at the same time"

How to create a unix shell account with Python?

2006-02-05 Thread Sebastjan Trepca
Hi! I couldn't find anything on creating a new linux user account in Python documentation. Anyone has any experience with this? You just run useradd command in shell or is there a more pythonic way? Thanks, Sebastjan -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python

2006-02-05 Thread Byte
>parse the expression, extract the operands and the operation, apply the operation to the operands How? Give me some example code, but please keep it simple. >are you trying to code a calculator? Not intending to, just trying to learn Python. Suppose what i'm trying to code is a but like a CLI c

Re: Importing a class, please help...

2006-02-05 Thread Jorgen Grahn
On Sun, 05 Feb 2006 17:16:38 +0100, Xavier Morel <[EMAIL PROTECTED]> wrote: > anon wrote: >> Would somebody please drop me a hint, please? >> > Yeah, the definition of "JAR" is Java ARchive, why the hell would a > Python script be able to read a JAR in the first place You are rude to an obvious

Re: Compiling

2006-02-05 Thread gene tani
Simon Faulkner wrote: > Pardon me if this has been done to death but I can't find a simple > explanation. > > I love Python for it's ease and speed of development especially for the > "Programming Challenged" like me but why hasn't someone written a > compiler for Python? > > I guess it's not that

Re: how to kill a python process?

2006-02-05 Thread Jorgen Grahn
On 5 Feb 2006 09:10:04 -0800, MackS <[EMAIL PROTECTED]> wrote: > Hello! > > This question does not concern programming in python, but how to manage > python processes. Is there a way to "name" a python process? At least > on Linux, if I have two python programs running, they both run under > the na

Get System Date?

2006-02-05 Thread Dustan
Is it possible to get the system date on a Windows XP machine? Most Convenient would to retrieve , MM, and DD as seperate variables. When I say system date, I'm thinking of the small clock in the lower-right hand corner, which has date as well as time, but if there's another clock that Python

Re: Compiling

2006-02-05 Thread Ravi Teja
Actually optimizations are not what concern me. I am pretty happy with Pyrex/Swig etc for that. What I want is the ability to make a native DLL/SO. A whole lot easier to integrate/embed to other languages. -- http://mail.python.org/mailman/listinfo/python-list

Re: Get System Date?

2006-02-05 Thread Rene Pijlman
Dustan: >Is it possible to get the system date on a Windows XP machine? Most certainly: http://www.python.org/doc/lib/module-time.html -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: Generators vs. Functions?

2006-02-05 Thread Steven D'Aprano
On Sun, 05 Feb 2006 16:14:54 +, Neil Schemenauer wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> Have you actually measured this, or are you just making a wild >> guess? > > I haven't timed it until now but my guess it not so wild. I'm > pretty familiar with the generator implementati

Re: triple quoted strings as comments

2006-02-05 Thread Jorgen Grahn
On Wed, 01 Feb 2006 13:41:33 GMT, Roel Schroeven <[EMAIL PROTECTED]> wrote: > Roy Smith schreef: ... >> /* */ also allows for some truly spectacularly bad coding practices. Not >> long ago, I ran into some real-life code where a previous developer had >> commented out about 50 lines of C++ code

Re: Get System Date?

2006-02-05 Thread Dave
Dustan, Python has a module called, appropriately, "time". Like most things in Python, it's fairly simple and straightforward to use. The module is documented here: http://docs.python.org/lib/module-time.html Breifly, though, the format you want is built right into time: >>> import time >>> now

translating PHP to Python

2006-02-05 Thread Dave
Anyone familiar with PHP? I'm trying to make a translation. In PHP you can get the current object's name by going like this: get_class(item) == 'ClassName' I've tried type(item), but since I can't be sure if I'll be in __main__ or as a child object, I can't guarantee what that value will return,

Re: Learning Python

2006-02-05 Thread Xavier Morel
Byte wrote: >> parse the expression, extract the operands and the operation, apply the > operation to the operands > > How? Give me some example code, but please keep it simple. > >> are you trying to code a calculator? > > Not intending to, just trying to learn Python. Suppose what i'm trying >

what's wrong with my popen reasoning?

2006-02-05 Thread Rick Spencer
Hi all, I am very new to Python programming. I am writing a program to manage wireless connections, this is for GNOME on Linux. I present the user with a "connect" button. I want to handle the connection for them slightly different depending on whether or not the wireless access point they are try

Re: translating PHP to Python

2006-02-05 Thread Farshid Lashkari
> Is there a simple way to get the current object's name? You would think > __name__ would work, right? It doesn't. className = item.__class__.__name__ > I'd like to avoid passing a reference to an object's parent in > __init__, but is there a built in way in Python to say "You, Parent > Object,

Re: Compiling

2006-02-05 Thread Martin v. Löwis
Ravi Teja wrote: > This is a standard response to a rather frequent question here. But I > am not sure I ever understood. Scheme / Lisp are about as dynamic as > Python. Yet they have quite efficient native compilers. Ex: Bigloo > Scheme. You might be missing two details here: 1. those compilers a

Most prominent Tkinter applications?

2006-02-05 Thread Kevin Walzer
I'm looking for examples of "best practices" in Tkinter/Python programming. What are the most prominent Python applications out there that use Tkinter as the GUI toolkit? These can be commercial or open-source, but are preferably multi-platform. I know IDLE is written in Tkinter, so that's one exa

Re: Get System Date?

2006-02-05 Thread Dustan
Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning Python

2006-02-05 Thread Byte
I asked to keep it simple! Anyway, ill try Dive into Python, thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: translating PHP to Python

2006-02-05 Thread Dave
Farshid, This is a great help, thanks. The second point won't work, though, because by parent class I mean, simply, the object that created the current object, *not* the class the current class is based on. So, for example: class A(object): def __init__(self): self.thing = Thing()

Re: wxPython Conventions

2006-02-05 Thread Jared Russell
Thanks for all the replies. I'm admittedly new to GUI programming, so I'm making sure to read up on the MVC pattern and related things like the observer pattern. I appreciate the help. Jared -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way of finding terminal width/height?

2006-02-05 Thread Joel Hedlund
> Which details? We'd be happy to explain the code. Not that > you need to understand the details to use the code. OK, why '1234' in here, and what's termios.TIOCGWINSZ, and how should I have known this was the way too do it? fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234') Am I interpreting C str

Re: Learning Python

2006-02-05 Thread Alex Martelli
Byte <[EMAIL PROTECTED]> wrote: > Thanks, never knew that, but they are using raw_input as a stack, > aren't they? No. raw_input is a function object, "using it as a stack" is a rather meaningless phrase. You can use a list as a stack, but that's totally and absolutely unrelated to that spot in

Re: Get System Date?

2006-02-05 Thread Alex Martelli
Dustan <[EMAIL PROTECTED]> wrote: > Is it possible to get the system date on a Windows XP machine? Most > Convenient would to retrieve , MM, and DD as seperate variables. > > When I say system date, I'm thinking of the small clock in the > lower-right hand corner, which has date as well as ti

Re: How to create a unix shell account with Python?

2006-02-05 Thread Peter Hansen
Sebastjan Trepca wrote: > I couldn't find anything on creating a new linux user account in > Python documentation. > Anyone has any experience with this? You just run useradd command in > shell or is there a more pythonic way? Just run useradd. -- http://mail.python.org/mailman/listinfo/python-l

Re: translating PHP to Python

2006-02-05 Thread Peter Hansen
Dave wrote: > The second point won't work, though, because by parent class I mean, > simply, the object that created the current object, *not* the class the > current class is based on. Good you clarified that, because "parent" definitely isn't used that way by most other people here. And, in fa

Re: Generators vs. Functions?

2006-02-05 Thread Magnus Lycka
Duncan Booth wrote: > Steven D'Aprano wrote: >>So on the basis of my tests, there is a small, but significant speed >>advantage to _calling_ a function versus _resuming_ a generator. > > I get the same, but the difference is much less on my system: With Python 2.4? Doesn't surprise me a bit. I t

Re: Learning Python

2006-02-05 Thread Blair P. Houghton
Xavier Morel wrote: > Where the hell did you get the idea of stacking input on a raw_input in > the first place? I'm guessing it goes something like: "input is a verb, but raw_input is a noun, so raw_input looks like a cast or conversion or stream constructor, and input looks like an action..."

  1   2   >