Re: XML partial validation.

2007-12-14 Thread Stefan Behnel
José Rui Faustino de Sousa wrote: > I am writing a text to XML parser that as to be easily extensible (via > new text format plug-ins) and modifiable if the XML format used changes. > > Since the text order does not match the XML document order I have to use > a package that allows DOM-like han

Alternative to python -u for binary upload to cgi on windows?

2007-12-14 Thread Cameron Walsh
Hi all, Using a python cgi script such as the one below to handle uploaded binary files will end up with a truncated file (truncates when it hits ^Z) on Windows systems. On linux systems the code works and the file is not truncated. One solution for Windows is to use the -u flag, i.e. #!C:\Py

Re: RegExp Help

2007-12-14 Thread Marc 'BlackJack' Rintsch
On Thu, 13 Dec 2007 17:49:20 -0800, Sean DiZazzo wrote: > I'm wrapping up a command line util that returns xml in Python. The > util is flaky, and gives me back poorly formed xml with different > problems in different cases. Anyway I'm making progress. I'm not > very good at regular expressions

Re: Best way to protect my new commercial software.

2007-12-14 Thread farsheed
Let me be clear for you: there are someone in my company who love to use my software in other companies that she works there also. and because it is an inhouse tool, my CEO wanted me to protect it from stealing. and really we havn't time to copyright it. so I want to secure my software from some pe

Re: urlparse.urlparse bug - misparses long URL

2007-12-14 Thread John Nagle
Matt Nordhoff wrote: > John Nagle wrote: >> Here's a hostile URL that "urlparse.urlparse" seems to have mis-parsed. >> ... > > It's breaking on the first slash, which just happens to be very late in > the URL. > urlparse('http://example.com?blahblah=http://example.net') > ('http', 'exa

Re: Better way to searching.

2007-12-14 Thread David Tweet
Hello, You might try using os.path.walk, I think it ends up being much more flexible than glob for this. #!/usr/bin/python2.4 import os def Finder(topdir, file_extension=None, levels=None): """Return all filenames in topdir. Args: topdir: Top level directory to search file_extensi

Re: RegExp Help

2007-12-14 Thread Sean DiZazzo
On Dec 14, 12:04 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Thu, 13 Dec 2007 17:49:20 -0800, Sean DiZazzo wrote: > > I'm wrapping up a command line util that returns xml in Python. The > > util is flaky, and gives me back poorly formed xml with different > > problems in different

Re: Is a "real" C-Python possible?

2007-12-14 Thread Bruno Desthuilliers
sturlamolden a écrit : > On 13 Des, 19:16, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > Personally I find properties atrocious and unsafe. What a strange observation from someone wanting to introduce defmacros and customizable syntax in Python > One cannot > distinguish between a function

Re: making all letters Caps/Small Letters

2007-12-14 Thread Peter Otten
Merrigan wrote: > I'm sure I have done this before, but cannot remember how, or find out > how to do it quickly - but is there a way/function/something in python > to make all the letters of a raw_input() string small/capital letters? Typing >>> dir("") in the interactive interpreter gives you

Re: making all letters Caps/Small Letters

2007-12-14 Thread David Tweet
>>> "THIS IS A STRING".lower() 'this is a string' >>> "THIS IS A STRING".title() 'This Is A String' >>> "this is a string".upper() 'THIS IS A STRING' You can browse all the string methods by doing >>> dir(str) On Dec 14, 2007 1:30 AM, Merrigan <[EMAIL PROTECTED]> wrote: > Hi There, > > I'm sure I

making all letters Caps/Small Letters

2007-12-14 Thread Merrigan
Hi There, I'm sure I have done this before, but cannot remember how, or find out how to do it quickly - but is there a way/function/something in python to make all the letters of a raw_input() string small/capital letters? Thanks! -- Merrigan -- http://mail.python.org/mailman/listinfo/python-l

Re: reloading modules and isinstance()

2007-12-14 Thread Tlis
Hi, I have found that it is possible to reassign the instance.__class__ reference to the same class (but after reloading) to make the isinstance() test work again! I know that it is a kind of hacking of the Python interpreter, but it works :-) -- http://mail.python.org/mailman/listinfo/python-lis

Re: Eclipse/PyQt/Eric4 question

2007-12-14 Thread king kikapu
On 14 Δεκ, 01:09, "Fabio Zadrozny" <[EMAIL PROTECTED]> wrote: > > Hmmm...but this means that i am forced to do this for ALL .ui files on > > the project, either changed or not and this can slow things down... > > (pyuic.bat can run for one or for ALL .ui files) > > The goal is to find a way to auto

Re: Floating point subtraction rounding error (NOT display error)

2007-12-14 Thread Nikos Vergas
> Solved: used round(number,12) in this case for all of the operands of > my arcsines. Not pretty, but at least VIM made it easy... You might have the same problem though: >>> round(1.0003401032523500235,13) 1.000340103 >>> round(1.0003401032523500235,12) 1.00034011 -

Re: Best way to protect my new commercial software.

2007-12-14 Thread Wolfgang Draxinger
sturlamolden wrote: > I wrote this in another thread, And here the HOWTO for the crack: > 1. Put all the compiled Python bytecode in a heavily encrypted > binary file. Consider using a hardware hash in the key. Find the part in the binary where the encrypted bytecode is read, start the binary

Re: making all letters Caps/Small Letters

2007-12-14 Thread Martin Blume
"Merrigan" schrieb im> > I'm sure I have done this before, but cannot remember how, > or find out how to do it quickly - but is there a > way/function/something in python to make all the letters > of a raw_input() string small/capital letters? > "upper might help".upper() "OR LOWER".lower() H

Re: mailbox.Maildir question/problem

2007-12-14 Thread tinnews
Ross Ridge <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote: > >Is there *any* way I can get python to access maildirs > >which are not named using this (IMHO stupid) convention? > > Well, the mailbox module doesn't support deleting mailboxes, so I'm not > sure why you want to use it. I was

Re: making all letters Caps/Small Letters

2007-12-14 Thread Chris
On Dec 14, 11:30 am, Merrigan <[EMAIL PROTECTED]> wrote: > Hi There, > > I'm sure I have done this before, but cannot remember how, or find out > how to do it quickly - but is there a way/function/something in python > to make all the letters of a raw_input() string small/capital letters? > > Thank

Re: RegExp Help

2007-12-14 Thread Gabriel Genellina
En Fri, 14 Dec 2007 06:06:21 -0300, Sean DiZazzo <[EMAIL PROTECTED]> escribió: > On Dec 14, 12:04 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> On Thu, 13 Dec 2007 17:49:20 -0800, Sean DiZazzo wrote: >> > I'm wrapping up a command line util that returns xml in Python. The >> > util

Re: Floating point subtraction rounding error (NOT display error)

2007-12-14 Thread Gabriel Genellina
En Fri, 14 Dec 2007 00:22:18 -0300, Keflavich <[EMAIL PROTECTED]> escribió: > On Dec 13, 5:52 pm, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: >> On Thu, 13 Dec 2007 14:30:18 -0800, Keflavich wrote: >> > Hey, I have a bit of code that died on a domain error when doing an >> >

listdir() with mask

2007-12-14 Thread Vladimir Rusinov
Hello! Is there any easy way to list files using bash-like patterns? Something like listfiles("/var/log/*.log"), listfiles("/var/{cache,run}/*"). Also, I'll need something like listfiles("/tmp/**/*.tmp"), where ** is unlimited number of folders (like is zsh). Thanks and sorry for my English. --

Re: Finding overlapping times...

2007-12-14 Thread Neil Cerutti
On 2007-12-14, John Machin <[EMAIL PROTECTED]> wrote: > On Dec 14, 10:45 am, Breal <[EMAIL PROTECTED]> wrote: >> I have a list that looks like the following >> [(10, 100010), (15, 17), (19, 100015)] >> >> I would like to be able to determine which of these overlap each >> other. So

Re: python vs perl performance test

2007-12-14 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > ... When I first translated it to Python verbatim, > the Python script took almost 30 secs to run. > So far, the best I can do is 11.2 secs using this: > > from random import randrange > from itertools import imap, repeat > from operator import getitem, add, getslice >

Re: listdir() with mask

2007-12-14 Thread Rick Dooling
On Dec 14, 1:56 am, "Vladimir Rusinov" <[EMAIL PROTECTED]> wrote: glob or fnmatch http://docs.python.org/lib/module-glob.html rd -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to protect my new commercial software.

2007-12-14 Thread Paul Boddie
On Dec 14, 9:08 am, farsheed <[EMAIL PROTECTED]> wrote: > Let me be clear for you: there are someone in my company who love to > use my software in other companies that she works there also. and > because it is an inhouse tool, my CEO wanted me to protect it from > stealing. and really we havn't ti

Re: [Plone-Users] Why Can't I Do This?

2007-12-14 Thread Victor Subervi
...but applicable ONLY for that instance. The other solution provided is more universal ;) On Dec 14, 2007 10:41 AM, Encolpe Degoute <[EMAIL PROTECTED]> wrote: > Victor Subervi a écrit : > > Hi; > > Why can't I do this? > > > author = "By Juan Garcia" > if author[0:2] == "by " | "By " |

Re: [Plone-Users] Why Can't I Do This?

2007-12-14 Thread Victor Subervi
Great! Thanks! On Dec 14, 2007 10:38 AM, Eric Smith <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > Hi; > > Why can't I do this? > > > > >>> author = "By Juan Garcia" > > >>> if author[0:2] == "by " | "By " | "BY": > > ... author = author[3:] > > ... > > Traceback (most recent call las

Re: listdir() with mask

2007-12-14 Thread grflanagan
On Dec 14, 2:00 pm, "Vladimir Rusinov" <[EMAIL PROTECTED]> wrote: >Is there any easy way to list files using bash-like patterns? Something like >listfiles("/var/log/*.log"), listfiles("/var/{cache,run}/*"). > On 12/14/07, Jeff McNeil <[EMAIL PROTECTED]> wrote: > > > > > Sure is.. check out the glob

Re: Better way to searching.

2007-12-14 Thread farsheed
thanks, I'll try it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding overlapping times...

2007-12-14 Thread Scott David Daniels
Breal wrote: > I have a list that looks like the following > [(10, 100010), (15, 17), (19, 100015)] > I would like to be able to determine which of these overlap each > other In relation to a similar (but not identical) problem, that of finding nested scopes and the associated

Re: Loops and things

2007-12-14 Thread Tim Chase
> I was wondering how and if it's possible to write a loop in python > which updates two or more variables at a time. For instance, something > like this in C: > > for (i = 0, j = 10; i < 10 && j < 20; i++, j++) { > printf("i = %d, j = %d\n", i, j); > } Well, yes it can be done, but depending

Re: Loops and things

2007-12-14 Thread Gary Herron
[EMAIL PROTECTED] wrote: > I was wondering how and if it's possible to write a loop in python > which updates two or more variables at a time. For instance, something > like this in C: > > for (i = 0, j = 10; i < 10 && j < 20; i++, j++) { > printf("i = %d, j = %d\n", i, j); > } > > So that I wo

Re: simple string formatting question

2007-12-14 Thread Bruno Desthuilliers
Neal Becker a écrit : > I have a list of strings (sys.argv actually). I want to print them as a > space-delimited string (actually, the same way they went into the command > line, so I can cut and paste) > > So if I run my program like: > ./my_prog a b c d > > I want it to print: > > './my_prog

Re: looking for gui for python code

2007-12-14 Thread Thomas Lenarz
On Thu, 13 Dec 2007 09:46:32 -0800 (PST), "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >hi >i have written some python scripts which take command line arguments >and do some job. i would like to make it into a .exe using py2exe and >distribute it with innosetup.. befor that i would like to add s

simple string formatting question

2007-12-14 Thread Neal Becker
I have a list of strings (sys.argv actually). I want to print them as a space-delimited string (actually, the same way they went into the command line, so I can cut and paste) So if I run my program like: ./my_prog a b c d I want it to print: './my_prog' 'a' 'b' 'c' 'd' Just print sys.argv wil

How to read a binary file into a mysql table

2007-12-14 Thread Hans Müller
Good morning folks, I cannot read a binary file into a mysql database. Everything I tried did not succeed. What I tried (found from various google lookups...) is this: con = MySQLdb.connect(to server) cur = con.cursor() cur.execute("insert into data values('file1', %s)", (open("test.jpg", "rb

Re: Job Offer: Python Ninja or Pirate!

2007-12-14 Thread Stargaming
On Tue, 11 Dec 2007 08:57:16 -0800, George Sakkis wrote: > On Dec 10, 11:07 pm, Stargaming <[EMAIL PROTECTED]> wrote: >> On Mon, 10 Dec 2007 19:27:43 -0800, George Sakkis wrote: >> > On Dec 10, 2:11 pm, Stargaming <[EMAIL PROTECTED]> wrote: [snip] >> >> Even though I do not qualify for the job, I

Re: listdir() with mask

2007-12-14 Thread Jeff McNeil
Sure is.. check out the glob module: http://www.python.org/doc/current/lib/module-glob.html (Official) http://blog.doughellmann.com/2007/07/pymotw-glob.html (PyMOTW) Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin Type "help", "copyright", "cre

Re: simple string formatting question

2007-12-14 Thread Gary Herron
Neal Becker wrote: > I have a list of strings (sys.argv actually). I want to print them as a > space-delimited string (actually, the same way they went into the command > line, so I can cut and paste) > > So if I run my program like: > ./my_prog a b c d > > I want it to print: > > './my_prog' 'a'

Loops and things

2007-12-14 Thread rocco . rossi
I was wondering how and if it's possible to write a loop in python which updates two or more variables at a time. For instance, something like this in C: for (i = 0, j = 10; i < 10 && j < 20; i++, j++) { printf("i = %d, j = %d\n", i, j); } So that I would get: i = 0, j = 0 i = 1, j = 1 i = 2

Re: Loops and things

2007-12-14 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > I was wondering how and if it's possible to write a loop in python > which updates two or more variables at a time. For instance, something > like this in C: > > for (i = 0, j = 10; i < 10 && j < 20; i++, j++) { > printf("i = %d, j = %d\n", i, j); > } > > So that

Re: Floating point subtraction rounding error (NOT display error)

2007-12-14 Thread J. Robertson
Keflavich wrote: > [snip] > > I feel fairly certain, however, that floats are exactly what I want > for my purposes: I need moderately high precision and I'm not > concerned about the least-significant-bit errors except when they > violate function domains. I guess the overriding lesson is that e

DB Query Parse Hangup

2007-12-14 Thread Merrigan
Hi There, I have been working on this script, and the part that this issue that I have occurs in is when iterating through some results from the db, asking the admin input to delete the entry or not - everything works fine up until the last entry, then it bombs out. I know why - but I am not quite

Re: listdir() with mask

2007-12-14 Thread Vladimir Rusinov
On 12/14/07, Jeff McNeil <[EMAIL PROTECTED]> wrote: > > Sure is.. check out the glob module: > http://www.python.org/doc/current/lib/module-glob.html (Official) > http://blog.doughellmann.com/2007/07/pymotw-glob.html (PyMOTW) > Thanks a lot! -- Vladimir Rusinov GreenMice Solutions: IT-решения на

Tk Tkinter : multiple file selection dialog over multiple directories ?

2007-12-14 Thread goldtech
Hi, TKinter question Let's say I use: ... files = tkFileDialog.askopenFilenames(filetypes=[('AccessDB Files', '*.mdb')]) ... This works OK - I can select multiple files and the var "files" will be a tuple of the files. But let's say the files I want to select are in different folders/ director

assemble a webpage!

2007-12-14 Thread yi zhang
Hi, Guys, Now I am able to use urlretrieve to download the text part of a webpage and wget to get the embedded image. Thanks for the tips! but how can I assemble them together so the image can be displayed in the webpage automatically once I click on the .html file. Right now I only saw the tex

Re: Changing argument value

2007-12-14 Thread Stargaming
On Thu, 13 Dec 2007 22:52:56 +0100, Bruno Desthuilliers wrote: > flyfree a écrit : [snip] >> What is the difference between "y = [3,4]" and "y[0]=3 y[1] =4 " > > In the first case, you rebind the local name y to a new list object - > and since the name is local, rebinding it only affects the loca

Re: Newbie design problem

2007-12-14 Thread MartinRinehart
Jonathan Garnder said: > Well, if using something like PLY ( http://www.dabeaz.com/ply/ ) is > considered more Pythonic than writing your own parser and lexer... Lex is very crude. I've found that it takes about half a day to organize your token definitions and another half day to write a tokeniz

Re: simple string formatting question

2007-12-14 Thread Neil Cerutti
On 2007-12-14, Neal Becker <[EMAIL PROTECTED]> wrote: > I have a list of strings (sys.argv actually). I want to print them as a > space-delimited string (actually, the same way they went into the command > line, so I can cut and paste) > > So if I run my program like: > ./my_prog a b c d > > I wan

Re: Loops and things

2007-12-14 Thread Neil Cerutti
On 2007-12-14, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I was wondering how and if it's possible to write a loop in python > which updates two or more variables at a time. For instance, something > like this in C: > > for (i = 0, j = 10; i < 10 && j < 20; i++, j++) { > printf("i = %d, j =

Re: [Plone-Users] Why Can't I Do This?

2007-12-14 Thread Victor Subervi
whatever[0:2] will yield THREE characters, so my "by " is correct and "by" will fail every time :)) Victor On Dec 14, 2007 12:06 PM, Derek Broughton <[EMAIL PROTECTED]> wrote: > Encolpe Degoute wrote: > > > Derek Broughton a écrit : > >> Victor Subervi wrote: > >> > >>> Hi; > >>> Why can't I do t

Loops and things

2007-12-14 Thread rocco . rossi
I was wondering how and if it's possible to write a loop in python which updates two or more variables at a time. For instance, something like this in C: for (i = 0, j = 10; i < 10 && j < 20; i++, j++) { printf("i = %d, j = %d\n", i, j); } So that I would get: i = 0, j = 0 i = 1, j = 1 i = 2

Re: Floating point subtraction rounding error (NOT display error)

2007-12-14 Thread Keflavich
On Dec 14, 2:57 am, "Nikos Vergas" <[EMAIL PROTECTED]> wrote: > > Solved: used round(number,12) in this case for all of the operands of > > my arcsines. Not pretty, but at least VIM made it easy... > > You might have the same problem though: > > >>> round(1.0003401032523500235,13) > 1.0003

Re: Floating point subtraction rounding error (NOT display error)

2007-12-14 Thread Keflavich
On Dec 14, 8:28 am, Carl Banks <[EMAIL PROTECTED]> wrote: > On Dec 13, 6:20 pm, Keflavich <[EMAIL PROTECTED]> wrote: > > > Solved: used round(number,12) in this case for all of the operands of > > my arcsines. Not pretty, but at least VIM made it easy... > > > Thanks for the help, > > Adam > > I s

Re: Best way to protect my new commercial software.

2007-12-14 Thread Grant Edwards
On 2007-12-14, farsheed <[EMAIL PROTECTED]> wrote: > Let me be clear for you: there are someone in my company who > love to use my software in other companies that she works > there also. and because it is an inhouse tool, my CEO wanted > me to protect it from stealing. and really we havn't time t

Re: Floating point subtraction rounding error (NOT display error)

2007-12-14 Thread Carl Banks
On Dec 13, 6:20 pm, Keflavich <[EMAIL PROTECTED]> wrote: > Solved: used round(number,12) in this case for all of the operands of > my arcsines. Not pretty, but at least VIM made it easy... > > Thanks for the help, > Adam I suspect this could even fail in some circumstances. If it's for school yo

Re: Newbie design problem

2007-12-14 Thread MartinRinehart
Most unclear. My apologies. I'm trying to structure a tokenizer. The stupid concatenations are just placeholders for the actual tokenizing work. By rebuilding the input they demonstrate that the framework correctly processes all the input. I'm currently using a C-style design (my own pointers int

Compressing a text file using count of continous characters

2007-12-14 Thread nirvana
I need to count the number of continous character occurances(more than 1) in a file, and replace it with a compressed version, like below XYZDEFAAcdAA --> XYZ8ADEF2Acd2A Thanks Sumod -- http://mail.python.org/mailman/listinfo/python-list

SpamBayes/Windows volunteer help needed

2007-12-14 Thread skip
The SpamBayes antispam filter (http://www.spambayes.org/) is fairly popular as a way to suppress spam. We have lots of people who use the Outlook plugin. Unfortunately, for the past year or two we've suffered from a dearth of Windows experience as our Windows development experts all got busy doin

Re: [Python] Re: efficient data loading with Python, is that possible possible?

2007-12-14 Thread Chris Gonnerman
Neil Cerutti wrote: > An inefficient parsing technique is probably to blame. You first > inspect the line to make sure it is valid, then you inspect it > (number of column type) times to discover what data type it > contains, and then you inspect it *again* to finally translate > it. > I was thi

Re: urlparse.urlparse bug - misparses long URL

2007-12-14 Thread John Nagle
John Nagle wrote: > Matt Nordhoff wrote: >> John Nagle wrote: >>> Here's a hostile URL that "urlparse.urlparse" seems to have mis-parsed. >>> > ... > >> >> It's breaking on the first slash, which just happens to be very late in >> the URL. >> > urlparse('http://example.com?blahblah=http:/

Re: Is Python really a scripting language?

2007-12-14 Thread Chris Mellon
On Dec 14, 2007 2:07 AM, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Thu, 13 Dec 2007 10:43:18 +0100, Bruno Desthuilliers > <[EMAIL PROTECTED]> declaimed the > following in comp.lang.python: > > > > > I still wait to see any clear, unambiguous definition of "scripting > > language". Which one

Re: [Plone-Users] Why Can't I Do This?

2007-12-14 Thread Tommy Grav
On Dec 14, 2007, at 11:21 AM, Victor Subervi wrote: > whatever[0:2] will yield THREE characters, so my "by " is correct > and "by" will fail every time :)) > Victor Nope, whatever[0:2] is two characters: ActivePython 2.5.1.1 (ActiveState Software Inc.) based on Python 2.5.1 (r251:54863, May

state machine and a global variable

2007-12-14 Thread tuom . larsen
Dear list, I'm writing very simple state machine library, like this: _state = None def set_state(state): global _state _state = state def get_state(): print _surface but I hate to use global variable. So, please, is there a better way of doing this? All I want is that a user has

Python for Java programmer

2007-12-14 Thread Nirav Thaker
Yo Group, I'm excited to learn Python as new language coming year, I consider myself good Java developer and, not so unusually, with very limited experience with dynamic programming languages such as Python or Ruby. I have started with basics at http://docs.python.org, but I'm more interested in

Re: Clearing a DOS terminal in a script

2007-12-14 Thread Chris Gonnerman
Stephen_B wrote: > This doesn't seem to work in a dos terminal at the start of a script: > > from os import popen > print popen('clear').read() > > Any idea why not? Thanks. > As others have mentioned, you should just do: os.system("cls") Or, you can use my WConio module for fancier work. htt

Re: Newbie design problem

2007-12-14 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Most unclear. My apologies. > > I'm trying to structure a tokenizer. The stupid concatenations are > just placeholders for the actual tokenizing work. By rebuilding the > input they demonstrate that the framework correctly processes all the > input. > > I'm currently

Re: "do" as a keyword

2007-12-14 Thread Tobiah
> But reading through the warts and reading about a lack of "do while > statements" I also started to ponder about the "'do something' if > 'true' else 'do this'", and pondered if perhaps this statement could > do with the including of the keyword do. I often miss what can be done in other langua

Re: Newbie design problem

2007-12-14 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Jonathan Garnder said: > >> Well, if using something like PLY ( http://www.dabeaz.com/ply/ ) is >> considered more Pythonic than writing your own parser and lexer... > > Lex is very crude. Possibly. Anyway, there are quite a few other parser generators : http://wik

Re: Compressing a text file using count of continous characters

2007-12-14 Thread Marc 'BlackJack' Rintsch
On Fri, 14 Dec 2007 08:54:58 -0800, nirvana wrote: > I need to count the number of continous character occurances(more than > 1) in a file, and replace it with a compressed version, like below > XYZDEFAAcdAA --> XYZ8ADEF2Acd2A Great. Then go ahead an implement it. :-) `itertools.groupb

Re: replacing built-in exception types

2007-12-14 Thread Stargaming
On Tue, 11 Dec 2007 12:51:52 -0800, Nishkar Grover wrote: > I'm trying to replace a built-in exception type and here's a simplified > example of what I was hoping to do... > > > >>> import exceptions, __builtin__ > >>> > >>> zeroDivisionError = exceptions.ZeroDivisionError I don't know why y

Re: Python for Java programmer

2007-12-14 Thread George Sakkis
On Dec 14, 11:53 am, Nirav Thaker <[EMAIL PROTECTED]> wrote: > Yo Group, > > I'm excited to learn Python as new language coming year, I consider > myself good Java developer and, not so unusually, with very limited > experience with dynamic programming languages such as Python or Ruby. > > I have s

Re: Job Offer: Python Ninja or Pirate!

2007-12-14 Thread George Sakkis
On Dec 14, 9:57 am, Stargaming <[EMAIL PROTECTED]> wrote: > On Tue, 11 Dec 2007 08:57:16 -0800, George Sakkis wrote: > > Closer, but still wrong; for some weird reason, __import__ for modules > > in packages returns the top level package by default; you have to use > > the 'fromlist' argument: > >

Re: Compressing a text file using count of continous characters

2007-12-14 Thread Chris Mellon
On Dec 14, 2007 10:54 AM, nirvana <[EMAIL PROTECTED]> wrote: > I need to count the number of continous character occurances(more than > 1) in a file, and replace it with a compressed version, like below > XYZDEFAAcdAA --> XYZ8ADEF2Acd2A > This sounds like homework. Google for run length e

Re: Compressing a text file using count of continous characters

2007-12-14 Thread nirvana
On Dec 14, 12:07 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On Dec 14, 2007 10:54 AM, nirvana <[EMAIL PROTECTED]> wrote: > > > I need to count the number of continous character occurances(more than > > 1) in a file, and replace it with a compressed version, like below > > XYZDEFAAcdAA

Re: Source formatting fixer?

2007-12-14 Thread Bret
The thing is, I'm not so much trying to fix indentation issues as spacing problems that affect readability but not program structure. All the indentation is fine, this is more trying to change things like: if ((one==two)and(three==four)): a=b+42 c=Classname (a,b) print "Class %s create

Re: state machine and a global variable

2007-12-14 Thread Matimus
On Dec 14, 8:52 am, [EMAIL PROTECTED] wrote: > Dear list, > I'm writing very simple state machine library, like this: > > _state = None > > def set_state(state): > global _state > _state = state > > def get_state(): > print _surface > > but I hate to use global variable. So, please, is

Re: reloading modules and isinstance()

2007-12-14 Thread Diez B. Roggisch
Tlis schrieb: > Hi, > > I have found that it is possible to reassign the instance.__class__ > reference to the same class (but after reloading) to make the > isinstance() test work again! I know that it is a kind of hacking of > the Python interpreter, but it works :-) It's not especially "hackin

Re: Best way to protect my new commercial software.

2007-12-14 Thread tinnews
Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2007-12-14, farsheed <[EMAIL PROTECTED]> wrote: > > > Let me be clear for you: there are someone in my company who > > love to use my software in other companies that she works > > there also. and because it is an inhouse tool, my CEO wanted > > me to

Re: RegExp Help

2007-12-14 Thread Sean DiZazzo
On Dec 14, 3:06 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 14 Dec 2007 06:06:21 -0300, Sean DiZazzo <[EMAIL PROTECTED]> > escribió: > > > > > On Dec 14, 12:04 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > >> On Thu, 13 Dec 2007 17:49:20 -0800, Sean DiZazzo wrote: > >

High speed web services

2007-12-14 Thread herbasher
Hello! I'm wondering: I'm really not so much into heavy frameworks like Django, because I need to build a fast, simple python based webservice. That is, a request comes in at a certain URL, and I want to utilize Python to respond to that request. Ideally, I want the script to be "cached" so it d

Re: urlparse.urlparse bug - misparses long URL - FIX

2007-12-14 Thread John Nagle
John Nagle wrote: > John Nagle wrote: >> Matt Nordhoff wrote: >>> John Nagle wrote: Here's a hostile URL that "urlparse.urlparse" seems to have mis-parsed. >> ... >> >>> >>> It's breaking on the first slash, which just happens to be very late in >>> the URL. >>> >> urlparse('http

Re: Is Python really a scripting language?

2007-12-14 Thread John Nagle
Chris Mellon wrote: > On Dec 14, 2007 2:07 AM, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >> On Thu, 13 Dec 2007 10:43:18 +0100, Bruno Desthuilliers >> <[EMAIL PROTECTED]> declaimed the >> following in comp.lang.python: >> >>> I still wait to see any clear, unambiguous definition of "scripting >>

Re: state machine and a global variable

2007-12-14 Thread Chris Mellon
On Dec 14, 2007 10:52 AM, <[EMAIL PROTECTED]> wrote: > Dear list, > I'm writing very simple state machine library, like this: > > > > _state = None > > def set_state(state): > global _state > _state = state > > def get_state(): > print _surface > > > > but I hate to use global variable

Re: searching a value of a dict (each value is a list)

2007-12-14 Thread MonkeeSage
On Dec 10, 1:28 pm, [EMAIL PROTECTED] wrote: > Seongsu Lee: > > >I have a dictionary with million keys. Each value in the dictionary has a > >list with up to thousand integers.< > > Let's say each integer can be represented with 32 bits (if there are > less numbers then a 3-byte representation may

Call for Project Participation in Development Sprints at PyCon 2008

2007-12-14 Thread Facundo Batista
Python-related projects: join the PyCon Development Sprints! The development sprints are a key part of PyCon, a chance for the contributors to open-source projects to get together face-to-face for up to four days of intensive learning and development. Newbies sit at the same table as the gurus, g

Re: High speed web services

2007-12-14 Thread Matt Nordhoff
herbasher wrote: > I'm wondering: I'm really not so much into heavy frameworks like > Django, because I need to build a fast, simple python based > webservice. > > That is, a request comes in at a certain URL, and I want to utilize > Python to respond to that request. > > Ideally, I want the scri

Re: state machine and a global variable

2007-12-14 Thread tuom . larsen
On Dec 14, 7:35 pm, Matimus <[EMAIL PROTECTED]> wrote: > On Dec 14, 8:52 am, [EMAIL PROTECTED] wrote: > > > > > Dear list, > > I'm writing very simple state machine library, like this: > > > _state = None > > > def set_state(state): > > global _state > > _state = state > > > def get_state()

Re: Is Python really a scripting language?

2007-12-14 Thread [EMAIL PROTECTED]
On Dec 11, 10:34 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Ron Provost" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > But here's my problem, most of my coworkers, when they see my apps and > learn that they are written in Python ask questions like, "Why would you > write t

Re: High speed web services

2007-12-14 Thread Jarek Zgoda
herbasher pisze: > How do I built highly available and lighting fast Python webservice? Write optimized code and use it in conjunction with twisted.web. -- Jarek Zgoda http://zgodowie.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie design problem

2007-12-14 Thread MartinRinehart
Bruno Desthuilliers wrote: > Then the first move is to carefully eval existing solutions: > http://wiki.python.org/moin/LanguageParsing Always good advice, Bruno. How did you come by that list address? Google or is there something special known to Python experts? -- http://mail.python.org/mailm

Re: High speed web services

2007-12-14 Thread Manlio Perillo
Il Fri, 14 Dec 2007 11:07:49 -0800, herbasher ha scritto: > Hello! > > I'm wondering: I'm really not so much into heavy frameworks like Django, > because I need to build a fast, simple python based webservice. > > That is, a request comes in at a certain URL, and I want to utilize > Python to re

Re: Loops and things

2007-12-14 Thread i . pantusa
On Dec 14, 5:01 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-12-14, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > I was wondering how and if it's possible to write a loop in python > > which updates two or more variables at a time. For instance, something > > like this in C: > > >

Re: Is Python really a scripting language?

2007-12-14 Thread Chris Mellon
On Dec 14, 2007 2:09 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Dec 11, 10:34 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > > "Ron Provost" <[EMAIL PROTECTED]> wrote in message > > > > news:[EMAIL PROTECTED] > > But here's my problem, most of my coworkers, when they see my apps and > >

Re: Loops and things

2007-12-14 Thread Jair Trejo
I was wondering how and if it's possible to write a loop in python which updates two or more variables at a time. For instance, something like this in C: for (i = 0, j = 10; i < 10 && j < 20; i++, j++) { printf("i = %d, j = %d\n", i, j); } So that I would get: i = 0, j = 0 i = 1, j = 1 i = 2

speed versus threading or asyncore

2007-12-14 Thread scripteaze
I need some examples on using asycore for a client app im creating. I need to be able to connect to my server 10 times and i dont want any lag nor my cpu to be taxed. The examples ive found are for the server and i dont know how to implement asyncore on the client. -- http://mail.python.org/mailm

Download new version of phyton language | http://freenewsoftware.blogspot.com/2007/12/python.html

2007-12-14 Thread yuni . wijayanti
follow this link http://freenewsoftware.blogspot.com/2007/12/python.html -- http://mail.python.org/mailman/listinfo/python-list

container.___le___ can use only <=?

2007-12-14 Thread Neil Cerutti
When implementing the rich comparison operators for some sort of container, it's tempting to save code by doing something like: class LarchTree: ... def __gt__(self, other): # A lot of code to traverse the tree def __le__(self): return not self > other However, if I'm thinking

Re: Is Python really a scripting language?

2007-12-14 Thread [EMAIL PROTECTED]
On Dec 14, 2:48 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On Dec 14, 2007 2:09 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > On Dec 11, 10:34 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > > > "Ron Provost" <[EMAIL PROTECTED]> wrote in message > > > >news:[EMAIL PROTECTED] > > >

HTTPS GET request.

2007-12-14 Thread Jon
Hi, I'm testing an application that sends an HTTPS GET request in the form of: https://localhost/cgi-bin/parse_eas.cgi?vers=2+"&msg=This+is+a+simple+%26+short+test. I need to get a hold of that entire request for comparison / verification purposes. The closet thing I found is Sebastien Martini'

  1   2   >