Catching a key press

2007-07-23 Thread westymatt
How would I implement a trap for catching the "up arrow" from the keyboard? -- http://mail.python.org/mailman/listinfo/python-list

Re: Lazy "for line in f" ?

2007-07-23 Thread Alexandre Ferrieux
On Jul 23, 1:03 am, Steve Holden <[EMAIL PROTECTED]> wrote: > > What makes you think Python doesn't use the platform fgets()? The fact that it does that extra layer of buffering. Stdio is already buffered, duplicating this is useless. > ... in the case of file.next() (the file method called to >

Re: Catching a key press

2007-07-23 Thread westymatt
This is without a gui toolkit. This is going to be implemented on console i/o -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with exec

2007-07-23 Thread Gabriel Genellina
En Sun, 22 Jul 2007 10:36:59 -0300, <[EMAIL PROTECTED]> escribió: >> Since the application is transforming >> its input, it could transform braces into indentation. Of course >> *Python* >> doesn't use braces, but the question was how to write "pseudo-Python" >> without using indentation to in

Re: Lazy "for line in f" ?

2007-07-23 Thread Paul Rubin
Alexandre Ferrieux <[EMAIL PROTECTED]> writes: > So I'll reiterate the question: *why* does the Python library add that > extra layer of (hard-headed) buffering on top of stdio's ? readline? -- http://mail.python.org/mailman/listinfo/python-list

Re: Sort lines in a text file

2007-07-23 Thread James Stroud
Daniel wrote: > On Sun, 22 Jul 2007 06:03:17 +0300, leegold <[EMAIL PROTECTED]> wrote: >> say I have a text file: >> >> zz3 uaa4a ss 7 uu >> zz 3 66 ppazz9 >> a0zz0 >> >> I want to sort the text file. I want the key to be the number after >> the two "zz". Or I guess a string of t

Get file owner in Windows

2007-07-23 Thread Thibault Ketterer
Don't know if it's still usefull but it seems that you have to get the sid from a "give sid function" import win32security,pywintypes try: filo = win32security.GetFileSecurity(path, win32security.OWNER_SECURITY_INFORMATION) s

Re: URL parsing for the hard cases

2007-07-23 Thread Miles
On 7/22/07, John Nagle wrote: > Is there any library function that correctly tests for an IP address vs. a > domain name based on syntax, i.e. without looking it up in DNS? import re, string NETLOC_RE = re.compile(r'''^ #start of string (?:([EMAIL PROTECTED])+@)?# 1: (?:\[

decorators tutorials

2007-07-23 Thread james_027
Hi, I am learning python by learning django, and I stumble upon decorator which is very cool, any beginners resources for python decorators, although I can google it, I just want to get a good tutorial for this topic. Thanks james -- http://mail.python.org/mailman/listinfo/python-list

Re: decorators tutorials

2007-07-23 Thread Bruno Desthuilliers
james_027 a écrit : > Hi, > > I am learning python by learning django, and I stumble upon decorator > which is very cool, any beginners resources for python decorators, > although I can google it, I just want to get a good tutorial for this > topic. You should find answers on python.org, and sear

Re: Lazy "for line in f" ?

2007-07-23 Thread Alexandre Ferrieux
On Jul 23, 9:36 am, Paul Rubin wrote: > Alexandre Ferrieux <[EMAIL PROTECTED]> writes: > > So I'll reiterate the question: *why* does the Python library add that > > extra layer of (hard-headed) buffering on top of stdio's ? > > readline? I know readline() doesn't have t

Re: Lazy "for line in f" ?

2007-07-23 Thread Duncan Booth
Alexandre Ferrieux <[EMAIL PROTECTED]> wrote: > On Jul 23, 9:36 am, Paul Rubin wrote: >> Alexandre Ferrieux <[EMAIL PROTECTED]> writes: >> > So I'll reiterate the question: *why* does the Python library add that >> > extra layer of (hard-headed) buffering on top of stdi

Re: decorators tutorials

2007-07-23 Thread Michele Simionato
On Jul 23, 10:13 am, james_027 <[EMAIL PROTECTED]> wrote: > Hi, > > I am learning python by learning django, and I stumble upon decorator > which is very cool, any beginners resources for python decorators, > although I can google it, I just want to get a good tutorial for this > topic. > > Thanks

Re: decorators tutorials

2007-07-23 Thread [EMAIL PROTECTED]
james_027 wrote: > Hi, > > I am learning python by learning django, and I stumble upon decorator > which is very cool, any beginners resources for python decorators, > although I can google it, I just want to get a good tutorial for this > topic. Decorators are just a more concise but less obvious

python-fam documentation.

2007-07-23 Thread Shriphani
Folks, I am trying to create an app which stares at a file and when the file is altered, the script joins a channel on freenode and reports that the file has been altered. I found a module called python-fam, unfortunately i have been unable to find documentation for it. Can someone please help me ?

Re: decorators tutorials

2007-07-23 Thread Roel Schroeven
james_027 schreef: > Hi, > > I am learning python by learning django, and I stumble upon decorator > which is very cool, any beginners resources for python decorators, > although I can google it, I just want to get a good tutorial for this > topic. I like the short explanation on Kent's Korner:

Re: Lazy "for line in f" ?

2007-07-23 Thread Alexandre Ferrieux
On Jul 23, 10:33 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > > The extra buffering means that iterating over a file is about 3 times > faster than repeatedly calling readline. > > while 1: > line = f.readline() > if not line: > break > > for line in f: >

Re: Catching a key press

2007-07-23 Thread thebjorn
On Jul 23, 9:05 am, westymatt <[EMAIL PROTECTED]> wrote: > This is without a gui toolkit. This is going to be implemented on > console i/o If you're on windows, you'll need the kbhit() and getch() functions in the msvcrt module. The up arrow returns two separate "keyboard- hits" (with ordinal val

set_proxy in urllib2 is driving my crazy

2007-07-23 Thread est
A simple py script import urllib2 req=urllib2.Request("http://www.google.com";) req.set_proxy("127.0.0.1:1","http") print urllib2.urlopen(req).read() Here is error: "C:\Python25\python.exe" -u "E:\Python\Crawler\test.py" Traceback (most recent call last): File "E:\Python\Crawler\test.py"

Re: problem with exec

2007-07-23 Thread vedrandekovic
On 23 srp, 09:19, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sun, 22 Jul 2007 10:36:59 -0300, <[EMAIL PROTECTED]> > escribió: > > >> Since the application is transforming > >> its input, it could transform braces into indentation. Of course > >> *Python* > >> doesn't use braces, but the qu

Re: Lazy "for line in f" ?

2007-07-23 Thread Duncan Booth
Alexandre Ferrieux <[EMAIL PROTECTED]> wrote: > On Jul 23, 10:33 am, Duncan Booth <[EMAIL PROTECTED]> > wrote: >> >> The extra buffering means that iterating over a file is about 3 times >> faster than repeatedly calling readline. >> >> while 1: >> line = f.readline() >> if not

Re: decorators tutorials

2007-07-23 Thread Bruno Desthuilliers
james_027 a écrit : > Hi all, > > I am having difficulty understanding decorator. The definition was > clear for me, but the syntax is not so clear to me. > > will decorators will always have to be in this way > > def check_login(func): > def _check_login(*args): > print "I am decora

Re: Lazy "for line in f" ?

2007-07-23 Thread Alexandre Ferrieux
On Jul 23, 12:18 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > > Whatever, the iterator makes the code both cleaner and faster. It is at > the expense of not being suitable for interactive sessions, or in some > cases pipes, but for those situations you can continue to use readline > and the extra

Re: Lazy "for line in f" ?

2007-07-23 Thread Duncan Booth
Duncan Booth <[EMAIL PROTECTED]> wrote: > or even: > >read = f.readline >while read(): >pass > Oops, I forgot the other obvious variant on this, which has the benefit of getting rid of the test I said was 'required' while still leaving the data accessible: for line in ite

Re: decorators tutorials

2007-07-23 Thread james_027
Hi all, I am having difficulty understanding decorator. The definition was clear for me, but the syntax is not so clear to me. will decorators will always have to be in this way def check_login(func): def _check_login(*args): print "I am decorator" return func(*args) retu

Re: Can a low-level programmer learn OOP?

2007-07-23 Thread Eddie Corns
Wolfgang Strobl <[EMAIL PROTECTED]> writes: >few of James Gimple's snippets from "Algorithms in SNOBOL4" >(->http://www.snobol4.org/) as an exercise using that library might help >to get a better appreciation. Perhaps I'll try, eventually ... I never noticed them or the PDF of the book there befor

Returned mail: Data format error

2007-07-23 Thread Post Office
Virus Warning Message (from InterScanVirusWall mbox.infotel.bg) Found virus WORM_MYDOOM.GEN in file DOCUMENT.SCR (in document.zip) The uncleanable file is deleted. If you have questions, contact administrator. - The original message was

Re: Configure apache to run python scripts

2007-07-23 Thread Bruno Desthuilliers
joe jacob a écrit : > I need to configure apache to run python scripts. I followed the steps > mentioned in this site (http://www.thesitewizard.com/archive/ > addcgitoapache.shtml). But I am not able to run python scripts from > Firefox, I got a forbidden error "you do not have permission to >

Re: Configure apache to run python scripts

2007-07-23 Thread joe jacob
On Jul 23, 4:42 pm, Bruno Desthuilliers wrote: > joe jacob a écrit : > > > I need to configure apache to run python scripts. I followed the steps > > mentioned in this site (http://www.thesitewizard.com/archive/ > > addcgitoapache.shtml). But I am not able to run python scripts from > > Firefox, I

Re: decorators tutorials

2007-07-23 Thread james_027
hi bruno, That seems to be hard to read at all, or I am just very new to python? With that decorator how do I take advantage of it compare when I just write a function that could do the same as what the decorator did? I could translate the could from above into ... def check_login(msg): #...

Re: Catching a key press

2007-07-23 Thread westymatt
linux primarily still a little lost in how to implementent this, however I understand what you are saying. -- http://mail.python.org/mailman/listinfo/python-list

Need Help with base64

2007-07-23 Thread pycraze
Hi , I am currently trying to implement base64 encoding and decoding scheme in C . Python has a module , base64 , that will do the encoding and decoding with ease . I am aware of OpenSSL having support for base64 encoding and decoding , but i will have to now implement both in C without using t

Re: Need Help with base64

2007-07-23 Thread Diez B. Roggisch
pycraze wrote: > Hi , > > I am currently trying to implement base64 encoding and decoding > scheme in C . Python has a module , base64 , that will do the > encoding and decoding with ease . I am aware of OpenSSL having support > for base64 encoding and decoding , but i will have to now impleme

Re: Pure Python equivalent of unix "file" command?

2007-07-23 Thread c james
Take a look at http://www.demonseed.net/~jp/code/magic.py W3 wrote: > Hi all, > > Just a quick one... Is there such a thing? > > Thanks, > /Walter -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Snobol 1.0

2007-07-23 Thread Aahz
In article <[EMAIL PROTECTED]>, greg wrote: >Aahz wrote: >> >> So adding SNOBOL patterns to another library would be a wonderful >> gift to the Python community... > >I wrote a module for Snobol-style pattern matching a while back, but >didn't get around to releasing it. I've just put it on my w

Re: Python MAPI

2007-07-23 Thread kyosohma
On Jul 22, 3:00 pm, [EMAIL PROTECTED] wrote: > > Well, I ran Process Monitor with some filters enabled to only watch > > Thunderbird and MS Word. Unfortunately, that didn't give me any of the > > registry edits, so I disabled my filters and ran it without. Now I > > have a log file with 28,000 entr

Re: decorators tutorials

2007-07-23 Thread Ben Finney
james_027 <[EMAIL PROTECTED]> writes: > Hi all, (Please don't top-post your reply. Instead, remove from the quoted material all the parts that are irrelevant to your reply, and post underneath what you're responding to, in normal chronological order like any other discussion.) > I am having diff

Python-URL! - weekly Python news and links (Jul 23)

2007-07-23 Thread Gabriel Genellina
QOTW: "It's a good QOTW but social romantic nonsense nevertheless." - Kay Schluehr http://groups.google.com/group/comp.lang.python/browse_thread/thread/6348bfbb69642a4a/ "If it [the QOTW] were predictable, wouldn't it be boring?" - Peter Otten An analysis of random.shuffle beha

Re: decorators tutorials

2007-07-23 Thread james_027
Hi, > > def check_login(func): > > def _check_login(*args): > > print "I am decorator" > > return func(*args) > > return _check_login > > > @check_login > > def method2(input): > > print "I am method TWO. Input %s" % input > > That looks okay. What is unclear? > It jus

Parsing XML with ElementTree (unicode problem?)

2007-07-23 Thread oren . tsur
(this question was also posted in the devshed python forum: http://forums.devshed.com/python-programming-11/parsing-xml-with-elementtree-unicode-problem-461518.html ). - (it's a bit longish but I hope I give all the information) 1. here is my problem: I'm trying to par

Re: Parsing XML with ElementTree (unicode problem?)

2007-07-23 Thread Richard Brodie
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > so what's the difference? how comes parsing is fine > in the first case but erroneous in the second case? You may have guessed the encoding wrong. It probably wasn't utf-8 to start with but iso8859-1 or similar. What actual byte valu

Re: decorators tutorials

2007-07-23 Thread Diez B. Roggisch
james_027 wrote: > hi bruno, > > That seems to be hard to read at all, or I am just very new to python? > > With that decorator how do I take advantage of it compare when I just > write a function that could do the same as what the decorator did? I > could translate the could from above into ...

Re: Can a low-level programmer learn OOP?

2007-07-23 Thread Paul McGuire
On Jul 23, 5:53 am, [EMAIL PROTECTED] (Eddie Corns) wrote: > Wolfgang Strobl <[EMAIL PROTECTED]> writes: > >few of James Gimple's snippets from "Algorithms in SNOBOL4" > >(->http://www.snobol4.org/) as an exercise using that library might help > >to get a better appreciation. Perhaps I'll try, even

Re: decorators tutorials

2007-07-23 Thread Bruno Desthuilliers
james_027 a écrit : > hi bruno, > > That seems to be hard to read at all, or I am just very new to python? or just new to higher order functions ? (ie: functions working on functions). > With that decorator how do I take advantage of it compare when I just > write a function that could do the s

Reading data from an ISA port

2007-07-23 Thread Gabriel Dragffy
Dear list members I must admit I am a new user of Python, but it is a language that I enjoy using. For one of my university projects I need to write a program that can read several bytes from an ISA port. It has been suggested to me that I look at using C or Pyinline. If I can I would prefe

Where do they tech Python officialy ?

2007-07-23 Thread NicolasG
Hi, I want to be a professional python programmer, unfortunately I'm working on technical support and don't have the time/patience to start making projects my self. I tried to apply to some Python positions but unfortunately sometimes to work as a programmer is really hard in this world, every emp

Re: Where do they tech Python officialy ?

2007-07-23 Thread Danyelle Gragsone
My school does damn near all of the main ones.. BUT python .. lame.. On 7/23/07, NicolasG <[EMAIL PROTECTED]> wrote: > Hi, > > I want to be a professional python programmer, unfortunately I'm > working on technical support and don't have the time/patience to start > making projects my self. I tri

Re: Need Help with base64

2007-07-23 Thread Terry Reedy
"pycraze" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Hi , | | I am currently trying to implement base64 encoding and decoding | scheme in C . Python has a module , base64 , that will do the | encoding and decoding with ease . I am aware of OpenSSL having support | for base64

Re: Catching a key press

2007-07-23 Thread Petr Jakes
On 23 ec, 14:23, westymatt <[EMAIL PROTECTED]> wrote: > linux primarily still a little lost in how to implementent this, > however I understand what you are saying. maybe you can use this: http://tinyurl.com/2zyfmw HTH Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list

Re: decorators tutorials

2007-07-23 Thread Jason
On Jul 23, 2:13 am, james_027 <[EMAIL PROTECTED]> wrote: > Hi, > > I am learning python by learning django, and I stumble upon decorator > which is very cool, any beginners resources for python decorators, > although I can google it, I just want to get a good tutorial for this > topic. > > Thanks >

Re: Pickled objects over the network

2007-07-23 Thread Steve Holden
Hendrik van Rooyen wrote: > "Steve Holden" <[EMAIL PROTECTED]> wrote: > >> Yes. > > Why? > It's difficult to establish, and then correctly implement, almost any security protocol without leaving cracks that attackers can lever open and use to inject code into your process's memory space. By a

Re: decorators tutorials

2007-07-23 Thread Steve Holden
james_027 wrote: > Hi, > >>> def check_login(func): >>> def _check_login(*args): >>> print "I am decorator" >>> return func(*args) >>> return _check_login >>> @check_login >>> def method2(input): >>> print "I am method TWO. Input %s" % input >> That looks okay. What is

Re: Can a low-level programmer learn OOP?

2007-07-23 Thread Eddie Corns
Paul McGuire <[EMAIL PROTECTED]> writes: >On Jul 23, 5:53 am, [EMAIL PROTECTED] (Eddie Corns) wrote: >> Wolfgang Strobl <[EMAIL PROTECTED]> writes: >> >few of James Gimple's snippets from "Algorithms in SNOBOL4" >> >(->http://www.snobol4.org/) as an exercise using that library might help >> >to ge

Re: decorators tutorials

2007-07-23 Thread Jason
On Jul 23, 11:25 am, Jason <[EMAIL PROTECTED]> wrote: > On Jul 23, 2:13 am, james_027 <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I am learning python by learning django, and I stumble upon decorator > > which is very cool, any beginners resources for python decorators, > > although I can google it,

Re: Where do they tech Python officialy ?

2007-07-23 Thread BartlebyScrivener
On Jul 23, 11:52 am, NicolasG <[EMAIL PROTECTED]> wrote: > > Does some one have any suggestions on which University to attend ? > Alternatives solutions are welcome.. You might like this thread. Or go to comp.lang.python and search for "python taught in schools" http://tinyurl.com/2zlsxl rd --

Re: Where do they tech Python officialy ?

2007-07-23 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, NicolasG <[EMAIL PROTECTED]> wrote: >Hi, > >I want to be a professional python programmer, unfortunately I'm >working on technical support and don't have the time/patience to start >making projects my self. I tried to apply to some Python positions but >unfortunatel

link between python and the windows command prompt

2007-07-23 Thread yadin
hi! i need to know how i can run ussal commands that i ussally type at the windows command prompt from a python file. that is for example from the windows command prompt i ussually type "cd D:\folder\ nec2++ - i inputfile.nec -o outputfile.out " now how can i execute this command that i ussually

Confused with csv.reader copies

2007-07-23 Thread Robert Dailey
First, take a look at my example code: - import csv def pass1( reader ): print reader.next() print reader.next() def pass2( reader ): print reader.next() print reader.next() reader = csv.reader( open( "C:/IT/Meth

Re: class C: vs class C(object):

2007-07-23 Thread Klaas
On Jul 20, 5:47 am, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > In particular, old-style classes are noticeably faster than > > new-style classes for some things (I think it was attribute lookup > > that surprised me recently, possibly related to t

Maintaining leading zeros with the lstrip string function?

2007-07-23 Thread Randy Kreuziger
I need just the file name from a string containing the path to a file. The name of the file starts with zeros. This is problematic because the lstrip function strips them leaving this as the result: 6128.jpg How do I strip the path without losing the leading zeros in the file name? ―

inet_addr() in Python

2007-07-23 Thread brad
Does Python have an equivalent to C's inet_addr()? Thanks, Brad -- http://mail.python.org/mailman/listinfo/python-list

Re: Maintaining leading zeros with the lstrip string function?

2007-07-23 Thread Miles
On 7/23/07, Randy Kreuziger <[EMAIL PROTECTED]> wrote: > I need just the file name from a string containing the path to a file. The > name of the file starts with zeros. This is problematic because the lstrip > function strips them leaving this as the result: > 6128.jpg > > > How do I strip the

Re: Maintaining leading zeros with the lstrip string function?

2007-07-23 Thread Carsten Haese
On Mon, 2007-07-23 at 11:41 -0700, Randy Kreuziger wrote: > I need just the file name from a string containing the path to a file. > The name of the file starts with zeros. This is problematic because > the lstrip function strips them leaving this as the result: > 6128.jpg > > > How do I stri

Re: link between python and the windows command prompt

2007-07-23 Thread Larry Bates
yadin wrote: > hi! i need to know how i can run ussal commands that i ussally type at > the windows command prompt from a python file. that is for example > from the windows command prompt i ussually type "cd D:\folder\ nec2++ - > i inputfile.nec -o outputfile.out " now how can i execute this > c

Re: Confused with csv.reader copies

2007-07-23 Thread Larry Bates
Robert Dailey wrote: > First, take a look at my example code: > - > import csv > > def pass1( reader ): > print reader.next() > print reader.next() > > def pass2( reader ): > print reader.next() > print reader.next() > >

code indentation

2007-07-23 Thread ...:::JA:::...
Hello, In my previously post I have been talk about running code with exec in.. So now I have problem with code indentation, as Gabriel Genellina says: >If you are using the tokenize module as suggested some time ago, try to >analyze the token sequence you get using { } (or perhaps begin/end

Re: shutil.copyfile problem for GIS data

2007-07-23 Thread supercooper
import shutil import os src = "c:\mydata\test\mygeo.mdb" dst = "v:\updated\data\mygeo.mdb" shutil.copyfile(src,dst) This should totally work, do it all the time, but no one can be connected to the database, ie have ArcMap or ArcCatalog open at the time of copy, or the .ldb lock will kill it. I d

Re: Where do they tech Python officialy ?

2007-07-23 Thread supercooper
http://home.earthlink.net/~python-training/ I highly recommend Mark Lutz. Took the class last fall in Estes Park and it was worth every penny. -- http://mail.python.org/mailman/listinfo/python-list

Re: inet_addr() in Python

2007-07-23 Thread Steve Holden
brad wrote: > Does Python have an equivalent to C's inet_addr()? > socket.inet_aton() produces a four-byte string you can pass as a struct in_addr, if that's what you are looking for. If you want a number then use the struct module to manipulate it further. >>> s.inet_aton('127.0.0.1') '\x7f\x

Re: inet_addr() in Python

2007-07-23 Thread brad
Steve Holden wrote: > brad wrote: >> Does Python have an equivalent to C's inet_addr()? >> > socket.inet_aton() produces a four-byte string you can pass as a struct > in_addr, if that's what you are looking for. If you want a number then > use the struct module to manipulate it further. > > >>>

Re: URL parsing for the hard cases

2007-07-23 Thread Miles
On 7/23/07, Miles wrote: > On 7/22/07, John Nagle wrote: > > Is there any library function that correctly tests for an IP address vs. a > > domain name based on syntax, i.e. without looking it up in DNS? > > import re, string > > NETLOC_RE = re.compile(r'''^ #start of string > (?:([EMAIL PR

Re: The Modernization of Emacs: exists already

2007-07-23 Thread Martijn Lievaart
On Wed, 18 Jul 2007 06:17:00 -0700, Xah Lee wrote: > About a month ago, i posted a message about modernization of emacs. I > enlisted several items that i think emacs should adapt. And you are posting this to compl.lang.perl because.?? F'up set. M4 -- http://mail.python.org/mailman/lis

sys.ps1 with formatting (linux)

2007-07-23 Thread Jon Dobson
I'm trying to set sys.ps1 and sys.ps2 with some formatting (linux) using: python -i -c 'import sys; sys.ps1="\033[1m\033[32mspy>\033[0m";sys.ps2="\033[1m\033[32m .\033[0m"' I get the colored prompt(s) as you might expect, but I'm getting some strange behavior with wrapping. Once the interact

Re: Can a low-level programmer learn OOP?

2007-07-23 Thread Paul McGuire
On Jul 23, 12:43 pm, [EMAIL PROTECTED] (Eddie Corns) wrote: > Paul McGuire <[EMAIL PROTECTED]> writes: > >On Jul 23, 5:53 am, [EMAIL PROTECTED] (Eddie Corns) wrote: > >> Wolfgang Strobl <[EMAIL PROTECTED]> writes: > >> >few of James Gimple's snippets from "Algorithms in SNOBOL4" > >> >(->http://www

Re: Where do they tech Python officialy ?

2007-07-23 Thread Mike C. Fletcher
NicolasG wrote: ... > I'm planning to save some money and attend a course in any of the > universities that teach hard core Python. > > Does some one have any suggestions on which University to attend ? > In Canada, the University of Toronto is planning to switch all first-year Comp-Sci courses

Extracting attributes from compiled python code or parse trees

2007-07-23 Thread Matteo
Hello- I am trying to get Python to extract attributes in full dotted form from compiled expression. For instance, if I have the following: param = compile('a.x + a.y','','single') then I would like to retrieve the list consisting of ['a.x','a.y']. I have tried using inspect to look at 'co_names'

Re: Confused with csv.reader copies

2007-07-23 Thread Gabriel Genellina
En Mon, 23 Jul 2007 15:45:42 -0300, Robert Dailey <[EMAIL PROTECTED]> escribió: > import csv > > def pass1( reader ): > print reader.next() > print reader.next() > > def pass2( reader ): > print reader.next() > print reader.next() > > reader = csv.reader( open( "C:/IT/Met

Re: Reading data from an ISA port

2007-07-23 Thread Diez B. Roggisch
Gabriel Dragffy schrieb: > Dear list members > > I must admit I am a new user of Python, but it is a language that I > enjoy using. > > For one of my university projects I need to write a program that can > read several bytes from an ISA port. It has been suggested to me that I > look at using

Re: Extracting attributes from compiled python code or parse trees

2007-07-23 Thread Gabriel Genellina
En Mon, 23 Jul 2007 18:13:05 -0300, Matteo <[EMAIL PROTECTED]> escribió: > I am trying to get Python to extract attributes in full dotted form > from compiled expression. For instance, if I have the following: > > param = compile('a.x + a.y','','single') > > then I would like to retrieve the list

Re: Maintaining leading zeros with the lstrip string function?

2007-07-23 Thread Steven D'Aprano
On Mon, 23 Jul 2007 15:21:20 -0400, Miles wrote: > Also, use raw strings ( r'\path\to\file' ) to avoid problems > with backslashes being interpreted in strings. Not quite. Raw strings are designed for building regular expressions, not file names. Consequently, there are still a few cases where th

pylint style convention

2007-07-23 Thread Mick Charles Beaver
Hello, I've been looking into using PyLint on some of my programs, just as a best practices kind of thing. Here's a snippet: #== if __name__ == '__main__': parser = optparse.OptionParser(usage='usage: %prog [OPTIONS]') pa

python a lonys

2007-07-23 Thread Nooby
http://www.directurl.de/39850293 thissi something new 4 u guys -- http://mail.python.org/mailman/listinfo/python-list

RE: Maintaining leading zeros with the lstrip string function?

2007-07-23 Thread Randy Kreuziger
Thanks for the basename suggestion. That almost works. I'm running into a problem with some of the directory names when they include \800x\ see below. ―- import sys, os, string teststring = 'C:\shoreline\dvd\prep area

Re: [2.5] Regex doesn't support MULTILINE?

2007-07-23 Thread Gilles Ganault
On Sun, 22 Jul 2007 05:34:17 -0300, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: >Try to avoid using ".*" and ".+" (even the non greedy forms); in this >case, I think you want the scan to stop when it reaches the ending >or any other tag, so use: [^<]* instead. > >BTW, better to use a raw st

Re: Maintaining leading zeros with the lstrip string function?

2007-07-23 Thread Steve Holden
Randy Kreuziger wrote: > Thanks for the basename suggestion. That almost works. I'm running > into a problem with some of the directory names when they include > \800x\ see below. > �- > import sys, os, string > > te

Re: pylint style convention

2007-07-23 Thread Matt McCredie
Which style convention is it referring to? Should these really be all caps? I think pylint is expecting that any variables declared outside of a function should be constants with special meanings (similar to #define or enum values in c). So, I guess to get rid of that message you should do som

Re: Subclassing int

2007-07-23 Thread Steve Holden
G wrote: > Hi, > > I am trying to subclass int to allow a constructor to accept None. I > am trying the following > > class INT(int): > def __init__(self, x): > if x is None: > return None > else: > int.__init__(x) > > b = INT(x=None) > > When i

Subclassing int

2007-07-23 Thread G
Hi, I am trying to subclass int to allow a constructor to accept None. I am trying the following class INT(int): def __init__(self, x): if x is None: return None else: int.__init__(x) b = INT(x=None) When i run the previous code i get the following er

Re: Re-running unittest

2007-07-23 Thread Gabriel Genellina
At 23/07/2007 09:59, "Israel Fernández Cabrera" <[EMAIL PROTECTED]> wrote: (Please keep posting on the list - many other people may have better ideas on this) > Well... probably my English and my intentions to not ti write > to much made my explanation unclear. The code I wrote was just > to il

Hacking with __new__

2007-07-23 Thread Sandra-24
Ok here's the problem, I'm modifying a 3rd party library (boto) to have more specific exceptions. I want to change S3ResponseError into about 30 more specific errors. Preferably I want to do this by changing as little code as possible. I also want the new exceptions to be a subclass of the old S3Re

Re: pylint style convention

2007-07-23 Thread Michael Hoffman
Mick Charles Beaver wrote: > Hello, > > I've been looking into using PyLint on some of my programs, just as a > best practices kind of thing. > > Here's a snippet: > #== > if __name__ == '__main__': > parser = optparse.Option

[XBOX] Python XBOX360 Migration Question

2007-07-23 Thread [EMAIL PROTECTED]
Hello ALL, I have just migrated python-core to xbox360. I wonder if someone else has already done it yet ? The ctypes-module-migration puzzle me because I seldom use powerpc assembly. Can someone give me a hint ?? -- http://mail.python.org/mailman/listinfo/python-list

Re: Subclassing int

2007-07-23 Thread G
Thanks a lot Matt and Steve. I replaced __int__ with __new__ and it worked On 7/23/07, Matt McCredie <[EMAIL PROTECTED]> wrote: Do you guys know why the if statement is not evaluated? For immutable types __new__ is called before __init__. There are some details here: http://docs.python.org/r

Re: set_proxy in urllib2 is driving my crazy

2007-07-23 Thread O.R.Senthil Kumaran
* est <[EMAIL PROTECTED]> [2007-07-23 09:50:17]: > A simple py script > > import urllib2 > req=urllib2.Request("http://www.google.com";) > req.set_proxy("127.0.0.1:1","http") > print urllib2.urlopen(req).read() > Try to use the ProxyHandler of urllib2. import urllib2 proxy_url = 'http://' + PR

Re: Re-running unittest

2007-07-23 Thread Israel Fernández Cabrera
Hi Gabriel > Perhaps the best option is to run the tests in another process. Use any of > the available IPC mechanisms to gather the test results. This has the > added advantage of isolating the tested code from your GUI testing > framework; all requested resources are released to the OS; the test

classmethod & staticmethod

2007-07-23 Thread james_027
hi, python's staticmethod is the equivalent of java staticmethod right? with classmethod, I can call the method without the need for creating an instance right? since the difference between the two is that classmethod receives the class itself as implicti first argument. From my understanding cla

Re: code indentation

2007-07-23 Thread Gabriel Genellina
En Mon, 23 Jul 2007 16:53:01 -0300, ...:::JA:::... <[EMAIL PROTECTED]> escribió: >> If you are using the tokenize module as suggested some time ago, try to >> analyze the token sequence you get using { } (or perhaps begin/end pairs >> in your own language, that are easier to distinguish from a d

Re: idiom for RE matching

2007-07-23 Thread Gordon Airporte
[EMAIL PROTECTED] wrote: > if your search is not overly complicated, i think regexp is not > needed. if you want, you can post a sample what you want to search, > and some sample input. I'm afraid it's pretty complicated :-). I'm doing analysis of hand histories that online poker sites leave for

Re: idiom for RE matching

2007-07-23 Thread Gabriel Genellina
En Tue, 24 Jul 2007 00:23:46 -0300, Gordon Airporte <[EMAIL PROTECTED]> escribió: > [EMAIL PROTECTED] wrote: >> if your search is not overly complicated, i think regexp is not >> needed. if you want, you can post a sample what you want to search, >> and some sample input. > > I'm afraid it's pre

Re: pylint style convention

2007-07-23 Thread Ben Finney
[EMAIL PROTECTED] (Mick Charles Beaver) writes: > Here's a snippet: pylint is reporting line numbers. Can you show us line numbers for this snippet? > #== > if __name__ == '__main__': > parser = optparse.OptionParser(usage='

  1   2   >