Re: translating PHP to Python

2006-02-05 Thread Eric Nieuwland
Dave wrote: > class A(object): > def create_child(self): > self.child = B() > self.child.do_stuff(self) > > class B(object): > def do_stuff(self, parent): > self.parent = parent > if self.parent.__class__.__name__ == 'A': > print "I'm a child of a

Re: Compiling

2006-02-05 Thread Ravi Teja
> So while it would be possible to apply the same strategy to > Python, it likely wouldn't gain any performance increase over > the interpreter. Thanks, That was quite illustrative. But as I posted elsewhere, I am looking at the other advantages of native compilation rather than speed. Python's ab

Re: win32com, BSTR, and null terminated strings

2006-02-05 Thread John Bauman
"Matt Helm" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > However, what is the proper way to recover the actual string? I have > been using: > >r.split("\0", 1)[0] > I'd prefer to use r[:-1] to strip off the last character of the string. -- http://mail.python.org/mailman/l

Re: translating PHP to Python

2006-02-05 Thread Dave
So thanks, all for the help. Turns out that the solution is simple enough, as are most solutions in Python: PHP: parent::__construct(args) does translate to the Python: super(ParentClass, self).__init__(args) The example, that of referencing an object's creator object (if that's the technospeci

AJAX example code available

2006-02-05 Thread aaronwmail-usenet
I've published sample code that uses Python on the server side to implement AJAX type ahead completion for web forms. Please see documentation with links to examples and downloads at http://xsdb.sourceforge.net/xFeed.html "Type ahead completion" is a form of AJAX (asyncronous javascript with XM

Re: translating PHP to Python

2006-02-05 Thread Terry Hancock
On Sun, 05 Feb 2006 15:04:32 -0500 Peter Hansen <[EMAIL PROTECTED]> wrote: > 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 t

Re: Literal Escaped Octets

2006-02-05 Thread Alex Martelli
Chason Hayes <[EMAIL PROTECTED]> wrote: ... > easily in c/c++ but I need to do it in python. I am not sure how to read > and evaluate the binary value of a byte in a long string when it is a non > printable ascii value in python. If you have a bytestring (AKA plain string) s, the binary value o

Re: Importing a class, please help...

2006-02-05 Thread Alex Martelli
anon <[EMAIL PROTECTED]> wrote: > Xavier > > Yes I meant Python. I have also been using Jython and I am VERY WELL aware > what a JAR is. Jython has the ability to call methods stored in classes in > a JAR. I was only asking if this could be done with Python also. Classic Python is able to imp

Re: Importing a class, please help...

2006-02-05 Thread Terry Hancock
On Sun, 5 Feb 2006 10:41:51 -0500 "anon" <[EMAIL PROTECTED]> wrote: > 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 calle

Re: psycopg2 rounds unix time

2006-02-05 Thread Steve Holden
Luis P. Mendes wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi, > > I've inserted a couple hundred rows in a table in Postgres via psycopg2. > > The first field of each row is a certain unix time (since epoch) when an > event occured. > When I try to access that database with psy

Re: Importing a class, please help...

2006-02-05 Thread anon
Xavier Yes I meant Python. I have also been using Jython and I am VERY WELL aware what a JAR is. Jython has the ability to call methods stored in classes in a JAR. I was only asking if this could be done with Python also. You ask "why the hell would a Python script be able to read a JAR..".

Re: Reverse of map()?

2006-02-05 Thread Raymond Hettinger
[Alex Martelli] > map(apply, fn_list, ...) may work, but I doubt it's going to be either > simple or speedy since the ... must be replaced with as many copies of > Args and Kwds as there are functions in fn_list, e.g.: > > map(apply, fn_list, len(fn_list)*(Args,), len(fn_list)*(Kwds)) The repeat()

Literal Escaped Octets

2006-02-05 Thread Chason Hayes
I am trying to convert raw binary data to data with escaped octets in order to store it in a bytea field on postgresql server. I could do this easily in c/c++ but I need to do it in python. I am not sure how to read and evaluate the binary value of a byte in a long string when it is a non printable

Re: win32com, BSTR, and null terminated strings

2006-02-05 Thread Steve Holden
Matt Helm wrote: > > I am using win32com to access a third party COM interface but am > having trouble using the string that is returned. > > The vendor's docs show the following method: > > HRESULT CookString(BSTR param_a, short buf_size, [out, retval] BSTR* > result_b); > > param_a is a

Re: Thread imbalance

2006-02-05 Thread Tuvas
The stuff that it runs aren't heavily processor intensive, but rather consistant. It's looking to read incoming data. For some reason when it does this, it won't execute other threads until it's done. Hmmm. Perhaps I'll just have to work on a custom read function that doesn't depend so much on proc

Re: Strange behavior with os call in cgi script

2006-02-05 Thread Steve Holden
Rene Pijlman wrote: > sophie_newbie: > >>OK, interesting, but just how dow I print he environment in the >>program?? > > > Add logging to your program: > http://www.python.org/doc/2.3.5/lib/module-logging.html > Probably oiverkill, particularly for a beginner (is it only me that thinks the log

Re: Newbie Help!

2006-02-05 Thread jmdeschamps
Alex Martelli wrote: > Stephen <[EMAIL PROTECTED]> wrote: > > > Hi All, > > im new to python i just have a few questions and was wondering if > > you could help me?? > > > > 1. what programming langaugue does python use? or which is most popular? > > Python _is_ a programming language, so

Re: Learning Python

2006-02-05 Thread Steve Holden
Xavier Morel wrote: > Byte wrote: > >>I asked to keep it simple! Anyway, ill try Dive into Python, thanks >> > > It is simple, merely explicit and with some details. It seemed to me a bit like an attempt to save a drowning man by opening a firehose on his mouth :-) regards Steve -- Steve Ho

test, please ignore

2006-02-05 Thread Kenneth McDonald
My last several postings do not seem to have gone through, so here's trying again. Ken -- http://mail.python.org/mailman/listinfo/python-list

Re: Another try at Python's selfishness

2006-02-05 Thread Terry Hancock
On 04 Feb 2006 11:03:00 + [EMAIL PROTECTED] (Jens Theisen) wrote: > n.estner wrote: > > Yes, I 100% agree to that point! > > But the point is, the current situation is not > > newbie-friendly (I can tell, I am a newbie): I declare a > > method with 3 parameters but when I call it I only pass >

Re: A problem with some OO code.

2006-02-05 Thread Terry Hancock
On 4 Feb 2006 09:51:22 -0800 "TPJ" <[EMAIL PROTECTED]> wrote: > 1) In OO vocabulary, class is something like template for > an object. But I think the word "object" has something > different meaning in Python. In general I don't use the > word "object" in the same meaning, that it is used by > Pyth

Re: Best way of finding terminal width/height?

2006-02-05 Thread Grant Edwards
On 2006-02-05, Joel Hedlund <[EMAIL PROTECTED]> wrote: >> 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, Second question first: TIOCGWINSZ is just a platform-defined magi

psycopg2 rounds unix time

2006-02-05 Thread Luis P. Mendes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I've inserted a couple hundred rows in a table in Postgres via psycopg2. The first field of each row is a certain unix time (since epoch) when an event occured. When I try to access that database with psycopg2, I get rounded values for the unix t

Re: Thread imbalance

2006-02-05 Thread Ivan Voras
Dennis Lee Bieber wrote: > FYI: That's GLOBAL Interpreter Lock Yes, sorry about the confusion. -- http://mail.python.org/mailman/listinfo/python-list

Re: Thread imbalance

2006-02-05 Thread Ivan Voras
Aahz wrote: > > When did Perl gain threads? At least in 2001: http://mail.python.org/pipermail/python-dev/2001-August/017079.html http://www.xav.com/perl/lib/Pod/perlthrtut.html > If you read Bruce Eckel, you also know that > the Java threading system has been buggy for something like a decade

Re: Newbie Help!

2006-02-05 Thread Arthur Cannell
Stephen wrote: > Hi All, > im new to python i just have a few questions and was wondering if > you could help me?? > > 1. what programming langaugue does python use? or which is most popular? > > 2. Does anyone know where i could get hold of practice code > > 3. Any good ebooks or links

Re: Newbie Help!

2006-02-05 Thread Alex Martelli
Stephen <[EMAIL PROTECTED]> wrote: > Hi All, > im new to python i just have a few questions and was wondering if > you could help me?? > > 1. what programming langaugue does python use? or which is most popular? Python _is_ a programming language, so your question is not clear. If you'r

Re: Reverse of map()?

2006-02-05 Thread Alex Martelli
Phillip Sitbon <[EMAIL PROTECTED]> wrote: > Hello there, > > I have a situation where a list of functions need to be called with a > single set of parameters and the result constructed into a tuple. I > know there's simple ways to do it via list comprehension: > > Result = tuple( [ fn(* Args, *

Re: Thread imbalance

2006-02-05 Thread Ivan Voras
Neil Hodgson wrote: >Lua has coroutines rather than threads. It can cooperate with > threading implemented by a host application or library. I mentioned it because, as far as I know the Lua's intepreter doesn't do implicit locking on its own, and if I want to run several threads of pure Lu

Newbie Help!

2006-02-05 Thread Stephen
Hi All, im new to python i just have a few questions and was wondering if you could help me?? 1. what programming langaugue does python use? or which is most popular? 2. Does anyone know where i could get hold of practice code 3. Any good ebooks or links to start with. (according to the

Reverse of map()?

2006-02-05 Thread Phillip Sitbon
Hello there, I have a situation where a list of functions need to be called with a single set of parameters and the result constructed into a tuple. I know there's simple ways to do it via list comprehension: Result = tuple( [ fn(* Args, ** Kwds) for fn in fn_list ] ) I'd hope there's a more e

Re: Numeric and matlab

2006-02-05 Thread Schüle Daniel
Hello, [...] > > I'm sure there are more, but these jump out at me as I'm going. It > seems as if the idx=find() stuff can be done with Numeric.nonzeros(), > but you can't index with that, like > > a=Numeric.arange(1,11,1) > idx=Numeric.nonzeros(a) import Numeric as N N.nonzero without s :)

Re: translating PHP to Python

2006-02-05 Thread Peter Hansen
Magnus Lycka wrote: > Peter Hansen wrote: >>Good you clarified that, because "parent" definitely isn't used that way >>by most other people here. > > Unless they are coding GUIs? I guess it's pretty common that GUI > controls are contained in other controls called parents. At least > that's how

Re: translating PHP to Python

2006-02-05 Thread Xavier Morel
Dave wrote: > 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 wha

Re: Learning Python

2006-02-05 Thread Xavier Morel
Byte wrote: > I asked to keep it simple! Anyway, ill try Dive into Python, thanks > It is simple, merely explicit and with some details. -- http://mail.python.org/mailman/listinfo/python-list

Re: Importing a class, please help...

2006-02-05 Thread Xavier Morel
Jorgen Grahn wrote: > You are rude to an obvious newbie here ... please keep in mind that today's > stupid newbies are tomorrow's Python professionals. > I didn't mean to be rude and apologize if that's the way it came out. > Maybe he /is/ running Jython and failed to explain that properly? >

Re: translating PHP to Python

2006-02-05 Thread Magnus Lycka
Peter Hansen wrote: > Good you clarified that, because "parent" definitely isn't used that way > by most other people here. Unless they are coding GUIs? I guess it's pretty common that GUI controls are contained in other controls called parents. At least that's how it's done in wxPython. -- http

Re: Get System Date?

2006-02-05 Thread Magnus Lycka
Dave wrote: > Dustan, > > Python has a module called, appropriately, "time". This is basically a wrapper around the standard C time library. Python has a more modern and spiffy datetime module which isn't restrained to 1970-2038, and just handles spiffy date and datetime objects instead of makin

Re: translating PHP to Python

2006-02-05 Thread Magnus Lycka
Dave wrote: > Is there a built in way to do this in Python, or do I have to pass > "parent" when I init Thing? While I'm sure you could find a "clever" way to do this, passing in "parent" explicitly is the "proper" way to do it. Once in a while, you might actually want some other object than the l

Re: what's wrong with my popen reasoning?

2006-02-05 Thread Rick Spencer
On Sun, 05 Feb 2006 10:39:18 -0800, Rick Spencer wrote: >I just want to fire > off the command line utility (iwconfig) for connecting. In this case, I > want my program to wait until iwconfig is done before continuing on. I > figure that I could just write a line of code to read in from the conso

Re: Thread imbalance

2006-02-05 Thread Neil Hodgson
Ivan Voras wrote: > opinion, but by "good threading implementation" I mean that all threads > in the application should run "natively" on the underlying (p)threads > library at all times, without implicit serialization. For example, Java > and perl do this, possibly also lua and C#. Lua h

Re: Strange behavior with os call in cgi script

2006-02-05 Thread Rene Pijlman
sophie_newbie: >OK, interesting, but just how dow I print he environment in the >program?? Add logging to your program: http://www.python.org/doc/2.3.5/lib/module-logging.html And log the environment: http://www.python.org/dev/doc/newstyle/lib/os-procinfo.html -- René Pijlman -- http://mail.py

Re: Python, GUI, and GTK+

2006-02-05 Thread UrsusMaximus
You will find links to 12 pyGtk tutorials here : www.awaretek.com/tutorials.html Clck on: GUI Programming: pyGTK and Gnome (12) -- http://mail.python.org/mailman/listinfo/python-list

Python, GUI, and GTK+

2006-02-05 Thread Piotr Husiatynski
Hi, I'm new at GUI programming. I've heard about Gazpacho but I couldn't find any tutorial about it on Internet (even on the gazpacho page). Becouse of that fact, I've installed Glaze, but there's probably no tutorials for python too. Can anyone point me an introdutory tutorial on how to implement

Re: Numeric and matlab

2006-02-05 Thread Robert Kern
Brian Blais wrote: > Hello, > > Most of my experience is with Matlab/Octave, so I am a Python newbie (but > enjoying > it! :) ) A better place to ask would be [EMAIL PROTECTED] . By the way, Numeric has undergone a rewrite and is now known as numpy. http://numeric.scipy.org > There are a l

Re: Importing a class, please help...

2006-02-05 Thread Magnus Lycka
Jorgen Grahn wrote: >>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 newbie here ... Agreed. I don't think it was intended, but we should be cautious with our language when we address str

Re: Learning Python

2006-02-05 Thread Magnus Lycka
Byte wrote: > 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://wiki.python.org/moin/BeginnersGuide http://www.honors.montana.edu/~jjc/easytut/easytut/ http://www.hetl

Re: Strange behavior with os call in cgi script

2006-02-05 Thread sophie_newbie
OK, interesting, but just how dow I print he environment in the program?? -- http://mail.python.org/mailman/listinfo/python-list

Stopping Circe development

2006-02-05 Thread Kyle Brooks
Hey all. I have decided to stop Circe development because of school. If anyone wants to take over Circe development, please reply to this post. Our repository (a Darcs repo) is at http://kbrooks.ath.cx/repos/circe. -- http://mail.python.org/mailman/listinfo/python-list

Re: Back-end for python.org

2006-02-05 Thread Fredrik Lundh
Steven Bethard wrote: > > http://pydotorg.dyndns.org:8000 > > Very cool. I'd love to see something like this on the actual website... working on it (the wiki will probably not be quite as open, though...) > Is the hope that in the real python.org version edits will show up > immediately, as the

Re: Most prominent Tkinter applications?

2006-02-05 Thread Carl Friedrich Bolz
Kevin Walzer wrote: > 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 writt

Re: Most prominent Tkinter applications?

2006-02-05 Thread [EMAIL PROTECTED]
I use this TKinter app almost everyday. Great simple GUI and looks good too. http://www.podblogger.de/mp3stick Take care, Davy Mitchell Mood News - BBC News Headlines Auto-Classified as Good, Bad or Neutral. http://www.latedecember.com/sites/moodnews/ -- http://mail.python.org/mailman/

Numeric and matlab

2006-02-05 Thread Brian Blais
Hello, Most of my experience is with Matlab/Octave, so I am a Python newbie (but enjoying it! :) ) There are a lot of things that I do in Matlab that I'd like to know the proper way to do in Python. Here are a few: MATLAB: % example vectors a=1:10; b=-5:.1:5;

win32com, BSTR, and null terminated strings

2006-02-05 Thread Matt Helm
I am using win32com to access a third party COM interface but am having trouble using the string that is returned. The vendor's docs show the following method: HRESULT CookString(BSTR param_a, short buf_size, [out, retval] BSTR* result_b); param_a is a string to be processed. buf_size is

Re: Deterministic destruction and RAII idioms in Python

2006-02-05 Thread Carl Friedrich Bolz
Paul Rubin wrote: > [EMAIL PROTECTED] writes: > >>I looked at pep-0343, it looks interesting. It is not what I really >>want (deterministic destruction) > > > I think it's better. > > >>As far as my comment about "mainstream" Python, I have always taken >>CPython as "Python". I guess this w

Re: what's wrong with my popen reasoning?

2006-02-05 Thread Michael Williams
Hello,I would possibly look into using Pexpect (http://pexpect.sourceforge.net/) and the python "time" module for things of this nature.  It gives you a bit more granular control over what happens when.Regards,MichaelOn Feb 5, 2006, at 2:57 PM, [EMAIL PROTECTED] wrote:From: Rick Spencer <[EMAIL PRO

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

2006-02-05 Thread brent . chambers
os.system("useradd ...") Its not pretty, but it gets it done. -- http://mail.python.org/mailman/listinfo/python-list

Re: Most prominent Tkinter applications?

2006-02-05 Thread Dennis Benzinger
Kevin Walzer schrieb: > 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 wri

Re: Strange behavior with os call in cgi script

2006-02-05 Thread Dennis Benzinger
sophie_newbie schrieb: > I have written a cgi script that seems to run perfectly from the > command line when I simulate some cgi input using > os.environ['QUERY_STRING']. > > The thing is that when I run it from the browser, one of my os.system > calls, which gets excecuted fine when running the

Strange behavior with os call in cgi script

2006-02-05 Thread sophie_newbie
I have written a cgi script that seems to run perfectly from the command line when I simulate some cgi input using os.environ['QUERY_STRING']. The thing is that when I run it from the browser, one of my os.system calls, which gets excecuted fine when running the program in the interpreter, doesn't

Re: how to kill a python process?

2006-02-05 Thread MackS
Hi Jorgen You wrote that: > $ head -1 foo3.py > #!/usr/bin/python > $ ./foo3.py > > This is the traditional shebang form used for shell and Perl scripts, > and it names the process 'foo3.py' so you can killall(1) it nicely. It doesn't work on my system; I just get yet another process called pyt

Re: Thread imbalance

2006-02-05 Thread Aahz
In article <[EMAIL PROTECTED]>, Ivan Voras <[EMAIL PROTECTED]> 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

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..."

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: 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: 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: 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: 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: 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: 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: 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: 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: Get System Date?

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

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: 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

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,

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: 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 >

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: 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

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: 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: 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: 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

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: 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

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: 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: 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

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: 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"

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

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: 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

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: 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: 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: 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
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: > 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.

  1   2   >