large dictionary creation takes a LOT of time.

2005-04-28 Thread possibilitybox
this code here: def wordcount(lines): for i in range(len(lines)/8): words = lines[i].split(" ") if not locals().has_key("frequency"): frequency = {} for word in words: if frequency.has_key(word): frequency[word] += 1

Non-anonymous function arguments

2005-04-28 Thread cjm_usenet
I had an idea for passing functions as arguments: Allow a block syntax (like with class definition) for keyword arguments, attached to a statement that includes a function call but doesn't need the block for something else (like loops and ifs). Apologies for the contrived examples. squares = map

Re: win32ui CreateFileDialog SLOW (since the SP2 Windows XP patch?)

2005-04-28 Thread Thomas Ganss
MsKitty schrieb: Neil - Interesting theory, but I installed brand new versions of Python (2.4.1) and the win32 extensions on a machine that had no Python and got the the same 4 minute response time, so that does not seem a likely explanation, although its possible. - Kitty Standalone machine or c

Re: Shutting down twisted reacotr

2005-04-28 Thread Jason Mobarak
You might not need threads to get user input from the console. Jp posted this in response to a similar query on the twisted-python mailing list: http://article.gmane.org/gmane.comp.python.twisted/9019 -- http://mail.python.org/mailman/listinfo/python-list

uploading large file 100mb

2005-04-28 Thread Thomas
Hi I am getting the following error when uploading large files…   Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> ## working on region in file c:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/pyt

python.org mail flowing again

2005-04-28 Thread webmaster
Thanks to Thomas Wouters for quickly getting mail.python.org back up once he was notified. The mail backlog seems to be mostly finished. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "It's 106 miles to Chicago. We have a full tank of gas, a half-pack of cigarette

Re: anonymous function objects?

2005-04-28 Thread Michele Simionato
Uwe Mayer: > Why does the "print" statement return a syntax error here? Google for "Python regrets" where Guido admits that 'print' should have been a function. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Fast plotting?

2005-04-28 Thread Patrick Ellis
William Park <[EMAIL PROTECTED]> typed: > Russell E. Owen <[EMAIL PROTECTED]> wrote: >> Can anyone recommend a fast cross-platform plotting package for 2-D >> plots? >> >> Our situation: >> We are driving an instrument that outputs data at 20Hz. Control is >> via an existing Tkinter application (wh

Re: Trying to write CGI script with python...

2005-04-28 Thread Jason Mobarak
Probably going to need more information about how mplayer is not being accessed correctly. CGI uses the shell environment to pass web information to a program... so maybe this is messing up mplayer. You'll need to augment or wrap your partners program in order to give you more information about wh

Re: why "import wx" doesn't work?

2005-04-28 Thread monkey
It is the current version of wxPython(2.6). But follow you instruction it still can't work... But if using the default "from wxPython.wx import *", it work, don't know what is the problem. May be this is an old example that cannot work with "import wx". Because I get another example and it is ok.

Re: New Python website

2005-04-28 Thread Maurice LING
Michael Soulier wrote: On 28 Apr 2005 17:45:02 -0700, lpe <[EMAIL PROTECTED]> wrote: http://www.pycode.com I was kinda suprised when I could not find any good sites with 3rd party modules (other than the Vaults of Parnassus, where you must host files elsewhere), so I decided to write one myself :)

Re: How do I parse this ? regexp ? [slighly OT]

2005-04-28 Thread Jeremy Bowers
On Thu, 28 Apr 2005 20:53:14 -0400, Peter Hansen wrote: > The re docs clearly say this is not the case: > > ''' > [] > Used to indicate a set of characters. Characters can be listed > individually, or a range of characters can be indicated by giving two > characters and separating them by a "

Re: Setting win32 console title from Python

2005-04-28 Thread Bengt Richter
On 28 Apr 2005 12:42:34 -0700, "runes" <[EMAIL PROTECTED]> wrote: >Hi Duncan, sorry, I was unprecise. I'm thinking of a script, called >t.py that can be used in the console like an ordinary command. Som if >I change directory from S:\scripts to d:\projects and execute the >script the title cha

Re: dynamically generating temporary files through python/cgi

2005-04-28 Thread Steve Holden
poisondart wrote: Is there a way to dynamically generate temporary files (such as an html, xml or text file) in Python? I'm not sure if I'm explaining myself clearly as I've no clue how to describe this mechanism. I've seen it on certain websites that will generate a file under certain parameters (

Re: New Python website

2005-04-28 Thread Maurice LING
lpe wrote: http://www.pycode.com I was kinda suprised when I could not find any good sites with 3rd party modules (other than the Vaults of Parnassus, where you must host files elsewhere), so I decided to write one myself :) It is brand new and might still be buggy, but hopefully it will be usefull

Re: New Python website

2005-04-28 Thread Michael Soulier
On 28 Apr 2005 17:45:02 -0700, lpe <[EMAIL PROTECTED]> wrote: > http://www.pycode.com > > I was kinda suprised when I could not find any good sites with 3rd > party modules (other than the Vaults of Parnassus, where you must host > files elsewhere), so I decided to write one myself :) > It is bran

Python Client & Loggin into Secure User Database

2005-04-28 Thread flamesrock
First, my problem doesn't make much practical sense so I hope you're up for a challenge. What I have (in concept) is a standalone web client that connects different 'players' to a central host and distributes game files between them. A user claims certain files, plays them, and then automatically

Re: Working with method-wrapper objects

2005-04-28 Thread Steven Bethard
Dr. Peer Griebel wrote: Why has [].__str__ a different type than object.__str__? Why is object.__str__ a routine while object().__str__ not? Well, I don't know why inspect.isroutine does what it does, but if you really need to detect these, can you do something like: py> MethodWrapperType = type(

Re: how can I sort a bunch of lists over multiple fields?

2005-04-28 Thread Steven Bethard
Lonnie Princehouse wrote: Likewise, the above is basically just an inefficient way of writing: def date_key(book): return book.data def author_and_date_key(book): return (author_key(book), date_key(book)) It's certainly more elegant, but I wanted to talk about the mechanics of comparison fun

Re: regex over files

2005-04-28 Thread Bengt Richter
On Thu, 28 Apr 2005 20:35:43 +, Robin Becker <[EMAIL PROTECTED]> wrote: >Jeremy Bowers wrote: > > > > > As you try to understand mmap, make sure your mental model can take into > > account the fact that it is easy and quite common to mmap a file several > > times larger than your physical

Re: Best way to parse file into db-type layout?

2005-04-28 Thread John Machin
On Fri, 29 Apr 2005 01:44:30 +0100, Michael Hoffman <[EMAIL PROTECTED]> wrote: >for row in csv.reader(fileinput.input()): csv.reader requires that if the first arg is a file that it be opened in binary mode. -- http://mail.python.org/mailman/listinfo/python-list

Re: anonymous function objects?

2005-04-28 Thread Peter Hansen
Uwe Mayer wrote: Unfortunately I want to assign a handler function to an object and something like this does not work: class Foobar(object): pass ... a = Foobar() def a.handler(): File "", line 1 def a.handler(): ^ SyntaxError: invalid syntax But this does work, or something close to

Re: Shutting down twisted reacotr

2005-04-28 Thread Jp Calderone
On Thu, 28 Apr 2005 12:34:33 + (UTC), Operation Latte Thunder <[EMAIL PROTECTED]> wrote: Jason Mobarak <[EMAIL PROTECTED]> wrote: Why do you want to do this in a thread? What's wrong with reactor.callLater? import time from twisted.internet import reactor def shutdown(): time.sleep(3) pr

Re: How do I parse this ? regexp ? [slighly OT]

2005-04-28 Thread Peter Hansen
Simon Dahlbacka wrote: safetyChecker = re.compile(r"^[-\[\]0-9,. ]*$") ..doesn't the dot (.) in your character class mean that you are allowing EVERYTHING (except newline?) The re docs clearly say this is not the case: ''' [] Used to indicate a set of characters. Characters can be listed indiv

New Python website

2005-04-28 Thread lpe
http://www.pycode.com I was kinda suprised when I could not find any good sites with 3rd party modules (other than the Vaults of Parnassus, where you must host files elsewhere), so I decided to write one myself :) It is brand new and might still be buggy, but hopefully it will be usefull to some p

Re: Best way to parse file into db-type layout?

2005-04-28 Thread Michael Hoffman
Peter A. Schott wrote: I've got a file that seems to come across more like a dictionary from what I can tell. Something like the following format: ###,1,val_1,2,val_2,3,val_3,5,val_5,10,val_10 ###,1,val_1,2,val_2,3,val_3,5,val_5,11,val_11,25,val_25,967,val_967 Peter, I'm not sure exactly what you

Re: Best way to parse file into db-type layout?

2005-04-28 Thread John Machin
On Thu, 28 Apr 2005 23:34:31 GMT, Peter A. Schott <[EMAIL PROTECTED]> wrote: >I've got a file that seems to come across more like a dictionary from what I >can >tell. Something like the following format: > >###,1,val_1,2,val_2,3,val_3,5,val_5,10,val_10 >###,1,val_1,2,val_2,3,val_3,5,val_5,11,val

Re: logging problems

2005-04-28 Thread Michael Hoffman
Simon Dahlbacka wrote: print sys.modules["traceback"] import traceback print "Hello World" sys.stdout.flush() just renders: in the console, and no "Hello World" Works fine on Python 2.4 for Windows. I'm running out of ideas what to try next, so suggestions/ideas appreciated! That's a very strange

Re: OOP

2005-04-28 Thread Dave Cook
On 2005-04-28, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'm new to Python and I love it. Now I can get most of the topics > covered with the Python tutorials I've read but the one thats just > stumping me is Object Orientation. I can't get the grasp of it. Does > anyone know of a good resour

Re: OOP

2005-04-28 Thread Scott Robinson
On Thu, 28 Apr 2005 17:58:47 GMT, Charles Krug <[EMAIL PROTECTED]> wrote: >On 28 Apr 2005 10:34:44 -0700, [EMAIL PROTECTED] ><[EMAIL PROTECTED]> wrote: >> Hey yall, >> I'm new to Python and I love it. Now I can get most of the topics >> covered with the Python tutorials I've read but the one thats

Re: dynamically generating temporary files through python/cgi

2005-04-28 Thread fred.dixon
import tempfile works under windows and linux -- http://mail.python.org/mailman/listinfo/python-list

Re: Python site-packages and import

2005-04-28 Thread Maurice LING
Peter Saffrey wrote: I'm trying to write a python service, with an executable in /usr/local/bin, but modules that are kept in a sub-directory of /usr/lib/python/site-packages. Using apt-proxy as my template, I've put the modules in /usr/lib/python/site-packages/mymodules and tried to import them wi

Re: anonymous function objects?

2005-04-28 Thread gabriele renzi
Uwe Mayer ha scritto: Friday 29 April 2005 00:06 am Paul Rubin wrote: Closest you can come is: f = lambda: sys.stdout.write("hello world\n") Ah. :)) Why does the "print" statement return a syntax error here? ^ this is the reason :) You can't have statements into an

Best way to parse file into db-type layout?

2005-04-28 Thread Peter A.Schott
I've got a file that seems to come across more like a dictionary from what I can tell. Something like the following format: ###,1,val_1,2,val_2,3,val_3,5,val_5,10,val_10 ###,1,val_1,2,val_2,3,val_3,5,val_5,11,val_11,25,val_25,967,val_967 In other words, different layouts (defined mostly by what

Re: why "import wx" doesn't work?

2005-04-28 Thread Filip Dreger
U¿ytkownik "monkey" <[EMAIL PROTECTED]> napisa³ w wiadomo¶ci news:[EMAIL PROTECTED] >> Which version of wxPython are you running? What do you mean by >> "does not >> work"...does the import fail or is your code giving errors? > > It is the current new version 2.6. The error message said that the

Python site-packages and import

2005-04-28 Thread Peter Saffrey
I'm trying to write a python service, with an executable in /usr/local/bin, but modules that are kept in a sub-directory of /usr/lib/python/site-packages. Using apt-proxy as my template, I've put the modules in /usr/lib/python/site-packages/mymodules and tried to import them with import mymodules.

Re: anonymous function objects?

2005-04-28 Thread Uwe Mayer
Friday 29 April 2005 00:06 am Paul Rubin wrote: > Closest you can come is: > >f = lambda: sys.stdout.write("hello world\n") Ah. :)) Why does the "print" statement return a syntax error here? >>> lambda: print("hallo") File "", line 1 lambda: print("hallo") ^ SyntaxErro

Re: anonymous function objects?

2005-04-28 Thread Paul Rubin
Uwe Mayer <[EMAIL PROTECTED]> writes: > >>> f = {print "hello world"} > >>> f() > hello world > in Pyton? Lambda expressions don't work here. Closest you can come is: f = lambda: sys.stdout.write("hello world\n") Of course if you're trying to capture the function in a named variable like f,

anonymous function objects?

2005-04-28 Thread Uwe Mayer
Is it possible to specify anonymous functions, something like: >>> f = {print "hello world"} >>> f() hello world in Pyton? Lambda expressions don't work here. Thanks, Uwe -- http://mail.python.org/mailman/listinfo/python-list

Re: why "import wx" doesn't work?

2005-04-28 Thread Kartic
The Great 'monkey' uttered these words on 4/28/2005 5:50 PM: Which version of wxPython are you running? What do you mean by "does not work"...does the import fail or is your code giving errors? It is the current new version 2.6. The error message said that the class wxApp is not defined... But whe

Re: why "import wx" doesn't work?

2005-04-28 Thread Kartic
The Great 'monkey' uttered these words on 4/28/2005 5:30 PM: It is the current version of wxPython(2.6). But follow you instruction it still can't work... But if using the default "from wxPython.wx import *", it work, don't know what is the problem. May be this is an old example that cannot work wi

Re: Can .py be complied?

2005-04-28 Thread monkey
> python -o foo.exe foo.py > Is that a real command that can be use? -- http://mail.python.org/mailman/listinfo/python-list

Re: why "import wx" doesn't work?

2005-04-28 Thread monkey
> Which version of wxPython are you running? What do you mean by "does not > work"...does the import fail or is your code giving errors? It is the current new version 2.6. The error message said that the class wxApp is not defined... But when using the default "from wxPython.wx import *", it works

Re: unicode encoding problem

2005-04-28 Thread "Martin v. Löwis"
[EMAIL PROTECTED] wrote: > So how do I tell what encoding my unicode string is in, and how do I > retrieve that when I read it from a file? In interactive mode, you best avoid non-ASCII characters in a Unicode literal. In theory, Python should look at sys.stdin.encoding when processing the intera

Re: Can .py be complied?

2005-04-28 Thread Maurice LING
steve.leach wrote: python -o foo.exe foo.py at the command line, and get an executable, without any further effort. Hence making the resulting program useless to users of most operating systems. In close sourced development, which most corporates may prefer, yes, the resulting program is useless

Re: dynamically generating temporary files through python/cgi

2005-04-28 Thread Jaime Wyant
On 27 Apr 2005 23:32:15 -0700, poisondart <[EMAIL PROTECTED]> wrote: > Is there a way to dynamically generate temporary files (such as an > html, xml or text file) in Python? > > I'm not sure if I'm explaining myself clearly as I've no clue how to > describe this mechanism. I've seen it on certain

Re: OOP

2005-04-28 Thread Kartic
The Great '[EMAIL PROTECTED]' uttered these words on 4/28/2005 1:34 PM: Hey yall, I'm new to Python and I love it. Now I can get most of the topics covered with the Python tutorials I've read but the one thats just stumping me is Object Orientation. I can't get the grasp of it. Does anyone know of

Re: how can I sort a bunch of lists over multiple fields?

2005-04-28 Thread Lonnie Princehouse
> Likewise, the above is basically just an inefficient way of writing: > > def date_key(book): > return book.data > > def author_and_date_key(book): > return (author_key(book), date_key(book)) It's certainly more elegant, but I wanted to talk about the mechanics of comparison functions =)

Re: why "import wx" doesn't work?

2005-04-28 Thread Kartic
The Great 'monkey' uttered these words on 4/28/2005 2:09 PM: I just learn to make a blank windows frame with python and wxpython. I found the statment "import wx" cannot work as the original "from wxPython.wx import *". I see in the readme file of wxpython that if I install it as the default one, I

unicode encoding problem

2005-04-28 Thread garykpdx
Every time I think I understand unicode, I prove I don't. I created a variable in interactive mode like this: s = u'ä' where this character is the a-umlaut that worked alright. Then I encoded it like this: s.encode( 'latin1') and it printed out a sigma (totally wrong) then I typed this: s.encod

Data smoothing algorithms?

2005-04-28 Thread Anthra Norell
Hi,   The following are differences of solar declinations from one day to the next, (never mind the unit). Considering the inertia of a planet, any progress of (apparent) celestial motion over regular time intervals has to be highly regular too, meaning that a plot cannot be jagged. The data

[ANNOUNCE] Twenty-fourth release of PythonCAD now available

2005-04-28 Thread Art Haas
I'm pleased to announce the twenty-fourth development release of PythonCAD, a CAD package for open-source software users. As the name implies, PythonCAD is written entirely in Python. The goal of this project is to create a fully scriptable drafting program that will match and eventually exceed fe

Re: embedding an interactive console

2005-04-28 Thread Paul Miller
Paul Miller wrote: I note the documentation for InteractiveConsole, which is implemented in Python. Is there any example code for using this from within C/C++ code to emulate the command-line interpreter inside a GUI app? I've gotten my text edit widget to send InteractiveConsole strings to run

logging problems

2005-04-28 Thread Simon Dahlbacka
Hi, I'm currently using python 2.3.4 and I'm having problem with the logging module. Occasionally when logging something with exc_info=True it just hangs, nothing is logged, and software cannot continue executing. By drilling down into logging package and adding rather many print statements into

Re: How do I parse this ? regexp ? [slighly OT]

2005-04-28 Thread Simon Dahlbacka
> >>> safetyChecker = re.compile(r"^[-\[\]0-9,. ]*$") ..doesn't the dot (.) in your character class mean that you are allowing EVERYTHING (except newline?) (you would probably want \. instead) /Simon -- http://mail.python.org/mailman/listinfo/python-list

Re: regex over files

2005-04-28 Thread Robin Becker
Skip Montanaro wrote: . Let me return to your original problem though, doing regex operations on files. I modified your two scripts slightly: . Skip I'm sure my results are dependent on something other than the coding style I suspect file/disk cache and paging operates here. Note that we

Re: regex over files

2005-04-28 Thread Robin Becker
Jeremy Bowers wrote: . As you try to understand mmap, make sure your mental model can take into account the fact that it is easy and quite common to mmap a file several times larger than your physical memory, and it does not even *try* to read the whole thing in at any given time. You may benef

Re: regex over files

2005-04-28 Thread Robin Becker
Robin Becker wrote: Skip Montanaro wrote: .. I'm not sure why the mmap() solution is so much slower for you. Perhaps on some systems files opened for reading are mmap'd under the covers. I'm sure it's highly platform-dependent. (My results on MacOSX - see below - are somewhat better.) ...

Re: goto statement

2005-04-28 Thread Mikhail 'Xen' Kashkin
If you use ssh, then you must to learn 'scp'. Or buy books about programming ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: Ron Grossi: God is not a man

2005-04-28 Thread Lawrence Lucier
Donald L McDaniel wrote: 3) Since Lucifer is an angel, he does not engage in sexual relations. (Christ tells us that angels don't engage in sexual relations by His Own Words.) Maybe you should take time to stop posting this inane drivel and do some studying pertaining to the "Nephilim".or ha

Trying to write CGI script with python...

2005-04-28 Thread ckb2102
Hi there, I am new to this so I apologize in advance if I am not following the right etiquette or something... I am working on a project for school. My partner has written a short program in Python which takes 2 arguments - the name of a .mov file and a number which represents the number of

Re: kdialog and unicode

2005-04-28 Thread John Ridley
Matt wrote: > Interesting - this displays correctly when I run the above code from a > python shell. However, when I run it as a superkaramba theme (which is > a wrapper interface to some kde functions, but allegedly passes > straight python functions direct to the python interpreter), it shows >

Re: regex over files

2005-04-28 Thread Robin Becker
Jeremy Bowers wrote: > > As you try to understand mmap, make sure your mental model can take into > account the fact that it is easy and quite common to mmap a file several > times larger than your physical memory, and it does not even *try* to read > the whole thing in at any given time. You

Re: OOP

2005-04-28 Thread Jeremy Bowers
On Thu, 28 Apr 2005 10:34:44 -0700, demon_slayer2839 wrote: > Hey yall, > I'm new to Python and I love it. Now I can get most of the topics > covered with the Python tutorials I've read but the one thats just > stumping me is Object Orientation. I can't get the grasp of it. Does > anyone know of a

Re: interactive web graphics

2005-04-28 Thread Eckhoff, Michael A
Thanks Larry and Diez. I figured that doing 'GUIs over the web' would probably not work. Where I work, we have a bunch of numerical weather-prediction-type models that take several hours to run. By having a cron job copy over the output, I think I can still implement a type of progress bar using a

Re: regex over files

2005-04-28 Thread Robin Becker
Skip Montanaro wrote: ... I'm not sure why the mmap() solution is so much slower for you. Perhaps on some systems files opened for reading are mmap'd under the covers. I'm sure it's highly platform-dependent. (My results on MacOSX - see below - are somewhat better.) Let me return to your origina

Re: how can I sort a bunch of lists over multiple fields?

2005-04-28 Thread Steven Bethard
Lonnie Princehouse wrote: So far, we've been using the "key" parameter of list.sort. If you want sort criteria more complicated than a single attribute, you can sort based on a custom comparison function. Actually, the key= parameter can do anything the cmp= parameter can: class Key(object): d

Re: regex over files

2005-04-28 Thread Skip Montanaro
Bengt> To be fairer, I think you'd want to hoist the re compilation out Bengt> of the loop. The re module compiles and caches regular expressions, so I doubt it would affect the runtime of either version. Bengt> But also to be fairer, maybe include the overhead of splitting Bengt

Re: Can .py be complied?

2005-04-28 Thread jfj
[EMAIL PROTECTED] wrote: IMO the fact that so many people ask "How can I create executables in Python on Windows" indicates that standard "batteries included" Windows Python distribution is missing a vital battery. There are tools such as py2exe, but this functionality should be built-in, so that a

Re: Working with method-wrapper objects

2005-04-28 Thread Dr. Peer Griebel
Peer Dr. Griebel wrote: I think I was a little bit unspecific in my last mail. I would like to see some description about method-wrapper and wrapper_descriptor objects. I dont' understand the following behaviour: type([].__str__) type(object.__str__) type(object().__str__) import inspect inspe

Re: Is this a bug?

2005-04-28 Thread Aahz
In article <[EMAIL PROTECTED]>, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > >mapping += to extend is a design mistake (I guess someone got a >little carried away). There were two use cases that drove augmented assignment (I know you know this -- but other people probably do not): reallylongvariabl

Re: interactive web graphics

2005-04-28 Thread Lee Harr
On 2005-04-27, Eckhoff, Michael A <[EMAIL PROTECTED]> wrote: > Hello, > > I failed to locate a list for pygtk, so I thought I'd > ask my question here. Is it possible to write CGI > scripts that bring up a GUI (as in GTK+, QT, Tk, ...) > or an openGL display that is windowed inside a web > browser?

Re: anonymous functions/expressions without lambda?

2005-04-28 Thread Paul Miller
Michael Hoffman wrote: Paul Miller wrote: While on the subject, is there an equivalent for "methodcaller"? ie. if I want to bind a function which calls a specific method of an object with a specific parameter? def funccaller(func, *args, **kwargs): def _return_func(): return func(*arg

Re: anonymous functions/expressions without lambda?

2005-04-28 Thread Dave Benjamin
Cameron Laird wrote: In article <[EMAIL PROTECTED]>, Peter Hansen <[EMAIL PROTECTED]> wrote: This meets your requirements as stated: def temp(): foo.var = 1 bind('a', temp) def temp(): foo.var = 2 bind('b', temp) del temp Ewww! *When* is lambda going bye-bye? I apparently haven't been paying

Re: dynamically generating temporary files through python/cgi

2005-04-28 Thread Tiziano Bettio
poisondart wrote: Is there a way to dynamically generate temporary files (such as an html, xml or text file) in Python? I'm not sure if I'm explaining myself clearly as I've no clue how to describe this mechanism. I've seen it on certain websites that will generate a file under certain parameters (

Re: why "import wx" doesn't work?

2005-04-28 Thread Peter Hansen
monkey wrote: I just learn to make a blank windows frame with python and wxpython. I found the statment "import wx" cannot work as the original "from wxPython.wx import *". I see in the readme file of wxpython that if I install it as the default one, I can use "import wx" instead of the long one. W

Re: anonymous functions/expressions without lambda?

2005-04-28 Thread Dave Benjamin
Dave Benjamin wrote: You could use a combination of bound methods and the "curry" function defined in the Python Cookbook: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52549 The examples in the discussion do just that. Also, in the CVS version of Python, there's a new module called "f

Re: anonymous functions/expressions without lambda?

2005-04-28 Thread Michael Hoffman
Paul Miller wrote: While on the subject, is there an equivalent for "methodcaller"? ie. if I want to bind a function which calls a specific method of an object with a specific parameter? def funccaller(func, *args, **kwargs): def _return_func(): return func(*args, **kwargs) return

Re: Internet Explorer, COM+, Javascript and Python

2005-04-28 Thread J Correia
"Roger Upole" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Something like this should be close: > > import win32com.client, pythoncom > ie=win32com.client.Dispatch('internetexplorer.application') > ie.Visible=1 > ie.Navigate('somepagewithjavascript.html') > id=ie.Document.Script._

Re: anonymous functions/expressions without lambda?

2005-04-28 Thread Dave Benjamin
Paul Miller wrote: Michael Hoffman wrote: Dave Benjamin wrote: I think you meant to write something like this: def attrsetter(obj, name, value): def _return_func(): return setattr(obj, name, value) return _return_func Sure did. Sorry. You guys have been very helpful! While on the

Can'r run BLT twice?

2005-04-28 Thread Todd Krein
I'm running PythonWin on XP. When I run my plotter program the first time, it works fine. The second time I run it, I get the following error. If I exit PythonWin, and restart, I can again run it once. Any ideas? Error: 1 TclError Exception in Tk callback Function: > (type: ) Args: () Tracebac

Can't run BLT program more than once?

2005-04-28 Thread Todd Krein
I'm running activestate Python 2.4 for windows, and the latest BLT, under XP. I'm using pythonWin as my environment. When I run my plotting program the first time, it works just fine. If I exit out (normally), and then run it again from PythonWin, I get the following error. It's as if something is

embedding an interactive console

2005-04-28 Thread Paul Miller
I did this YEARS ago with Python 1.5, and I recall it being slightly painful. I have an embedded Python interpreter and I want to provide an interactive console (implemented in my GUI application with a Qt TextEdit widget). I can handle the GUI part of it, but I'm wondering what the latest Pyth

Re: Setting win32 console title from Python

2005-04-28 Thread runes
Hi Duncan, sorry, I was unprecise. I'm thinking of a script, called t.py that can be used in the console like an ordinary command. Som if I change directory from S:\scripts to d:\projects and execute the script the title changes to "projects" etc. I have that functionality today with a combina

Re: anonymous functions/expressions without lambda?

2005-04-28 Thread Paul Miller
Michael Hoffman wrote: Dave Benjamin wrote: I think you meant to write something like this: def attrsetter(obj, name, value): def _return_func(): return setattr(obj, name, value) return _return_func Sure did. Sorry. You guys have been very helpful! While on the subject, is there an

Re: Getting the sender widget's name in function (Tkinter)

2005-04-28 Thread tiissa
Cameron Laird wrote: In article <[EMAIL PROTECTED]>, tiissa <[EMAIL PROTECTED]> wrote: So far, the OP is proposed the choice to either use the event/bind mecanism or use different callbacks for his different buttons (either with the method I proposed or not). Is there general understanding that

Re: anonymous functions/expressions without lambda?

2005-04-28 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Peter Hansen <[EMAIL PROTECTED]> wrote: >Paul Miller wrote: >> For example, let's say I have a function which binds a key to a function >> call. I want to do something "simple" in this function call, and I have >> a lot of bindings, so I don't want to have a ton o

Re: Getting the sender widget's name in function (Tkinter)

2005-04-28 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, tiissa <[EMAIL PROTECTED]> wrote: . . . >So far, the OP is proposed the choice to either use the event/bind >mecanism or use different callbacks for his different buttons (either >with the met

Re: how can I sort a bunch of lists over multiple fields?

2005-04-28 Thread Lonnie Princehouse
> I'd be just such a newbie; I don't understand why it would matter if I > left the book instance referencing itself It's just kind of sloppy and unnecessary to have self.self > firstly, I am trying hard to figure out how to create a new file with > the list rather than print to standard out

Re: anonymous functions/expressions without lambda?

2005-04-28 Thread Michael Hoffman
Dave Benjamin wrote: I think you meant to write something like this: def attrsetter(obj, name, value): def _return_func(): return setattr(obj, name, value) return _return_func Sure did. Sorry. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: how can I sort a bunch of lists over multiple fields?

2005-04-28 Thread Steven Bethard
googleboy wrote: firstly, I am trying hard to figure out how to create a new file with the list rather than print to standard out. I haev done this: for book in books: print book # just to be sure it works as I expect sort1 = open(r'D:\path to\sort1.csv', 'w+') print >

Re: Getting the sender widget's name in function (Tkinter)

2005-04-28 Thread infidel
Here's a slight variation of tiissa's solution that gives the callable a reference to the actual widget instead of just it's name: from Tkinter import Tk, Button class say_hello: def __init__(self, widget): self.widget = widget def __call__(self): print 'Hello,', self.widg

why "import wx" doesn't work?

2005-04-28 Thread monkey
I just learn to make a blank windows frame with python and wxpython. I found the statment "import wx" cannot work as the original "from wxPython.wx import *". I see in the readme file of wxpython that if I install it as the default one, I can use "import wx" instead of the long one. What is wrong?

Re: how can I sort a bunch of lists over multiple fields?

2005-04-28 Thread Philippe C. Martin
How about using the csv module instead of splitting ? [EMAIL PROTECTED] wrote: > What you want I guess is to read first all lines of the file into a > string as you did, and then let the split method split it based on > newlines only - see example below. > > Then you use split again to put all

Re: OOP

2005-04-28 Thread Charles Krug
On 28 Apr 2005 10:34:44 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hey yall, > I'm new to Python and I love it. Now I can get most of the topics > covered with the Python tutorials I've read but the one thats just > stumping me is Object Orientation. I can't get the grasp of it. Does > a

Re: how can I sort a bunch of lists over multiple fields?

2005-04-28 Thread googleboy
I'd be just such a newbie; I don't understand why it would matter if I left the book instance referencing itself However these wonderful responses have gotten me a very long way towards my goal. I just have a couple of quick questions. firstly, I am trying hard to figure out how to create a

Re: split question

2005-04-28 Thread alexk
Yes, all of you are right. Thank you all for your answers - I'll use a regex. -- http://mail.python.org/mailman/listinfo/python-list

Re: OOP

2005-04-28 Thread beliavsky
[EMAIL PROTECTED] wrote: > Hey yall, > I'm new to Python and I love it. Now I can get most of the topics > covered with the Python tutorials I've read but the one thats just > stumping me is Object Orientation. I can't get the grasp of it. Does > anyone know of a good resource that could possibly p

Re: Getting the sender widget's name in function (Tkinter)

2005-04-28 Thread tiissa
Cameron Laird wrote: In article <[EMAIL PROTECTED]>, Eric Brunel <[EMAIL PROTECTED]> wrote: Unfortunately, making a binding to on Button widgets does not have the same behavior as setting their 'command' option. Without unraveling my own confusion about who has said what to whom, does everyone rea

OOP

2005-04-28 Thread demon_slayer2839
Hey yall, I'm new to Python and I love it. Now I can get most of the topics covered with the Python tutorials I've read but the one thats just stumping me is Object Orientation. I can't get the grasp of it. Does anyone know of a good resource that could possibly put things in focus for me? Thanks.

  1   2   >