Re: Is there a way to "link" a python program from several files?

2008-02-21 Thread George Sakkis
On Feb 21, 1:58 am, [EMAIL PROTECTED] (Edward A. Falk) wrote: > In article <[EMAIL PROTECTED]>, > > BlueBird <[EMAIL PROTECTED]> wrote: > > >I wrote a small wiki page to sum-up my findings about such typical > >problem: > > >http://www.freehackers.org/Packaging_a_python_program > > Excellent refer

Re: is this data structure build-in or I'll have to write my own class?

2008-02-21 Thread Robert Bossy
mkPyVS wrote: > This isn't so optimal but I think accomplishes what you desire to some > extent... I *think* there is some hidden gem in inheriting from dict > or an mapping type that is cleaner than what I've shown below though. > > class dum_struct: >def __init__(self,keyList,valList): >

Re: Double underscores -- ugly?

2008-02-21 Thread cokofreedom
On Feb 21, 3:31 am, [EMAIL PROTECTED] wrote: > On Feb 19, 8:20 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > > > > > [EMAIL PROTECTED] wrote: > > > On Feb 19, 10:26 am, Wildemar Wildenburger > > > <[EMAIL PROTECTED]> wrote: > > >> Jason wrote: > > >>> Hmm. I must be the only person who doesn't thi

Re: Is there a way to "link" a python program from several files?

2008-02-21 Thread Diez B. Roggisch
Edward A. Falk schrieb: > In article <[EMAIL PROTECTED]>, > BlueBird <[EMAIL PROTECTED]> wrote: >> I wrote a small wiki page to sum-up my findings about such typical >> problem: >> >> http://www.freehackers.org/Packaging_a_python_program >> > > Excellent references, but maybe a bit of overkill.

wxPython Plot always comes to focus on redraw

2008-02-21 Thread Jacob Davis
Hi. I am using wxPython, and I have a frame that has a notebook in it. there are 3 pages in the notebook, 2 of which are Panels and 1 of which is a PlotCanvas. The data for the plot changes when I press a button that is in the frame, but not in the notebook (as designed). the button als

Re: using PIL for PCA analysis

2008-02-21 Thread Matthieu Brucher
Hi, You should convert your data to numpy and make it 1D (for the moment, it is 3D) by calling the ravel() method. Then you can create your covariance matrix ;) Matthieu 2008/2/21, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > hi guys > i am trying out PCA analysis using python.I have a set of > j

Replacing 'if __name__ == __main__' with decorator (was: Double underscores -- ugly?)

2008-02-21 Thread grflanagan
On Feb 19, 10:01 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Berwyn <[EMAIL PROTECTED]> wrote: > >> Is it just me that thinks "__init__" is rather ugly? Not to mention > >> "if __name__ == '__main__': ..."? > > > That ugliness has long been my biggest bugbear with python, too. The > > __name__ =

Re: Article of interest: Python pros/cons for the enterprise

2008-02-21 Thread Bruno Desthuilliers
Carl Banks a écrit : > On Feb 20, 8:58 am, Tim Chase <[EMAIL PROTECTED]> wrote: >>> You Used Python to Write WHAT? >>> http://www.cio.com/article/185350 >> """ >> Furthermore, the power and expressivity that Python offers means >> that it may require more skilled developers. >> [...down to the summ

Re: newbie in python

2008-02-21 Thread Jeroen Ruigrok van der Werven
-On [20080221 11:56], [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote: >Can someone help me to get in the right track, and get a good move? http://wiki.python.org/moin/BeginnersGuide -- Jeroen Ruigrok van der Werven / asmodai イェルーン ラウフロック ヴァン デル ウェルヴェン http://www.in-nomine.org/ | h

Re: newbie in python

2008-02-21 Thread cokofreedom
> >Can someone help me to get in the right track, and get a good move? > > http://wiki.python.org/moin/BeginnersGuide http://www.diveintopython.org/ -- http://mail.python.org/mailman/listinfo/python-list

newbie in python

2008-02-21 Thread ctechnician
Hi anyone I'm very interesed to learn python and really willing to do so,but unfortunately dont know where to start, or what programs need to install to start. Can someone help me to get in the right track, and get a good move? Thanks for all help pls reply on [EMAIL PROTECTED] or [EMAIL PROTE

Backup Script over ssh

2008-02-21 Thread Christian Kortenhorst
Hey all I am new to python and the list. I want to create backup script for my windows PC and upload to Linux server over ssh but whats the best way to go about this. Just want to copy the modified and new files up to server in folder that has Month/Year so every month new sync is created, but eve

Re: newbie in python

2008-02-21 Thread 7stud
[EMAIL PROTECTED] wrote: > Hi anyone > > I'm very interesed to learn python and really willing to do so,but > unfortunately dont know where to start, or what programs need to > install to start. > > Can someone help me to get in the right track, and get a good move? > > Thanks for all help > If yo

Re: Linux/Python Issues

2008-02-21 Thread MartinRinehart
re being serious I am serious. I am seriously trying to develop a nice language for beginners. I was at Dartmouth in 1965 when BASIC was new. It let me use the computer without learning Fortran. It was very successful. I think it's past time for another one. I think we could have a lot more capabi

Globals or objects?

2008-02-21 Thread MartinRinehart
I had a global variable holding a count. One source Google found suggested that I wouldn't need the global if I used an object. So I created a Singleton class that now holds the former global as an instance attribute. Bye, bye, global. But later I thought about it. I cannot see a single advantage

Re: wxPython Plot always comes to focus on redraw

2008-02-21 Thread Steve Holden
Jacob Davis wrote: > Hi. > > I am using wxPython, and I have a frame that has a notebook in it. > there are 3 pages in the notebook, 2 of which are Panels and 1 of > which is a PlotCanvas. The data for the plot changes when I press a > button that is in the frame, but not in the notebook (

Re: Globals or objects?

2008-02-21 Thread Steve Holden
[EMAIL PROTECTED] wrote: > I had a global variable holding a count. One source Google found > suggested that I wouldn't need the global if I used an object. So I > created a Singleton class that now holds the former global as an > instance attribute. Bye, bye, global. > > But later I thought about

Re: usenet problem

2008-02-21 Thread Ben Finney
Jacob Davis <[EMAIL PROTECTED]> writes: > Hi. I am a newbie to usenet. I am using mac and have downloaded a > free usenet client, "MT-NewsWatcher". I put in comp.lang.python but > it says that it cannot get the address of the news server host. 'comp.lang.python' is the name of the newsgroup, not

Re: Linux/Python Issues

2008-02-21 Thread Paul Boddie
On 21 Feb, 13:04, [EMAIL PROTECTED] wrote: > > re DLing source > > As a "solution" to the problem of wanting a program on my computer, it > sucks. It doesn't suck if you're just installing one program, but if there are a lot of dependencies it can quickly suck, yes. Even with systems that comprehe

Re: Globals or objects?

2008-02-21 Thread Hrvoje Niksic
Steve Holden <[EMAIL PROTECTED]> writes: > If a function uses a global variable then you have to initialize the > same global variable in another program that uses it: yet another > piece of setup you will forget to do. If the global variable belongs to the module, then it is up to the module to

Sending key-presses to other programs on Windows, and settings of controls?

2008-02-21 Thread Tim van der Leeuw
Hi, I'm looking for ways to send keypresses to another application on Windows XP, and to set values of Windows Controls (all of them text-boxes). This is to try automate testing of the application. I think I've done things like that before from Python, but I don't remember for sure. Can this be

Re: Adding Priority Scheduling feature to the subprocess

2008-02-21 Thread TimeHorse
On Feb 20, 10:15 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > | Because UNIX uses priorities between +20 and -20 and Windows, via > | Process and Thread priorities, allows settings between 0 and 31, a > | uniform setting for each system should be derived.  This would be > | accomplished by giving

Re: Article of interest: Python pros/cons for the enterprise

2008-02-21 Thread Nicola Musatti
On Feb 21, 10:55 am, Bruno Desthuilliers wrote: > Carl Banks a écrit : [...] > > C++ is a compile-time, type-checked language, which means it is > > totally safer for newbies than Python. Yep, your big company is > > totally safe with newbie C++ programmers. > > Mouarf ! Brillant demonstration, t

Re: Tkinter OSX and "lift"

2008-02-21 Thread Kevin Walzer
Miki wrote: > Hello, > > Tk.lift doesn't seem to work on OSX (Python 2.5.1). > The below starts OK, but the window is the behind all other windows. > > from Tkinter import * > > root = Tk() > Button(root, text="OK", command=root.quit).pack() > root.lift() > root.mainloop() > > Any ideas how to

understaning "self"

2008-02-21 Thread Poppy
I've been searching online to try get a better understanding of what "self" does when I define this parameter in my class functions. All I'm finding is debates on whether "self" has any value to the language but that doesn't help me in my newbie question. So the code excerpt below is from "Begi

Re: Globals or objects?

2008-02-21 Thread tinnews
Steve Holden <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I had a global variable holding a count. One source Google found > > suggested that I wouldn't need the global if I used an object. So I > > created a Singleton class that now holds the former global as an > > instance attribute

Re: Tkinter OSX and "lift"

2008-02-21 Thread Miki
Hello Kevin, > Tk.lift doesn't seem to work on OSX (Python 2.5.1). >> If you click on the PythonLauncher application that runs in your dock >> when this script is executed, the window comes into focus fine. You're right, but I want to window to be initially in focus (without the user clicking on t

Re: Globals or objects?

2008-02-21 Thread tinnews
Aahz <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > <[EMAIL PROTECTED]> wrote: > > > >I had a global variable holding a count. One source Google found > >suggested that I wouldn't need the global if I used an object. So I > >created a Singleton class that now holds the former globa

Re: ANN: Phatch = PHoto bATCH processor and renamer based on PIL

2008-02-21 Thread Istvan Albert
On Feb 18, 9:58 am, "SPE - Stani's Python Editor" <[EMAIL PROTECTED]> wrote: > I'm pleased to announce the release of Phatch which is a > powerful batch processor and renamer. Phatch exposes a big part of This program is fantastic! Very accesible user interface and produces ggreat images. Thanks!

Re: Globals or objects?

2008-02-21 Thread Aahz
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: > >I had a global variable holding a count. One source Google found >suggested that I wouldn't need the global if I used an object. So I >created a Singleton class that now holds the former global as an >instance attribute. Bye, bye, globa

Re: understaning "self"

2008-02-21 Thread Mike Driscoll
On Feb 21, 7:34 am, "Poppy" <[EMAIL PROTECTED]> wrote: > I've been searching online to try get a better understanding of what "self" > does when I define this parameter in my class functions. All I'm finding is > debates on whether "self" has any value to the language but that doesn't > help me in

Re: wxPython Plot always comes to focus on redraw

2008-02-21 Thread Mike Driscoll
On Feb 21, 2:57 am, Jacob Davis <[EMAIL PROTECTED]> wrote: > Hi. > > I am using wxPython, and I have a frame that has a notebook in it. > there are 3 pages in the notebook, 2 of which are Panels and 1 of > which is a PlotCanvas. The data for the plot changes when I press a > button that is in the

Re: Globals or objects?

2008-02-21 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > I had a global variable holding a count. One source Google found > suggested that I wouldn't need the global if I used an object. So I > created a Singleton class that now holds the former global as an > instance attribute. Bye, bye, global. > > But later I thought abou

Re: newbie in python

2008-02-21 Thread subeen
Dive into Python is a very good book but it's for people who have experience in other languages. I liked the book. Whatever book you read, please take a look at the Python Tutorial: http://docs.python.org/tut/tut.html, it will help. regards, Subeen. http://love-python.blogspot.com/ On Feb 21, 6

exec and closures

2008-02-21 Thread Alejandro Dubrovsky
About a month ago, there was a thread on auto-assigning decorators for __init__. One by André Roberge is here: http://groups.google.com/group/comp.lang.python/browse_frm/ thread/32b421bbe6caaeed/0bcd17b1fa4fb07c?#0bcd17b1fa4fb07c This works well for simple cases, but doesn't take keyword argumen

RE: Article of interest: Python pros/cons for the enterprise

2008-02-21 Thread Ryan Ginstrom
> On Behalf Of Nicola Musatti > Newbies learn, and the fundamental C++ lessons are usually > learnt quite easily. Unless we're talking about idiots, that > is, but in this case at least C++ is likely to make their > deficiencies evident sooner than most other programming > languages. So, yes, y

RE: using PIL for PCA analysis

2008-02-21 Thread Bronner, Gregory
Since nobody has responded to this: I know nothing about PIL, but you can do this using numpy and scipy fairly easily, and you can transform PIL arrays into Numpy arrays pretty quickly as well. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, Februa

Re: using PIL for PCA analysis

2008-02-21 Thread [EMAIL PROTECTED]
On Feb 21, 7:35 pm, "Bronner, Gregory" <[EMAIL PROTECTED]> wrote: you can do this using numpy and scipy > fairly easily, and you can transform PIL arrays into Numpy arrays pretty > quickly as well. > i can use numpy ndarray or matrix once i have a PIL array with elements in the correct format(ie a

Re: Article of interest: Python pros/cons for the enterprise

2008-02-21 Thread Tim Chase
> Newbies learn, and the fundamental C++ lessons are usually > learnt quite easily. Ah yes...that would be why Scott Meyers has written three volumes[1] cataloging the gotchas that even experienced C++ programmers can make... And the 1030 page Stroustrup C++ reference is easily comprehended by

Re: using PIL for PCA analysis

2008-02-21 Thread Paul McGuire
On Feb 21, 1:41 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > hi guys > i am trying out  PCA analysis using python.I have a set of > jpeg(rgbcolor) images whose pixel data i need to extract and make a > matrix .( rows =num of images and cols=num of pixels) > For this i need to represent an i

Re: Globals or objects?

2008-02-21 Thread Mel
James Newton wrote: > Duncan Booth wrote: >> The easiest way in Python to implement a singleton is just to >> use a module: all modules are singletons and there is a >> defined mechanism (import) for accessing them. [ ... ] > Could you give a bare-bones demonstration of it that the relative newbie

RE: Globals or objects?

2008-02-21 Thread James Newton
Duncan Booth wrote: > The easiest way in Python to implement a singleton is just to > use a module: all modules are singletons and there is a > defined mechanism (import) for accessing them. Hi Duncan, I'm intrigued by this idea. Could you give a bare-bones demonstration of it that the relative

how can i profile every line of code

2008-02-21 Thread scsoce
I want to profile a function which has some lines of statement. It seem that profile module only report function's stats instead of every line of code, how can i profile every line of code? thanks. scsoce -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie in python

2008-02-21 Thread Michael Poeltl
A big help for 'easily" learning python was and is "Learning Python" (a book written by Mark Lutz) after having studied this book you are able to "think in python" another book I like very much is "Core Python Programming" (written by Wesley Chun) regards michael On Thursday 21 February 2008

Re: Article of interest: Python pros/cons for the enterprise

2008-02-21 Thread Nicola Musatti
Please do not reply personally to newsgroup postings, thank you. On Thu, Feb 21, 2008 at 4:00 PM, Tim Chase <[EMAIL PROTECTED]> wrote: [...] -- Nicola.Musatti gmail com Home: http://nicola.musatti.googlepages.com/home Blog: http://wthwdik.wordpress.com/ -- http://mail.python.org/mailman/listi

Re: Article of interest: Python pros/cons for the enterprise

2008-02-21 Thread Nicola Musatti
On Feb 21, 3:46 pm, "Ryan Ginstrom" <[EMAIL PROTECTED]> wrote: > > On Behalf Of Nicola Musatti > > Newbies learn, and the fundamental C++ lessons are usually > > learnt quite easily. Unless we're talking about idiots, that > > is, but in this case at least C++ is likely to make their > > deficienci

Re: Globals or objects?

2008-02-21 Thread Aahz
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: >Aahz <[EMAIL PROTECTED]> wrote: >> In article <[EMAIL PROTECTED]>, >> <[EMAIL PROTECTED]> wrote: >>> >>>I had a global variable holding a count. One source Google found >>>suggested that I wouldn't need the global if I used an object. So

Re: Is there any python lib for NAT transversal?

2008-02-21 Thread Jean-Paul Calderone
On Thu, 21 Feb 2008 14:50:50 +0800, hawk gao <[EMAIL PROTECTED]> wrote: >Is there any python lib for NAT transversal? Divmod Vertex is such a library (it does a few other things as well), but it is not nearly complete and has little documentation. http://divmod.org/trac/wiki/DivmodVertex Jean-Pa

Re: Tkinter OSX and "lift"

2008-02-21 Thread Kevin Walzer
Miki wrote: > Hello Kevin, > >> Tk.lift doesn't seem to work on OSX (Python 2.5.1). >>> If you click on the PythonLauncher application that runs in your dock >>> when this script is executed, the window comes into focus fine. > You're right, but I want to window to be initially in focus (without >

Re: Looking for up to date documentation for Python/Tkinter

2008-02-21 Thread Kevin Walzer
Kintaro wrote: > Oh wise usenet users, > > Please speak unto me the URL which contain the latest documentation on > Python/Tkinter programming. > > I have seen Fredrik Lundh's introduction to tkinter (and others) and > it appears to be for an earlier version of Python. I am working with > Python

Re: Linux/Python Issues

2008-02-21 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > re being serious > > I am serious. I am seriously trying to develop a nice language for > beginners. That's not what I was talking about. > re DLing source > > As a "solution" to the problem of wanting a program on my computer, it > sucks. On Windows I'll DL an ins

Re: Looking for up to date documentation for Python/Tkinter

2008-02-21 Thread Daniel Mahoney
On Thu, 21 Feb 2008 07:47:35 -0800, Kintaro wrote: > Oh wise usenet users, > > Please speak unto me the URL which contain the latest documentation on > Python/Tkinter programming. > > I have seen Fredrik Lundh's introduction to tkinter (and others) and > it appears to be for an earlier version o

Re: Article of interest: Python pros/cons for the enterprise

2008-02-21 Thread Nicola Musatti
On Feb 21, 4:00 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > Newbies learn, and the fundamental C++ lessons are usually > > learnt quite easily. > > Ah yes...that would be why Scott Meyers has written three > volumes[1] cataloging the gotchas that even experienced C++ > programmers can make... Sco

Re: Article of interest: Python pros/cons for the enterprise

2008-02-21 Thread Steve Holden
Ryan Ginstrom wrote: >> On Behalf Of Nicola Musatti >> Newbies learn, and the fundamental C++ lessons are usually >> learnt quite easily. Unless we're talking about idiots, that >> is, but in this case at least C++ is likely to make their >> deficiencies evident sooner than most other programmin

Looking for up to date documentation for Python/Tkinter

2008-02-21 Thread Kintaro
Oh wise usenet users, Please speak unto me the URL which contain the latest documentation on Python/Tkinter programming. I have seen Fredrik Lundh's introduction to tkinter (and others) and it appears to be for an earlier version of Python. I am working with Python 2.5 and most doc I am finding a

RE: Globals or objects? (is: module as singleton)

2008-02-21 Thread James Newton
Mel wrote: >> James Newton wrote: >> Could you give a bare-bones demonstration of [implementing a singleton >> by using a module]? > > I had a club-membership application that ran for several years. > Default pathnames, etc. for the particular year came from a module > called thisyear.py: > #

Python on Windows Help

2008-02-21 Thread msmith
I've written the following script based on information I have found on the web. The purpose of the script is to start an HTTP listener on the machine it's running on that will give status on a particular service running on that system. I've tried to create this as a service on the windows server

distutils setup - changing the location in site-packages

2008-02-21 Thread imageguy
I am hoping if someone can set me straight. I have created a setup script for a module, however, when running the install on my own machine, I would like to place the module in a specific site-packages directory/package. So if I start with a module in .\dev\mygreatmodule.py I want to end up

Re: Globals or objects?

2008-02-21 Thread tinnews
Aahz <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > <[EMAIL PROTECTED]> wrote: > >Aahz <[EMAIL PROTECTED]> wrote: > >> In article <[EMAIL PROTECTED]>, > >> <[EMAIL PROTECTED]> wrote: > >>> > >>>I had a global variable holding a count. One source Google found > >>>suggested that I

RE: Article of interest: Python pros/cons for the enterprise

2008-02-21 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Tim Chase > Sent: Wednesday, February 20, 2008 8:58 AM > To: estherschindler > Cc: python-list@python.org > Subject: Re: Article of interest: Python pros/cons for the enterprise > > > Oh noes!

Re: distutils setup - changing the location in site-packages

2008-02-21 Thread james . pye
On Feb 21, 9:33 am, imageguy <[EMAIL PROTECTED]> wrote: > I have the setup script working, however, when I run the install, it > places the module in the root of site-packages. > > The following is the deatils from the script > setup ( >   name = "mymodule", >   version = "0.1", >   description = "

RE: Globals or objects? (is: module as singleton)

2008-02-21 Thread Duncan Booth
"James Newton" <[EMAIL PROTECTED]> wrote: > Perhaps my real question is about how to visualize a module: what makes > an imported module different from an instance? On one level: nothing. An imported module is an instance of the module type. Modules don't have to be associated with python code:

RE: Globals or objects? (is: module as singleton)

2008-02-21 Thread James Newton
Duncan Booth wrote: > you can create additional module instances (by calling new.module) Hi Duncan, Could you provide a scenario where this would be useful (and the best practice)? > What you get with a module is support for locating a specific module > and ensuring that you don't get duplicate

Re: Why must implementing Python be hard unlike Scheme?

2008-02-21 Thread John Nagle
[EMAIL PROTECTED] wrote: > I'm learning Scheme and I am amazed how easy it is to start building a > half baked Scheme implementation that somewhat works. > > After knowing Python for *years* I have no idea how to actually > implement the darn thing. Why? It's not very difficult. Get a pars

Re: Article of interest: Python pros/cons for the enterprise

2008-02-21 Thread Nicola Musatti
On Feb 21, 5:14 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Ryan Ginstrom wrote: > >> On Behalf Of Nicola Musatti > >> Newbies learn, and the fundamental C++ lessons are usually > >> learnt quite easily. Unless we're talking about idiots, that > >> is, but in this case at least C++ is likely to m

Re: exec and closures

2008-02-21 Thread Peter Otten
Alejandro Dubrovsky wrote: > About a month ago, there was a thread on auto-assigning decorators for > __init__. One by André Roberge is here: > http://groups.google.com/group/comp.lang.python/browse_frm/ > thread/32b421bbe6caaeed/0bcd17b1fa4fb07c?#0bcd17b1fa4fb07c > > This works well for simple

Re: Article of interest: Python pros/cons for the enterprise

2008-02-21 Thread Paul Boddie
On 21 Feb, 16:37, Nicola Musatti <[EMAIL PROTECTED]> wrote: > > While attempting to dereference a null reference is a rather common > mistake in languages such as Java and C# - I'm not sure about Python - > the one invaluable guarantee provided by the garbage collector is the > absence of *invalid*

KeyboardInterrupt should not kill subprocess

2008-02-21 Thread Michael Goerz
Hi, I'm using subprocess.Popen() to run some background processes. However, the program is also supposed to catch CTRL+C keyboard interrupts for refreshs (i.e. a keyboard interrupt doesn't shut down the program). But as it seems, a keyboard interrupt will automatically pass down to the subproc

Re: Why must implementing Python be hard unlike Scheme?

2008-02-21 Thread Paul Boddie
On 21 Feb, 18:28, John Nagle <[EMAIL PROTECTED]> wrote: > > Why? It's not very difficult. Get a parser for LALR(1) grammars, > like YACC or Bison, write a tokenizer that understands Python indentation, > hook up a dictionary, and parse the thing into a tree. This is all > covered in Compile

Last 4 Letters of String

2008-02-21 Thread Robert Rawlins - Think Blue
Hello Guys, I'm looking for a function which will give me the last 4 characters of a given string. I'm sure it's a very simple task but I couldn't find anything of it. Any ideas? Rob -- http://mail.python.org/mailman/listinfo/python-list

Re: understaning "self"

2008-02-21 Thread Poppy
Thanks for your explanation and pointer. "Mike Driscoll" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Feb 21, 7:34 am, "Poppy" <[EMAIL PROTECTED]> wrote: >> I've been searching online to try get a better understanding of what >> "self" >> does when I define this parameter in

Re: Looking for up to date documentation for Python/Tkinter

2008-02-21 Thread Rob Wolfe
Daniel Mahoney <[EMAIL PROTECTED]> writes: > On Thu, 21 Feb 2008 07:47:35 -0800, Kintaro wrote: > >> Oh wise usenet users, >> >> Please speak unto me the URL which contain the latest documentation on >> Python/Tkinter programming. >> >> I have seen Fredrik Lundh's introduction to tkinter (and ot

Re: Last 4 Letters of String

2008-02-21 Thread Michael L Torrie
Robert Rawlins - Think Blue wrote: > Hello Guys, > > > > I'm looking for a function which will give me the last 4 characters of a > given string. I'm sure it's a very simple task but I couldn't find anything > of it. Use the same technique as you'd use slicing a list. http://www.diveintopytho

Re: Last 4 Letters of String

2008-02-21 Thread Rafael Sachetto
Try this >>> s = "abcdefgh" >>> s[-4:] 'efgh 2008/2/21, Robert Rawlins - Think Blue <[EMAIL PROTECTED]>: > > > > > Hello Guys, > > > > I'm looking for a function which will give me the last 4 characters of a > given string. I'm sure it's a very simple task but I couldn't find anything > of it. >

Re: understaning "self"

2008-02-21 Thread Nicola Musatti
On Feb 21, 2:34 pm, "Poppy" <[EMAIL PROTECTED]> wrote: > I've been searching online to try get a better understanding of what "self" > does when I define this parameter in my class functions. All I'm finding is > debates on whether "self" has any value to the language but that doesn't > help me in

Re: Article of interest: Python pros/cons for the enterprise

2008-02-21 Thread Jeff Schwab
Bruno Desthuilliers wrote: > Carl Banks a écrit : >> On Feb 20, 8:58 am, Tim Chase <[EMAIL PROTECTED]> wrote: You Used Python to Write WHAT? http://www.cio.com/article/185350 >>> """ >>> Furthermore, the power and expressivity that Python offers means >>> that it may require more skilled

Choosing a Metaclass?

2008-02-21 Thread Jeff McNeil
Hi list, Hopefully a quick metaclass question. In the following example, MyMeta is a metaclass that does not inherit directly from type: #!/usr/bin/python class MyMeta(object): def __new__(cls, name, bases, vars): print "MyMeta.__new__ called for %s" % name return type(name,

RE: Last 4 Letters of String

2008-02-21 Thread Reedick, Andrew
How would you get the last 4 items of a list? From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Rawlins - Think Blue Sent: Thursday, February 21, 2008 11:36 AM To: python-list@python.org Subject: Last 4 Letters of String Hello Guys, I'm looking for a function whic

RE: Last 4 Letters of String

2008-02-21 Thread James Newton
>>> "string whose last four letters are abcd"[-4:] 'abcd' From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Rawlins - Think Blue Sent: 21 February 2008 11:36 To: python-list@python.org Subject: Last 4 Letters of String Hello Guys, I

Help on help()

2008-02-21 Thread dbr517
Is there any technique for preventing help from recursing into the module tree?? If I do: import my_module help(my_module) I'd like to see ONLY help on my_module, NOT help on all the functions inherited from the various parent classes . . . A quick search of the documentation didn't turn up any

can't set attributes of built-in/extension type

2008-02-21 Thread Neal Becker
I'm working on a simple extension. Following the classic 'noddy' example. In [15]: cmplx_int32 Out[15]: Now I want to add an attribute to this type. More precisely, I want a class attribute. cmplx_int32.test = 0 --- TypeE

Script Running Time

2008-02-21 Thread ewanfisher
Hello, I am trying to find a way to output how long a script took to run. Obviously the print would go at the end of the script, so it would be the time up till that point. I also run a PostgreSQL query inside the script and would like to separately show how long the query took to run. Is this e

Re: newbie in python

2008-02-21 Thread Jeff Schwab
[EMAIL PROTECTED] wrote: > I'm very interesed to learn python and really willing to do so,but > unfortunately dont know where to start, or what programs need to > install to start. There are several good replies already on this thread, but in case any experienced programmers searching the Google

Re: can't set attributes of built-in/extension type

2008-02-21 Thread 7stud
On Feb 21, 11:19 am, Neal Becker <[EMAIL PROTECTED]> wrote: > I'm working on a simple extension.  Following the classic 'noddy' example. > > In [15]: cmplx_int32 > Out[15]: > > Now I want to add an attribute to this type.  More precisely, I want a class > attribute. > > cmplx_int32.test = 0 >

Re: psycopg2: connect copy_from and copy_to

2008-02-21 Thread james . pye
On Feb 20, 9:27 am, Thomas Guettler <[EMAIL PROTECTED]> wrote: > Up to now I am happy with psycopg2. Yeah. psyco is good. > Why do you develop pg_proboscis? [Good or bad as they may be] 1. Alternate interface ("greentrunk") 2. Non-libpq implementation yields better control over the wire that a

Re: Why must implementing Python be hard unlike Scheme?

2008-02-21 Thread Kay Schluehr
On 21 Feb., 18:28, John Nagle <[EMAIL PROTECTED]> wrote: > The run-time data implementation is all dictionaries. In Python, > everything is a variable-sized hash. You don't even have to allocate > storage during compile time. The run-time environment is a tree of hashes. Except that it is

Re: Article of interest: Python pros/cons for the enterprise

2008-02-21 Thread Nicola Musatti
On Feb 21, 6:31 pm, Paul Boddie <[EMAIL PROTECTED]> wrote: [...] > The main reason why C++ has declined in usage is because almost > everything of practical value is optional. The main reason why C++ has declined in usage is because it never got the kind of corporate marketing enjoyed by Java and

Re: can't set attributes of built-in/extension type

2008-02-21 Thread Neal Becker
7stud wrote: > On Feb 21, 11:19 am, Neal Becker <[EMAIL PROTECTED]> wrote: >> I'm working on a simple extension.  Following the classic 'noddy' >> example. >> >> In [15]: cmplx_int32 >> Out[15]: >> >> Now I want to add an attribute to this type.  More precisely, I want a >> class attribute. >> >>

Odd behaviour of *.pth files and Apache

2008-02-21 Thread D'Arcy J.M. Cain
I tried searching the archives for information on this but nothing seemed to be germane. I am running Python sripts as CGI under Apache and I have a .pth file in site-packages that includes directory that has another .pth in it. Sometimes it picks up the paths in the second .pth and sometimes it

Re: understaning "self"

2008-02-21 Thread 7stud
On Feb 21, 6:34 am, "Poppy" <[EMAIL PROTECTED]> wrote: > I've been searching online to try get a better understanding of what "self" > does when I define this parameter in my class functions. All I'm finding is > debates on whether  "self" has any value to the language but that doesn't > help me in

Re: understaning "self"

2008-02-21 Thread 7stud
On Feb 21, 11:49 am, 7stud <[EMAIL PROTECTED]> wrote: > On Feb 21, 6:34 am, "Poppy" <[EMAIL PROTECTED]> wrote: > > > > > I've been searching online to try get a better understanding of what "self" > > does when I define this parameter in my class functions. All I'm finding is > > debates on whether

Re: Script Running Time

2008-02-21 Thread Tim Chase
> I am trying to find a way to output how long a script took to run. > > Obviously the print would go at the end of the script, so it would be > the time up till that point. I also run a PostgreSQL query inside the > script and would like to separately show how long the query took to > run. > > I

Re: understaning "self"

2008-02-21 Thread D'Arcy J.M. Cain
On Thu, 21 Feb 2008 11:07:18 -0800 (PST) 7stud <[EMAIL PROTECTED]> wrote: > d = Dog() > d.bark('Woof!') > > and the call: > > d.bark('Woof!') > > would be transformed into: > > d.bark(d, 'Woof!') Actually, Dog.bark(d, 'Woof!') -- D'Arcy J.M. Cain <[EMAIL PROTECTED]> | Democracy is t

Re: Double underscores -- ugly?

2008-02-21 Thread benhoyt
> Has anyone thought about alternatives? Is there a previous discussion > on this I can look up? Okay, I just emailed the BDFL and asked if he could tell me the origin of the double underscore syntax for __special__ methods, and what he said I'm pretty sure he won't mind me posting here: > [Guid

Re: Article of interest: Python pros/cons for the enterprise

2008-02-21 Thread Steve Holden
Jeff Schwab wrote: > Bruno Desthuilliers wrote: >> Carl Banks a écrit : >>> On Feb 20, 8:58 am, Tim Chase <[EMAIL PROTECTED]> wrote: > You Used Python to Write WHAT? > http://www.cio.com/article/185350 """ Furthermore, the power and expressivity that Python offers means that

Re: Choosing a Metaclass?

2008-02-21 Thread Jeff McNeil
Never mind, I've figured it out. The build_class function looks at the '__class__' attribute of the first base class if there's no explicit __metaclass__ attribute. By calling type directly, the __class__ attribute as returned by MyMeta is, in fact, type. Should have just looked at the source to

Re[2]: python-ldap for plone 3 (python 2.4.4)

2008-02-21 Thread Erol Robaina Cepero
On 19/02/2008 at 07:12 p.m. Michael Ströder wrote: >Erol Robaina Cepero wrote: >> I need download python-ldap for my plone 3.0.5 that use python 2.4.4. >> >> Do you know where I can find it? > >http://python-ldap.sourceforge.net/download.shtml There I found the version 2.3.1 for python 2.5. It w

Re: packing things back to regular expression

2008-02-21 Thread MRAB
On Feb 20, 7:36 pm, Amit Gupta <[EMAIL PROTECTED]> wrote: > Before I read the message: I screwed up. > > Let me write again > > >> x = re.compile("CL(?P[a-z]+)") > > # group name "name1" is attached to the match of lowercase string of > alphabet > # Now I have a dictionary saying {"name1", "iamgood

Re: Choosing a Metaclass?

2008-02-21 Thread Steve Holden
Jeff McNeil wrote: > Hi list, > > Hopefully a quick metaclass question. In the following example, MyMeta > is a metaclass that does not inherit directly from type: > > #!/usr/bin/python > > class MyMeta(object): > def __new__(cls, name, bases, vars): > print "MyMeta.__new__ called f

Re: Article of interest: Python pros/cons for the enterprise

2008-02-21 Thread Paul Boddie
On 21 Feb, 19:22, Nicola Musatti <[EMAIL PROTECTED]> wrote: > On Feb 21, 6:31 pm, Paul Boddie <[EMAIL PROTECTED]> wrote: > [...] > > > The main reason why C++ has declined in usage is because almost > > everything of practical value is optional. > > The main reason why C++ has declined in usage is

  1   2   >