Re: High level csv reader

2006-11-01 Thread James Stroud
George Sakkis wrote: > It occured to me that most times I read a csv file, I'm often doing > from scratch things like assigning labels to columns, mapping fields to > the appropriate type, ignoring some fields, changing their order, etc. > Before I go on and reinvent the wheel, is there a generic h

Re: High level csv reader

2006-11-01 Thread Fredrik Lundh
James Stroud wrote: >> Before I go on and reinvent the wheel, is there a generic high level >> wrapper around csv.reader that does all this ? > > There is a csv in the standard library. I'm not sure the "csv" module qualifies as a high-level wrapper around itself, though. -- http://mail.pyt

Re: High level csv reader

2006-11-01 Thread John Machin
James Stroud wrote: > George Sakkis wrote: > > It occured to me that most times I read a csv file, I'm often doing > > from scratch things like assigning labels to columns, mapping fields to > > the appropriate type, ignoring some fields, changing their order, etc. > > Before I go on and reinvent

SWIG, C++ and extension modules problem

2006-11-01 Thread anujseth76
Hi, This might be slightly off topic and but i am hoping someone here can help. I am trying to build a python wrapper for some C++ classes that access oracle. when i try loading the module i get the following errors Python 2.4.2 (#1, Nov 9 2005, 09:37:25) [C] on hp-ux11 Type "help", "copyright",

Re: 3d programming without opengl

2006-11-01 Thread Richard Jones
Fredrik Lundh wrote: > Richard Jones wrote: >>> Pure Python doesn't necessarily imply "no graphics drawing code written >>> in some other language", though. You can get pretty far by using a 2D >>> library for simple 3D rendering. >> >> Someone wrote a 3D demo for the pygame.draw challenge*. It w

Re: High level csv reader

2006-11-01 Thread John Machin
George Sakkis wrote: > It occured to me that most times I read a csv file, I'm often doing > from scratch things like assigning labels to columns, mapping fields to > the appropriate type, ignoring some fields, changing their order, etc. > Before I go on and reinvent the wheel, is there a generic h

Re: logo design

2006-11-01 Thread Xah Lee
No personal offense intended, but human animal's history is what? 3000 years at least in recorded history? And, all you can think of is what, the view points of a fraction of your personal life span? Have you looked into, the history of fashions, icons, their roles and social significance, before

Make all files extension lower by a given directory name

2006-11-01 Thread Tiefeng Wu
Hello everybody! I need make all files extension to lower by a given directory. Here is my solution: import os def make_all_file_ext_lower(root): for path, subdirs, files in os.walk(root): for file in files: (name, ext) = os.path.splitext(file) fullname = name[

RELEASED Python 2.3.6, FINAL

2006-11-01 Thread Anthony Baxter
On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.3.6 (FINAL). Python 2.3.6 is a security bug-fix release. While Python 2.5 is the latest version of Python, we're making this release for people who are still running Python 2.3. Unlike

Re: Where do nested functions live?

2006-11-01 Thread Rob Williscroft
Frederic Rentsch wrote in news:mailman.1556.1162316571.11739.python- [EMAIL PROTECTED] in comp.lang.python: > Rob Williscroft wrote: >> Frederic Rentsch wrote in news:mailman.1536.1162292996.11739.python- >>> Rob Williscroft wrote: Frederic Rentsch wrote in news:mailman.1428.1162113628.11739.

Re: Make all files extension lower by a given directory name

2006-11-01 Thread Fredrik Lundh
Tiefeng Wu wrote: > I need make all files extension to lower by a given directory. > Here is my solution: > > import os > > def make_all_file_ext_lower(root): > for path, subdirs, files in os.walk(root): > for file in files: > (name, ext) = os.path.splitext(file) the par

Re: High level csv reader

2006-11-01 Thread skip
George> It occured to me that most times I read a csv file, I'm often George> doing from scratch things like assigning labels to columns, George> mapping fields to the appropriate type, ignoring some fields, George> changing their order, etc. Before I go on and reinvent the Ge

Re: Where do nested functions live?

2006-11-01 Thread Carl Banks
Ben Finney wrote: > "Steven D'Aprano" <[EMAIL PROTECTED]> writes: > > > I defined a nested function: > > > > def foo(): > > def bar(): > > return "bar" > > return "foo " + bar() > > > > which works. Knowing how Python loves namespaces, I thought I could > > do this: > > > > >>> foo

Re: Where do nested functions live?

2006-11-01 Thread Fredrik Lundh
Carl Banks wrote: > Not so fast. You can get at the nested function by peeking inside code > objects (all bets off for Pythons other than CPython). > > import new > def extract_nested_function(func,name): > codetype = type(func.func_code) > for obj in func.func_code.co_consts: > i

Pydev 1.2.5 Released

2006-11-01 Thread Fabio Zadrozny
Hi All,Pydev and Pydev Extensions 1.2.5 have been releasedDetails on Pydev Extensions: http://www.fabioz.com/pydevDetails on Pydev: http://pydev.sf.net Details on its development: http://pydev.blogspot.comRelease Highlights in Pydev Extensions:--

Re: best way to check if a file exists?

2006-11-01 Thread [EMAIL PROTECTED]
John Salerno wrote: > What is the best way to check if a file already exists in the current > directory? I saw os.path.isfile(), but I'm not sure if that does more > than what I need. > > I just want to check if a file of a certain name exists before the user > creates a new file of that name. > >

authenticated https post

2006-11-01 Thread assaf
(warning Python newbie) I'm trying to use Python to work with del.icio.us's API. Basically, I need to be able to do a simple https post, with username/password authentication. (For those interested, the del.icio.us API is here: http://del.icio.us/help/api/) I can't for the life of me find a simpl

Re: wxPython TextCtrl - weird scrolling behavior

2006-11-01 Thread abcd
thanks for the feedback, I am watching the screencasts, which are helping already. I think I will try out the Dabo GUI tool since it uses wxPython...and see if I can get the code I need from it. thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: authenticated https post

2006-11-01 Thread Fredrik Lundh
assaf wrote: > I'm trying to use Python to work with del.icio.us's API. > Basically, I need to be able to do a simple https post, with > username/password authentication. > (For those interested, the del.icio.us API is here: > http://del.icio.us/help/api/) > > I can't for the life of me find a si

Re: import in threads: crashes & strange exceptions on dual core machines

2006-11-01 Thread robert
Steve Holden wrote: > Klaas wrote: >> robert wrote: >> >>> Klaas wrote: >>> It seems clear that the import lock does not include fully-executing the module contents. To fix this, just import cookielib before the >>> >>> What is the exact meaning of "not include fully-executing" - >>> re

Re: Why can't you assign to a list in a loop without enumerate?

2006-11-01 Thread Bjoern Schliessmann
Fredrik Lundh wrote: > what's wrong with using enumerate? or a list comprehension? or > some other of the many different ways you can use to build a list > from a set of values? Shouldn't there be one -- and preferably only one -- obvious way to do it? 8) Python Cookbook says "enumerate()", is

Re: authenticated https post

2006-11-01 Thread Assaf Lavie
I think that library is obsolete. It uses http, instead of https. On Nov 1, 3:00 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > assaf wrote: > > I'm trying to use Python to work with del.icio.us's API. > > Basically, I need to be able to do a simple https post, with > > username/password authentic

Re: Why can't you assign to a list in a loop without enumerate?

2006-11-01 Thread Fredrik Lundh
Bjoern Schliessmann wrote: >> what's wrong with using enumerate? or a list comprehension? or >> some other of the many different ways you can use to build a list >> from a set of values? > > Shouldn't there be one -- and preferably only one -- obvious way to > do it? 8) > > Python Cookbook say

Remote Objects via CGI?

2006-11-01 Thread kpd
Three are lots of good looking remote-object implementations for Python such as Pyro, Rpyc, and PyInvoke.All of these require a deamon running to serve the remote objects. Has anyone seen a method of doing this using CGI or FastCGI instead of a deamon? I'm not worried about performance for t

Re: Remote Objects via CGI?

2006-11-01 Thread Fredrik Lundh
kpd wrote: > Has anyone seen a method of doing this using CGI or FastCGI instead of > a deamon? I'm not worried about performance for this application, but > I do have constraints on long-running processes. > > I do want to stay away from XmlRpc if possible. because? -- http://mail.python.

Re: authenticated https post

2006-11-01 Thread Assaf Lavie
On Nov 1, 3:28 pm, "Assaf Lavie" <[EMAIL PROTECTED]> wrote: > I think that library is obsolete. It uses http, instead of https. > > On Nov 1, 3:00 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > assaf wrote: > > > I'm trying to use Python to work with del.icio.us's API. > > > Basically, I need

Re: report progress from C function

2006-11-01 Thread Michael S
I downloaded Pyrex and ran it through their own example. The code looks quite messy, and I even saw a few "goto"s. I think I will stick with my own code for now. Thanks in any case. --- John Machin <[EMAIL PROTECTED]> wrote: > Michael S wrote: > > Good day all. > > > > I rewrote part of my progr

Re: Why can't you assign to a list in a loop without enumerate?

2006-11-01 Thread Roberto Bonvallet
Bjoern Schliessmann wrote: > Fredrik Lundh wrote: > >> what's wrong with using enumerate? or a list comprehension? or >> some other of the many different ways you can use to build a list >> from a set of values? > > Shouldn't there be one -- and preferably only one -- obvious way to > do it? 8)

Re: report progress from C function

2006-11-01 Thread Fredrik Lundh
Michael S wrote: > I downloaded Pyrex and ran it through their own > example. The code looks quite messy, and I even saw a > few "goto"s. looked at the assembler output from your C compiler lately? -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to check if a file exists?

2006-11-01 Thread Ben Finney
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > You could try to read the file, if that fails it doesn't exist: > > try: > f = open('xxx') > except IOError: > f = open('xxx', 'w') > print "file doesn't exist" > print f Except that there are other conditions than "File doesn't exist"

Re: report progress from C function

2006-11-01 Thread Michael S
My assembler is very basic, so it wouldn't help, while my C is OK, well sort of. BTW. Neither have I looked at the machine code that the assembler produces. --- Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Michael S wrote: > > > I downloaded Pyrex and ran it through their own > > example. The co

Re: report progress from C function

2006-11-01 Thread Fredrik Lundh
Michael S wrote: > My assembler is very basic, so it wouldn't help, while > my C is OK, well sort of. > > BTW. Neither have I looked at the machine code that > the assembler produces. so why does the output from Pyrex worry you? it's a compiler, after all. -- http://mail.python.org/mailman

Re: best way to check if a file exists?

2006-11-01 Thread [EMAIL PROTECTED]
Ben Finney wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > > You could try to read the file, if that fails it doesn't exist: > > > > try: > > f = open('xxx') > > except IOError: > > f = open('xxx', 'w') > > print "file doesn't exist" > > print f > > Except that there are o

Re: report progress from C function

2006-11-01 Thread Michael S
What if it doesn't do exactly what you need to? How do you debug through that code? --- Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Michael S wrote: > > > My assembler is very basic, so it wouldn't help, > while > > my C is OK, well sort of. > > > > BTW. Neither have I looked at the machine code

Re: Make all files extension lower by a given directory name

2006-11-01 Thread Tiefeng Wu
Fredrik Lundh wrote: > > fullname = name[:len(name) - 1] + ext.lower() > are you sure you want to strip off the last character in the actual > filename? should "FOO.BAR" really be turned into "FO.bar" ? > name[:len(name) - 1] can be written name[:-1], btw. > > os.rename(os

Re: Make all files extension lower by a given directory name

2006-11-01 Thread Fredrik Lundh
Tiefeng Wu wrote: > strip off the last character because if simply add name > and ext I got result like "FOO..bar", there are two dots. that's not how splitext works, though: >>> os.path.splitext("FOO.BAR") ('FOO', '.BAR') can you post an example of a filename that misbehaves on your machine?

Re: Make all files extension lower by a given directory name

2006-11-01 Thread Tim Chase
>>> fullname = name[:len(name) - 1] + ext.lower() >> are you sure you want to strip off the last character in the actual >> filename? should "FOO.BAR" really be turned into "FO.bar" ? >> name[:len(name) - 1] can be written name[:-1], btw. >>> os.rename(os.path.join(path, f

Style for modules with lots of constants

2006-11-01 Thread Neil Cerutti
The Glk API (which I'm implementing in native Python code) defines 120 or so constants that users must use. The constants already have fairly long names, e.g., gestalt_Version, evtype_Timer, keycode_PageDown. Calls to Glk functions are thus ugly and tedious. scriptref = glk.fileref_create_by_

Re: report progress from C function

2006-11-01 Thread Fredrik Lundh
Michael S wrote: > What if it doesn't do exactly what you need to? How do > you debug through that code? same way as you'd hunt for bugs in the Python-to-bytecode compiler, or your C compiler. -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython TextCtrl - weird scrolling behavior

2006-11-01 Thread Peter Decker
On 1 Nov 2006 04:54:32 -0800, abcd <[EMAIL PROTECTED]> wrote: > thanks for the feedback, I am watching the screencasts, which are > helping already. I think I will try out the Dabo GUI tool since it > uses wxPython...and see if I can get the code I need from it. I think you'll be very impressed.

Re: High level csv reader

2006-11-01 Thread George Sakkis
[EMAIL PROTECTED] wrote: > George> It occured to me that most times I read a csv file, I'm often > George> doing from scratch things like assigning labels to columns, > George> mapping fields to the appropriate type, ignoring some fields, > George> changing their order, etc. Before I

FREE WEB SPACE FOR EVERYONE

2006-11-01 Thread ccillonh
Hey I just got my web server up and running yesterday morning. I have decided to give away free online storage space to everyone. Hell have as many accounts as you want. I limit 5 GB per account. Im testing the load on my server and ask that everyone help me out and upload anything you want. When t

Re: best way to check if a file exists?

2006-11-01 Thread Ben Finney
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > > You could try to read the file, if that fails it doesn't exist: > > > > Except that there are other conditions than "File doesn't exist" > > that can cause an 'open' to fai

Re: best way to check if a file exists?

2006-11-01 Thread [EMAIL PROTECTED]
Ben Finney wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > > Ben Finney wrote: > > > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > > > You could try to read the file, if that fails it doesn't exist: > > > > > > Except that there are other conditions than "File doesn't exist" > >

Re: 3d programming without opengl

2006-11-01 Thread Will McGugan
nelson - wrote: > hi! >i want to build up a simple 3d interactive geometry application in > python. Since i want to run it without 3D acceleration (a scene will > be quite simple) I was wondering if there was a library in python that > allow me to build 3D graphic without the need to use OpenG

Re: Why can't you assign to a list in a loop without enumerate?

2006-11-01 Thread Bjoern Schliessmann
Fredrik Lundh wrote: > define "it". Sorry! I mean iterating over a list and having the list index available in the loop. Like: for i, thing in enumerate(things): pass Regards, Björn -- BOFH excuse #254: Interference from lunar radiation -- http://mail.python.org/mailman/listinfo/pyth

Re: PyDev + Eclipse (Was: Re: What's the best IDE?)

2006-11-01 Thread Michael B. Trausch
Éric Daigneault wrote: > > I run the latest pydev on both windows and linux... The setup is > excatcly the same (on the eclipse, path setup and all) > My windows setup is much better at auto-complete that the linux > setup... In linux, other than with self, I seldom get auto complete on > other

Beginning setup problem

2006-11-01 Thread vedran
Hello again, Before few months,I write to this mailing list with python script install problem,but nobody give me right solution.I work on windows XP,and Python 2.4. Now,when I write in Python 2.4: >>> from distutils.core import setup >>> setup(..) # whatever I write I got the error: Trace

Re: Why can't you assign to a list in a loop without enumerate?

2006-11-01 Thread Fredrik Lundh
Bjoern Schliessmann wrote: >> define "it". > > Sorry! I mean iterating over a list and having the list index > available in the loop. Like: > > for i, thing in enumerate(things): > pass "enumerate" is the obviously right thing for this, sure. but it's not necessarily the right thing for t

Re: ANN: SPE 0.8.3.c Python IDE editor

2006-11-01 Thread SPE - Stani's Python Editor
I checked the berlios site and it seems to be working. Or do you have another problem? Stani Chris Seymour schreef: > Hi Stani, > Not able to reach Berlios. The SourceForge page does not have the > Windows installer. Any ideas when it will be available? > > Thanks. > > Chris > Bernard wrote: >

Re: Beginning setup problem

2006-11-01 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Before few months,I write to this mailing list with python script > install problem,but nobody give me right solution.I work on windows > XP,and Python 2.4. > Now,when I write in Python 2.4: > from distutils.core import setup setup(..) # whatever I write c

Re: Remote Objects via CGI?

2006-11-01 Thread Diez B. Roggisch
kpd wrote: > Three are lots of good looking remote-object implementations for Python > such as Pyro, Rpyc, and PyInvoke.All of these require a deamon > running to serve the remote objects. > > Has anyone seen a method of doing this using CGI or FastCGI instead of > a deamon? I'm not worried

Re: 3d programming without opengl

2006-11-01 Thread Grant Edwards
On 2006-11-01, Will McGugan <[EMAIL PROTECTED]> wrote: > If you are worried about running your 3d app on older > machines, OpenGL will typically fall back to software > rendering if the hardware isn't available. That's true. OpenGL (which will do SW rendering) will certainly be available on most

Re: Style for modules with lots of constants

2006-11-01 Thread Paul McGuire
"Neil Cerutti" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The Glk API (which I'm implementing in native Python code) > defines 120 or so constants that users must use. The constants > already have fairly long names, e.g., gestalt_Version, > evtype_Timer, keycode_PageDown. > > Ca

Re: Style for modules with lots of constants

2006-11-01 Thread bearophileHUGS
Neil Cerutti: > scriptref = glk.fileref_create_by_prompt('Transcript+TextMode', >'WriteAppend', 0) That "+" sign seems useless. A space looks enough to me. The functions can accept case-agnostic strings and ignore spaces inside them. Example: ('transcript textmode ', 'writeappend', 0) > Pars

Re: Style for modules with lots of constants

2006-11-01 Thread Neil Cerutti
On 2006-11-01, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Neil Cerutti: >> scriptref = glk.fileref_create_by_prompt('Transcript+TextMode', >>'WriteAppend', 0) > > That "+" sign seems useless. A space looks enough to me. The > functions can accept case-agnostic strings and ignore spaces > in

Re: Style for modules with lots of constants

2006-11-01 Thread Paul McGuire
"Paul McGuire" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Errata: > opAssoc = Constants(object) Urk! Should be "opAssoc = Constants()" > and so on. In the client modules they would simply enter "from glk import > fileusage, filemode". Or if they just "import glk", the refere

Re: Style for modules with lots of constants

2006-11-01 Thread Neil Cerutti
On 2006-11-01, Paul McGuire <[EMAIL PROTECTED]> wrote: > I recently had to add some new constants to pyparsing, > representing LEFT and RIGHT, but I didn't want to define such > generic and likely-to-collide-with-user-code variable names. > > I settled on defining my own flavor of the Bag class, wh

Re: Style for modules with lots of constants

2006-11-01 Thread Rob Williscroft
Paul McGuire wrote in news:[EMAIL PROTECTED] in comp.lang.python: > > class Constants(object) > pass > > (I guess value immutability could probably be implemented using clever > implementations of __setattr__ and such, but is it really worth the > bother?). > > Then I defined the context

Re: Style for modules with lots of constants

2006-11-01 Thread Paul McGuire
"Rob Williscroft" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Paul McGuire wrote in news:[EMAIL PROTECTED] in > comp.lang.python: > >> >> class Constants(object) >> pass >> >> (I guess value immutability could probably be implemented using clever >> implementations of __seta

Re: 3d programming without opengl

2006-11-01 Thread Kenneth Long
you might find this interesting... www.ogre3d.org/ and its python wrapper http://www.ogre3d.org/wiki/index.php/PyOgre With /without Hardware acceleration... with /without OpenGL or DirectX... hello Ge

Re: Where do nested functions live?

2006-11-01 Thread Frederic Rentsch
Rob Williscroft wrote: > Frederic Rentsch wrote in news:mailman.1556.1162316571.11739.python- > [EMAIL PROTECTED] in comp.lang.python: > > >> Rob Williscroft wrote: >> >>> Frederic Rentsch wrote in news:mailman.1536.1162292996.11739.python- >>> Rob Williscroft wrote:

Re: Style for modules with lots of constants

2006-11-01 Thread bearophileHUGS
Rob Williscroft: > This is nice, but you can cut down on some of the cruft: > > class Constants( object ): > pass > > Constants.RIGHT = 0 > Constants.LEFT = 1 > > ## client code ... > print Constants.LEFT Another possibility is to define such constants as strings instead of integers: _allflags

Re: report progress from C function

2006-11-01 Thread John Machin
On 2/11/2006 12:53 AM, Michael S wrote: > I downloaded Pyrex and ran it through their own > example. The code looks quite messy, and I even saw a > few "goto"s. > I think I will stick with my own code for now. > Thanks in any case. If your own code is doing the right amount of reference counting,

MySQLdb windows binaries for Python 2.5??

2006-11-01 Thread Chris Seymour
HI All, Does such a beast exist? Have been looking but haven't seen any. Any insight would be appreciated. Thanks. Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: compiling on AIX 5.3 with vacpp

2006-11-01 Thread pruebauno
[EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: > > I am trying to compile Python 2.5 on AIX 5.3. I used > > > > building '_locale' extension > > ./Modules/ld_so_aix xlc_r -q64 -bI:Modules/python.exp > > build/temp.aix-5.3-2.5/home/pxadm/.test/Python-2.5/Modules/_localemodule.o > > -L/usr/local

Hooking file open

2006-11-01 Thread Farshid Lashkari
Hi, My goal is to detect all (or most) file dependencies of a script (i.e. modules, dlls, data files). Currently, after a script is finished executing I use sys.modules to determine all module dependencies, and I use win32process.EnumProcessModules to determine DLL dependencies. This works rea

Re: 3d programming without opengl

2006-11-01 Thread Jordan
I don't thnk you should have any problems using Slut with wxpython - wx would be much less amazing if it couldn't do something like that. On the other hand, I thought that you were looking for something that doesn't use openGL and I think that Slut is built around it. Cheers, Jordan nelson - wro

Re: Style for modules with lots of constants

2006-11-01 Thread Rob Williscroft
Paul McGuire wrote in news:[EMAIL PROTECTED] in comp.lang.python: >>> opAssoc = Constants(object) >>> opAssoc.RIGHT = 0 >>> opAssoc.LEFT = 1 >> This is nice, but you can cut down on some of the cruft: >> Constants.LEFT = 1 > One man's cruft is another man's clarity. :-) > The reason I used

Re: best way to check if a file exists?

2006-11-01 Thread [EMAIL PROTECTED]
On Nov 1, 3:44 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > Ben Finney wrote: > > > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > > > You could try to read the file, if that fails it doesn't exist: > > > > Except that there are other condit

Re: Where do nested functions live?

2006-11-01 Thread Steve Holden
Frederic Rentsch wrote: > Rob Williscroft wrote: > >>Frederic Rentsch wrote in news:mailman.1556.1162316571.11739.python- >>[EMAIL PROTECTED] in comp.lang.python: >> >> >> >>>Rob Williscroft wrote: >>> >>> Frederic Rentsch wrote in news:mailman.1536.1162292996.11739.python- >>

Re: best way to check if a file exists?

2006-11-01 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > os.path.exists() checks if a path exists, so a directory as argument > also returns True the original requirement was "to check if a file of a certain name exists before the user creates a new file of that name". if you want to check for files only, use the os.path.is

Re: Why can't you assign to a list in a loop without enumerate?

2006-11-01 Thread Bjoern Schliessmann
Fredrik Lundh wrote: > "enumerate" is the obviously right thing for this, sure. K. > but it's not necessarily the right thing for the OP's "I want to > create a new list based on an existing list". modifying the > existing list is usually not the most efficient way to do that. Agreed. Regards

Re: Where do nested functions live?

2006-11-01 Thread Rob Williscroft
Frederic Rentsch wrote in news:mailman.1613.1162403556.11739.python- [EMAIL PROTECTED] in comp.lang.python: > Since we have a class that goes out of scope > when the function returns, and we don't need more than one instance, why > bother to make an instance? Why not use the class object itself?

Re: Style for modules with lots of constants

2006-11-01 Thread Tim Chase
>> The reason I used instances instead of just the Constants >> class was so that I could define a little more descriptive >> context for the constants, > > Sorry I don't know what you mean here, could I have an example It helps in the recognition if you have separation between something like

Re: scared about refrences...

2006-11-01 Thread SpreadTooThin
Bruno Desthuilliers wrote: > Nick Vatamaniuc a écrit : > (snip) > > In Python all the primitives are copied and all other entities are > > references. > > Plain wrong. There's no "primitives" (ie : primitive data types) in > Python, only objects. And they all get passed the same way. so.. def fn

Re: scared about refrences...

2006-11-01 Thread Diez B. Roggisch
SpreadTooThin schrieb: > Bruno Desthuilliers wrote: >> Nick Vatamaniuc a écrit : >> (snip) >>> In Python all the primitives are copied and all other entities are >>> references. >> Plain wrong. There's no "primitives" (ie : primitive data types) in >> Python, only objects. And they all get passed

Re: scared about refrences...

2006-11-01 Thread Fredrik Lundh
SpreadTooThin wrote: >> Plain wrong. There's no "primitives" (ie : primitive data types) in >> Python, only objects. And they all get passed the same way. > > so.. > def fn(x): >x = x + 1 >print x > > a = 2 > fn(a) > fn(2) > > Wouldn't you say that this is being passed by value rather t

Re: Remote Objects via CGI?

2006-11-01 Thread kpd
I did not have much hope, but thought there might be something. I was thinking of going this route to get a very quick solution to a python fat-client adding to or retrieving objects from a community repository over http. XMLRpc could work if there is a CGI solution, although the data sets do not

CSV module, DictReader problem (bug?)

2006-11-01 Thread Jeff Blaine
It's been a year or so since I written Python code, so maybe I am just doing something really dumb, but... Documentation = class DictReader(csvfile[,fieldnames=None, [,restkey=None[, restval=None[, dialect='excel' [, *args, **kwds]) Cr

Re: Remote Objects via CGI?

2006-11-01 Thread Fredrik Lundh
kpd wrote: > I did not have much hope, but thought there might be something. I was > thinking of going this route to get a very quick solution to a python > fat-client adding to or retrieving objects from a community repository > over http. > > XMLRpc could work if there is a CGI solution, altho

Re: Style for modules with lots of constants

2006-11-01 Thread Paddy
Neil Cerutti wrote: > The Glk API (which I'm implementing in native Python code) > defines 120 or so constants that users must use. The constants > already have fairly long names, e.g., gestalt_Version, > evtype_Timer, keycode_PageDown. > > Calls to Glk functions are thus ugly and tedious. > >

uninstall and Windows file associations

2006-11-01 Thread Roger Miller
When I installed Python 2.5 (on Windows XP) I left 2.4 in place "just in case". Today I decided to remove it. However after doing so (from the control panel) I found that Windows no longer knows about the Python file types and associations. Is this behavior expected, or was there something wrong wi

Re: CSV module, DictReader problem (bug?)

2006-11-01 Thread Fredrik Lundh
Jeff Blaine wrote: > It's been a year or so since I written Python code, so maybe > I am just doing something really dumb, but... > > Documentation > = > > class DictReader(csvfile[,fieldnames=None, > [,restkey=None[, restval=None[, dialect='excel' >

Re: Style for modules with lots of constants

2006-11-01 Thread Rob Williscroft
Tim Chase wrote in news:mailman.1617.1162412498.11739.python- [EMAIL PROTECTED] in comp.lang.python: >>> The reason I used instances instead of just the Constants >>> class was so that I could define a little more descriptive >>> context for the constants, >> >> Sorry I don't know what you mean h

Re: Where do nested functions live?

2006-11-01 Thread Rob Williscroft
Steve Holden wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Since we have a class that goes out of scope >> when the function returns, and we don't need more than one instance, >> why bother to make an instance? Why not use the class object itself? >> >> def whatever( new_ms ): >> >>

Re: CSV module, DictReader problem (bug?)

2006-11-01 Thread Jeff Blaine
I see what's wrong. Me. Wow am I ever rusty. Jeff Blaine wrote: > It's been a year or so since I written Python code, so maybe > I am just doing something really dumb, but... > > Documentation > = > > class DictReader(csvfile[,fieldnames=None, > [,restkey=None[, re

Re: Hooking file open

2006-11-01 Thread Dale Strickland-Clark
You might consider trapping calls to file() too, which is an alias for open(). Also, I think I'd do my logging before calling the real function. It depends how you want to deal with exceptions. Farshid Lashkari wrote: > Hi, > > My goal is to detect all (or most) file dependencies of a script (

Re: CSV module, DictReader problem (bug?)

2006-11-01 Thread John Machin
Jeff Blaine wrote: > It's been a year or so since I written Python code, so maybe > I am just doing something really dumb, but... > > Documentation > = > > class DictReader(csvfile[,fieldnames=None, > [,restkey=None[, restval=None[, dialect='excel' > [,

Re: Providing full interaction with the run time

2006-11-01 Thread Dale Strickland-Clark
Thanks for the info. I didn't know about that module. I'll take a look. Fredrik Lundh wrote: > Dale Strickland-Clark wrote: > >> We have a system we're developing which runs as a server. It has an >> xml-rpc interface which I've extended to provide some debugging >> facilities. This has already

Re: Hooking file open

2006-11-01 Thread Farshid Lashkari
Dale Strickland-Clark wrote: > You might consider trapping calls to file() too, which is an alias for > open(). Thanks, I didn't know about that. > Also, I think I'd do my logging before calling the real function. It depends > how you want to deal with exceptions. I placed the logging after the

Re: Remote Objects via CGI?

2006-11-01 Thread kpd
Thanks Fredrik. I gave XmlRpc a shot as you implied earlier. It works like a charm. This is how I tested quickly locally without a large web-server installed: 1. Run cgiserver.py - this takes the place of the normal web server. 2. Then run test.py to make a local xmlrpc call. ./cgi-bin/xmlrpc

jyton usage in a python program

2006-11-01 Thread Oğuz Yarımtepe
Hi all. I am planning to develop an application using Python. I will need to use Zemberek libraries that are written with Java. I know i can use Java libraries with the help of Jython. I will write my software by Python and will use some modules inside it. But i will need to use that Java librari

Re: jyton usage in a python program

2006-11-01 Thread Fredrik Lundh
Oğuz Yarımtepe wrote: > Hi all. I am planning to develop an application using Python. I will need to > use Zemberek libraries that are written with Java. I know i can use Java > libraries with the help of Jython. I will write my software by Python and > will use some modules inside it. But i will

Re: uninstall and Windows file associations

2006-11-01 Thread Neil Hodgson
Roger Miller: > When I installed Python 2.5 (on Windows XP) I left 2.4 in place "just > in case". Today I decided to remove it. However after doing so (from > the control panel) I found that Windows no longer knows about the > Python file types and associations. Is this behavior expected, Th

Re: scared about refrences...

2006-11-01 Thread Inyeol Lee
On Wed, Nov 01, 2006 at 12:20:36PM -0800, SpreadTooThin wrote: > > Bruno Desthuilliers wrote: > > Nick Vatamaniuc a �crit : > > (snip) > > > In Python all the primitives are copied and all other entities are > > > references. > > > > Plain wrong. There's no "primitives" (ie : primitive data types

Re: ANN: SPE 0.8.3.c Python IDE editor

2006-11-01 Thread Chris Seymour
Hi Stani, I got it going now. Not sure why but seems good to go now. Thanks for a great product. Cheers. Chris SPE - Stani's Python Editor wrote: > I checked the berlios site and it seems to be working. Or do you have > another problem? > Stani > > Chris Seymour schreef: > > > Hi Stani, > > Not

Re: Style for modules with lots of constants

2006-11-01 Thread Ben Finney
Neil Cerutti <[EMAIL PROTECTED]> writes: > Calls to Glk functions are thus ugly and tedious. > > scriptref = glk.fileref_create_by_prompt( > glk.fileusage_Transcript | glk.fileusage_TextMode, > glk.filemode_WriteAppend, 0) > > Please give me some good style advice for t

Re: Python and SSL enabled

2006-11-01 Thread matey
Firstly, thank for answering. Otherwise I wouldn't know where to turn for help... I tried to run the following simple program #!/usr/local/bin/python import M2Crypto u = M2Crypto.m2urllib.URLopener() u.open('http://www.yahoo.com') However I got the following errror: Traceback (most

Re: Style for modules with lots of constants

2006-11-01 Thread Ron Adam
Neil Cerutti wrote: > On 2006-11-01, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> Neil Cerutti: >>> scriptref = glk.fileref_create_by_prompt('Transcript+TextMode', >>>'WriteAppend', 0) >> That "+" sign seems useless. A space looks enough to me. The >> functions can accept case-agnostic strin

  1   2   >