Re: is_iterable function.

2007-07-26 Thread Bruno Desthuilliers
Neil Cerutti a écrit : > def is_iterable(obj): > try: > iter(obj) > return True > except TypeError: > return False > > Is there a better way? The only other alternative I see is worse: def iterable(obj): # strings are iterable and don't have an __iter__ method.

Re: Why PHP is so much more popular for web-development

2007-07-26 Thread Bruno Desthuilliers
walterbyrd a écrit : > On Jul 25, 12:40 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > > >>What exactly could Python learn from PHP? > > > Remember, I'm a noob, I'm not trolling. > > When I posted "Python" I meant the Python web-developement world. In > particular, python frameworks, like Cher

Re: Reading files, splitting on a delimiter and newlines.

2007-07-26 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hello, > > I have a situation where I have a file that contains text similar to: > > myValue1 = contents of value1 > myValue2 = contents of value2 but > with a new line here > myValue3 = contents of value3 > > My first approach was to open th

Re: code indentation

2007-07-26 Thread Thorsten Kampe
* (Wed, 25 Jul 2007 11:22:03 -0700) > On 25 srp, 17:31, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: > > >> And while we're on the topic of communication: The original poster > > >> would do well to learn that increasing the number of consecutive > > >> punctuation

Re: Singleton in Python Cookbook

2007-07-26 Thread Bruno Desthuilliers
Alex Popescu a écrit : > Hi all! > > I was reading through Python Cookbook the Singleton recipe. At this moment > I am a bit puzzled as the example in the book is not working resulting in: > > TypeError: type.__new__(SingleSpam): SingleSpam is not a subtype of type > > (I haven't presented the

Re: I am giving up perl because of assholes on clpm -- switching to Python

2007-07-26 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Python is a better language, with php support, Python has php support ? My, I'm a professional web developper using both, and I didn't knew this. (snip troll) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to tell when a socket is closed on the other end?

2007-07-26 Thread Jay Loden
Roy Smith wrote: > In article <[EMAIL PROTECTED]>, > billiejoex <[EMAIL PROTECTED]> wrote: > >> Hi there. >> I'm setting up test suite for a project of mine. >> >From test suite, acting as a client, I'd like to know, in certain >> situations, if the socket is closed on the other end or not. >> I

Re: Any reason why cStringIO in 2.5 behaves different from 2.4?

2007-07-26 Thread Stefan Behnel
Stefan Scholl wrote: > After an hour searching for a potential bug in XML parsing > (PyXML), after updating from 2.4 to 2.5, I found this one: > > $ python2.5 > Python 2.5 (release25-maint, Dec 9 2006, 14:35:53) > [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-20)] on linux2 > Type "help", "copyr

Tix.Tk() on Mac Intel

2007-07-26 Thread Alan
Hi List! I have I Macbook Pro Intel running OSX 10.4.10. I downloaded Python 2.5 and tried TclTkAquaBI-8.4.10.0.dmg, but I got: Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk/Tix.py", line 210, in __init__

Re: From D

2007-07-26 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > Propose: > 123 456 789 => 123456789 > 123.456 789 => 123.456789 +1 -- http://mail.python.org/mailman/listinfo/python-list

Re: From D

2007-07-26 Thread bearophileHUGS
Sorry for the slow feedback. Stargaming>Sounds like a good thing to be but the arbitrary positioning doesnt make any sense.< The arbitrary positioning allows you to denote 4-digit groups too in binary/hex literals, like in my example: auto x = 0b0100_0011; Stargaming>fits into the current movem

Why PHP is so much more popular for web-development

2007-07-26 Thread matt westerburg
Why are you praising PHP on a python mailing list are you trying to start a flame war? (Not evaluating PHP as a language), our company just switched over to using Django and my has it saved us time, and we can organize our code its really beautiful. PHP is full of new to programming users and thu

Re: first, second, etc line of text file

2007-07-26 Thread Daniel Nogradi
> > A very simple question: I currently use a cumbersome-looking way of > > getting the first, second, etc. line of a text file: > > > > for i, line in enumerate( open( textfile ) ): > > if i == 0: > > print 'First line is: ' + line > > elif i == 1: > > print 'Second line is

Re: Why PHP is so much more popular for web-development

2007-07-26 Thread walterbyrd
On Jul 22, 12:17 am, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Either you are a casual user with 101 web > development skills trying to set up your personal home page But this, sort of, brings me back to my original point. Nobody starts out being advanced. There are substantial difference

Scope PyQt question

2007-07-26 Thread dittonamed
Code pasted below -> Can anyone out there suggest a way to access the object "p" thats started in playAudio() from inside the stopAudio()? I need the object reference to use QProcess.kill() on it. The code sample is below. Thanks to anyone who helps out =) More comments in the code below ---

Re: Generating PDF reports

2007-07-26 Thread Grant Edwards
On 2007-07-26, marcpp <[EMAIL PROTECTED]> wrote: > Hi i'm introducing to do reports from python, any recomendation? Learn to use Google? http://www.google.com/search?q=pdf+report+python -- Grant Edwards grante Yow! My haircut is totally

Re: Scope PyQt question

2007-07-26 Thread Stargaming
On Thu, 26 Jul 2007 06:41:44 -0700, dittonamed wrote: > Code pasted below -> > > Can anyone out there suggest a way to access the object "p" thats > started in playAudio() from inside the stopAudio()? I need the object > reference to use QProcess.kill() on it. The code sample is below. Thanks

Re: Parsing XML with ElementTree (unicode problem?)

2007-07-26 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > On Jul 26, 3:13 pm, John Machin <[EMAIL PROTECTED]> wrote: >> On Jul 26, 9:24 pm, [EMAIL PROTECTED] wrote: >> >>> OK, I solved the problem but I still don't get what went wrong. >>> Solution - use tree builder in order to create the new xml file >>> (previously I was "ma

Re: first, second, etc line of text file

2007-07-26 Thread Steve Holden
Mike wrote: > On Jul 26, 8:46 am, "Daniel Nogradi" <[EMAIL PROTECTED]> wrote: A very simple question: I currently use a cumbersome-looking way of getting the first, second, etc. line of a text file: for i, line in enumerate( open( textfile ) ): if i == 0: print

Re: Fwd: I am giving up perl because of assholes on clpm -- switching to Python

2007-07-26 Thread jed drury
Hey, Perl's new motto is "There is more than 1 way to be an ASSHOLE!" Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_

Re: Fwd: I am giving up perl because of assholes on clpm -- switching to Python

2007-07-26 Thread Steve Holden
jed drury wrote: > Hey, Perl's new motto is "There is more than 1 way to > be an ASSHOLE!" As you have just demonstrated. regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.

removing items from a dictionary ?

2007-07-26 Thread Stef Mientki
hello, I want to remove some items from a dictionary, so I would expect this should work: Nets = {} ... fill the dictionary Nets for net in Nets: if net.upper() in Eagle_Power_Nets : del Nets [ net ] But it gives me Message File Name LinePosition Traceback

Re: removing items from a dictionary ?

2007-07-26 Thread martyw
Stef Mientki wrote: > hello, > > I want to remove some items from a dictionary, > so I would expect this should work: > > Nets = {} > ... fill the dictionary Nets > > for net in Nets: > if net.upper() in Eagle_Power_Nets : > del Nets [ net ] > > > But it gives me > MessageF

Re: removing items from a dictionary ?

2007-07-26 Thread Steve Holden
Stef Mientki wrote: > hello, > > I want to remove some items from a dictionary, > so I would expect this should work: > >Nets = {} >... fill the dictionary Nets > >for net in Nets: > if net.upper() in Eagle_Power_Nets : >del Nets [ net ] > > > But it gives me > Message

Re: code indentation

2007-07-26 Thread vedrandekovic
On 26 srp, 13:43, Steve Holden <[EMAIL PROTECTED]> wrote: > Thorsten Kampe wrote: > > * (Wed, 25 Jul 2007 11:22:03 -0700) > >> On 25 srp, 17:31, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > >>> [EMAIL PROTECTED] wrote: > > And while we're on the topic of communication: The original poste

Re: question about math module notation

2007-07-26 Thread brad
Stargaming wrote: > Explicitly converting it to `int` works for me. (Without the 3-digit- > block notation, of course.) Thank you! -- http://mail.python.org/mailman/listinfo/python-list

pyparser and recursion problem

2007-07-26 Thread pyscottishguy
Hi, Using pyparser, I'm trying to parse a string like this: :Start: first SECOND THIRD :SECOND: second1 | second2 :THIRD: third1 | FOURTH :FOURTH: fourth1 | fourth2 I want the parser to do the following: 1) Get the text for the :Start: label e.g ('first SECOND THIRD') 2) Do nothing with the l

Re: removing items from a dictionary ?

2007-07-26 Thread Alex Popescu
Stef Mientki <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > hello, > > I want to remove some items from a dictionary, > so I would expect this should work: > >Nets = {} >... fill the dictionary Nets > >for net in Nets: > if net.upper() in Eagle_Power_Nets : >de

Re: removing items from a dictionary ?

2007-07-26 Thread Paul Rubin
Stef Mientki <[EMAIL PROTECTED]> writes: > > for net in Nets.keys(): > > # Nets.iterkeys() would avoid building the list > > # but that runs the same risks as your original > > if net.upper() in in Eagle_Power_Nets : > > del Nets[net] > > > thanks Steve, > that does

Re: question about math module notation

2007-07-26 Thread Gary Herron
Stargaming wrote: > On Thu, 26 Jul 2007 15:54:11 -0400, brad wrote: > > >> How does one make the math module spit out actual values without using >> engineer or scientific notation? >> >> I get this from print math.pow(2,64): 1.84467440737e+19 >> >> I want this: >> 18,446,744,073,709,551,616 >>

Re: question about math module notation

2007-07-26 Thread Paul Rubin
brad <[EMAIL PROTECTED]> writes: > Ah yes, that works too... thanks. I've settled on doing it this way: > print int(math.pow(2,64)) > I like the added parenthesis :) I was surprised to find that gives an exact (integer, not floating-point) answer. Still, I think it's better to say 2**64 which als

Re: ANN: Snobol 1.0

2007-07-26 Thread John J. Lee
(Sorry if this appears twice, accidentally included c.l.py.announce the first time where it was (correctly) rejected, not sure if that means it didn't get through to c.l.py either). greg <[EMAIL PROTECTED]> writes: > Aahz wrote: >> So adding >> SNOBOL patterns to another library would be a wonder

Re: SQLObject 0.9.1

2007-07-26 Thread Sherm Pendley
Gerardo Herzig <[EMAIL PROTECTED]> writes: > So..at 11:23 we got version 0.7.8...at 11:30 was version 0.8.5...now > there is a 0.9.1 version?? Have a coffe dude Sounds more to me like he needs to lay off the coffee, or at least switch to decaffeinated for a while. :-) sherm-- -- Web Hosting b

Comparing Dictionaries

2007-07-26 Thread Kenneth Love
Hello, I am new to Python, but not programming. I would like to start my Python career by developing programs according to the "best practices" of the industry. Right now, that appears to be unit tests, patterns, and source code control. So, I am trying to write a unit test for some code that

Re: SQLObject 0.9.1

2007-07-26 Thread Gerardo Herzig
Oleg Broytmann wrote: >Hello! > >I'm pleased to announce the 0.9.1 release of SQLObject. > > >What is SQLObject >= > >SQLObject is an object-relational mapper. Your database tables are described >as classes, and rows are instances of those classes. SQLObject is meant to be >easy

automatic type conversion for comparison operators

2007-07-26 Thread Russ
I posted a message on this several days ago, but it apparently got lost in googlespace, so I'll try it again. I recently discovered a bug in my code that apparently resulted from the automatic conversion of a function pointer to an integer. Say you have a class member function called getCount(),

Re: code indentation

2007-07-26 Thread Ben Finney
Steve Holden <[EMAIL PROTECTED]> writes: > We should be making allowances for this particular poster on account > of relative youth: I hadn't realised earlier, but we are dealing > with a fourteen-year-old. I don't believe that's true. One of the great advantages of discussion over the internet i

Re: SQLObject 0.9.1

2007-07-26 Thread Sherm Pendley
Steve Holden <[EMAIL PROTECTED]> writes: > Sherm Pendley wrote: >> Steve Holden <[EMAIL PROTECTED]> writes: >> >>> Sherm Pendley wrote: Gerardo Herzig <[EMAIL PROTECTED]> writes: > So..at 11:23 we got version 0.7.8...at 11:30 was version 0.8.5...now > there is a 0.9.1 version??

Re: Reading files, splitting on a delimiter and newlines.

2007-07-26 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > On Jul 25, 8:46 am, [EMAIL PROTECTED] wrote: > >>Hello, >> >>I have a situation where I have a file that contains text similar to: >> >>myValue1 = contents of value1 >>myValue2 = contents of value2 but >>with a new line here >>myValue3 = conten

Re: zip() function troubles

2007-07-26 Thread Istvan Albert
On Jul 26, 9:33 pm, Paul Rubin wrote: > Do a top or vmstat while that is happening and see if you are > swapping. You are allocating 10 million ints and 10 million tuple > nodes, = 20 million objects. Although, even at 100 bytes per object > that would be 1GB which wou

Re: Another C API Question

2007-07-26 Thread Farshid Lashkari
beginner wrote: > I know obj is a number, but I do not know the exact type. How can I > convert it to double without writing a giant switch() that exhausts > every single type of number? Try using the PyFloat_AsDouble(...) function, it should be able to convert an object to a double, as long as t

Re: Why PHP is so much more popular for web-development

2007-07-26 Thread Bruno Desthuilliers
SamFeltus a écrit : > PHP is just a more inclusive community. The PHP community is more > concerned with the casual user and the end user. This is PHP's core > strength, and one of Python's core weaknesses. The Python community > would be wise to adopt PHP's concern for the end user. This asse

Re: Another C API Question

2007-07-26 Thread Robert Kern
beginner wrote: > Hi, > > I run into another C API question. What is the simplest way to convert > an PyObject into a double? > > For example, I have > > PyObject *obj; > > I know obj is a number, but I do not know the exact type. How can I > convert it to double without writing a giant switch

Re: automatic type conversion for comparison operators

2007-07-26 Thread Russ
Dan Bishop wrote: > BTW, are you a former Pascal programmer? No. Why do you ask? [The code snippet I wrote was made up to get a point across. I did not actually use that function name in my code.] > > But Python > > somehow compares the function pointer with an integer without > > complaining.

Re: generating objects of a type from a name.

2007-07-26 Thread tsuraan
I'm not sure what a visual object is, but to create an instance of an object whose name is known, you can use "eval": >>> oname = 'list' >>> obj = eval(oname)() >>> obj [] >>> type(obj) Hope that helps! On 26/07/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'm trying to generate visual p

Re: zip() function troubles

2007-07-26 Thread Paul Rubin
Istvan Albert <[EMAIL PROTECTED]> writes: > I tested this on a linux server system with 4Gb of RAM > a = [ 0 ] * 10**7 > takes miliseconds, but say the > b = zip(a,a) > will take a very long time to finish: Do a top or vmstat while that is happening and see if you are swapping. You are allocating

Re: How to tell when a socket is closed on the other end?

2007-07-26 Thread Walker Lindley
The easiest way I've found is to just surround every socket-related thing you do with try/except. the except statement is something like "except socket.error, err_info". then the err_info variable will have a tuple containing the BSD socket error number and the text of the error. You can reference

Another C API Question

2007-07-26 Thread beginner
Hi, I run into another C API question. What is the simplest way to convert an PyObject into a double? For example, I have PyObject *obj; I know obj is a number, but I do not know the exact type. How can I convert it to double without writing a giant switch() that exhausts every single type of

Re: Learning Jython?

2007-07-26 Thread Benjamin
Paul Rubin wrote: > Matt Bitten <[EMAIL PROTECTED]> writes: > > It looks like Jython is for me. That said, I have two questions: > > (1) Am I thinking straight here? Or is there some other solution that > > a knows-Python-but-not-Java programmer might use? You could convert to the whole world to u

Re: zip() function troubles

2007-07-26 Thread Paul Rubin
Istvan Albert <[EMAIL PROTECTED]> writes: > Now it takes over two minutes to do this: > > size = 10**7 > a = [ 0 ] * size > b = zip(a,a) OK, I'm getting similar results under 64 bit Pytnon 2.4.4c1 and also under 2.5. About 103 seconds for 10**7 and 26 seconds for 5*10**6. So it looks like zip is

Re: code indentation

2007-07-26 Thread Steve Holden
Ben Finney wrote: > Steve Holden <[EMAIL PROTECTED]> writes: > >> We should be making allowances for this particular poster on account >> of relative youth: I hadn't realised earlier, but we are dealing >> with a fourteen-year-old. > > I don't believe that's true. One of the great advantages of d

Re: SQLObject 0.9.1

2007-07-26 Thread Steve Holden
Sherm Pendley wrote: > Steve Holden <[EMAIL PROTECTED]> writes: > >> Sherm Pendley wrote: >>> Gerardo Herzig <[EMAIL PROTECTED]> writes: >>> So..at 11:23 we got version 0.7.8...at 11:30 was version 0.8.5...now there is a 0.9.1 version?? Have a coffe dude >>> Sounds more to me like he ne

Re: code indentation

2007-07-26 Thread Ben Finney
[EMAIL PROTECTED] writes: > here is my failed example of try with string: > > kl="n=90;if n==90:print'kajmakimar'" > > for line in kl.split(";"): > li=[] > m=li.append(line) > if line.endswith(':'): > m.append("\n\t\t\t\t\t\t\t\t") > print m The list.append method re

Re: SQLObject 0.9.1

2007-07-26 Thread Steve Holden
Sherm Pendley wrote: > Gerardo Herzig <[EMAIL PROTECTED]> writes: > >> So..at 11:23 we got version 0.7.8...at 11:30 was version 0.8.5...now >> there is a 0.9.1 version?? Have a coffe dude > > Sounds more to me like he needs to lay off the coffee, or at least switch > to decaffeinated for a while

Re: From D

2007-07-26 Thread Ben Finney
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > The str.split method has no bearing on this discussion, > > It most certainly does. To make '123 456' into an integer, > you split it and then join it. Indeed. Which has nothing to do with the Python syntax for creating a numeric literal in cod

Re: From D

2007-07-26 Thread Ben Finney
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > So, just as > > >>> int('123' '456') > 123456 > > is not an error, the proposal is that > > >>> a = 123 456 > SyntaxError: invalid syntax > > will not be an error either. More directly: Just as these three statements create the

Re: zip() function troubles

2007-07-26 Thread Paul Rubin
Istvan Albert <[EMAIL PROTECTED]> writes: > exceeded 10 million the zip function slowed to a crawl. Note that > there was memory available to store over 100 million items. How many bytes is that? Maybe the items (heap-allocated boxed integers in your code example) are bigger than you expect. --

Re: automatic type conversion for comparison operators

2007-07-26 Thread Dan Bishop
On Jul 26, 6:22 pm, Russ <[EMAIL PROTECTED]> wrote: > I posted a message on this several days ago, but it apparently got > lost > in googlespace, so I'll try it again. > > I recently discovered a bug in my code that apparently resulted from > the automatic conversion of a function pointer to an int

zip() function troubles

2007-07-26 Thread Istvan Albert
Hello all, I've been debugging the reason for a major slowdown in a piece of code ... and it turns out that it was the zip function. In the past the lists that were zipped were reasonably short, but once the size exceeded 10 million the zip function slowed to a crawl. Note that there was memory av

Re: pyparser and recursion problem

2007-07-26 Thread Paul McGuire
On Jul 26, 3:27 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: > > Hopefully I'll have time to help you a bit more later, or Paul > MaGuire will swoop down in his pyparsing powered super-suit. ;) > There's no need to fear...! Neil was dead on, and your parser is almost exactly right. Congratulations

RE: From D

2007-07-26 Thread Ryan Ginstrom
> On Behalf Of Leo Petr > Digits are grouped in 2s in India and in 4s in China and Japan. This is not entirely true in Japan's case. When written without Japanese characters, Japan employs the same format as the US, for example: 1,000,000 (However, they would read this as 百万 (hyaku man), literall

Learning Jython?

2007-07-26 Thread Matt Bitten
Hi, all. I'm in a situation where I need to be writing a bunch of quick-y (hopefully) self-contained programs that anyone can run from a web page. Java applets are the obvious way to do this. However, I don't know much Java, and, frankly, right now I don't feel much like learning it. I *am* pretty

Re: is_iterable function.

2007-07-26 Thread Neil Cerutti
On 2007-07-26, George Sakkis <[EMAIL PROTECTED]> wrote: > That's not the only problem; try a string element to see it > break too. More importantly, do you *always* want to handle > strings as iterables ? > > The best general way to do what you're trying to is pass > is_iterable() as an optional ar

Re: removing items from a dictionary ?

2007-07-26 Thread Stef Mientki
Paul Rubin wrote: > Stef Mientki <[EMAIL PROTECTED]> writes: >>> for net in Nets.keys(): >>> # Nets.iterkeys() would avoid building the list >>> # but that runs the same risks as your original >>> if net.upper() in in Eagle_Power_Nets : >>> del Nets[net] >>> >> than

CSV Issue

2007-07-26 Thread Rohan
I'm having a trouble consider this import csv f = open("/home/t/tp/va/some7.csv", "rb") reader =csv.reader(f) rows =[] for row in reader: rows.append(row) rows[1].append('1') print rows f = open("/home/t/tp/va/e7.csv", "ab") writer =csv.writer(f) writer.writerows(rows) f.close() In the f

Re: Why PHP is so much more popular for web-development

2007-07-26 Thread Paul Rubin
"Chris Mellon" <[EMAIL PROTECTED]> writes: > Would you make this directory name be the username+the password? If > not, why not? The answer is the same reason why this isn't a reliable > method of security. I would not store plaintext passwords in a database, but that doesn't mean it's security by

Re: I am giving up perl because of assholes on clpm -- switching to Python

2007-07-26 Thread Paul Rubin
John K Masters <[EMAIL PROTECTED]> writes: > As a complete amateur in the world of programming (barring 25 years > programming machine tools in the aerospace industry) I would like to > point out that the more arcane the ['language', 'operating system', > 'application'] the more unfriendly the comm

Re: Any reason why cStringIO in 2.5 behaves different from 2.4?

2007-07-26 Thread Chris Mellon
On 7/26/07, Stefan Scholl <[EMAIL PROTECTED]> wrote: > Stefan Behnel <[EMAIL PROTECTED]> wrote: > > The XML is *not* well-formed if you pass Python unicode instead of a byte > > encoded string. Read the XML spec. > > Pointers, please. > > Last time I read that part of the spec was when a customer's

Re: Why PHP is so much more popular for web-development

2007-07-26 Thread Chris Mellon
On 26 Jul 2007 13:26:33 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > Steve Holden <[EMAIL PROTECTED]> writes: > > > That sounds trivial to ameliorate (at least somewhat) by putting your > > > uploads in a directory whose name is known only to you (let's say it's > > > a random 20-let

Re: I am giving up perl because of assholes on clpm -- switching toPython

2007-07-26 Thread Hendrik van Rooyen
James Matthews wrote: >Wow! They might leave this newsgroup now also! Would be a pity, somehow - there seems to be a dearth of female posters here ;-) - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: code indentation

2007-07-26 Thread Michael L Torrie
[EMAIL PROTECTED] wrote: > > .so maybe if you can help me with this? If I understand you correctly, you're trying to make a "pretty-printer" in python, right? Something that will take arbitrary python source code, recognize the blocks and so forth, and then emit clean python code (text) with

Re: Why PHP is so much more popular for web-development

2007-07-26 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > > That sounds trivial to ameliorate (at least somewhat) by putting your > > uploads in a directory whose name is known only to you (let's say it's > > a random 20-letter string). The parent directory can be protected to > > not allow reading the subdirect

Re: question about math module notation

2007-07-26 Thread Stargaming
On Thu, 26 Jul 2007 15:54:11 -0400, brad wrote: > How does one make the math module spit out actual values without using > engineer or scientific notation? > > I get this from print math.pow(2,64): 1.84467440737e+19 > > I want this: > 18,446,744,073,709,551,616 > > I'm lazy... I don't want to c

Re: Fwd: I am giving up perl because of assholes on clpm -- switching to Python

2007-07-26 Thread Kay Schluehr
On Jul 26, 8:18 pm, jed drury <[EMAIL PROTECTED]> wrote: > Hey, Perl's new motto is "There is more than 1 way to > be an ASSHOLE!" Do you think the unique asshole constraint feels more natural? I tend to agree. -- http://mail.python.org/mailman/listinfo/python-list

question about math module notation

2007-07-26 Thread brad
How does one make the math module spit out actual values without using engineer or scientific notation? I get this from print math.pow(2,64): 1.84467440737e+19 I want this: 18,446,744,073,709,551,616 I'm lazy... I don't want to convert it manually :) -- http://mail.python.org/mailman/listinfo/

Re: I am giving up perl because of assholes on clpm -- switching to Python

2007-07-26 Thread Paul Rubin
M brad <[EMAIL PROTECTED]> writes: > Out of the pan and into the fire. :) Welcome to the world of Ph.D's in > Computer Science. You think the Perl guys have attitude, just wait and > see what you're in for over here. I think you'll find attitudes in any > programming language... just different type

Re: Any reason why cStringIO in 2.5 behaves different from 2.4?

2007-07-26 Thread Stefan Scholl
Stefan Behnel <[EMAIL PROTECTED]> wrote: > The XML is *not* well-formed if you pass Python unicode instead of a byte > encoded string. Read the XML spec. Pointers, please. Last time I read that part of the spec was when a customer's consulting company switched to ISO-8859-15 without saying someth

Re: removing items from a dictionary ?

2007-07-26 Thread Stef Mientki
> > Since it isn't practical to iterate over Eagle_Power_Nets and test for > presence in your Nets dict, you have to iterate over at least the keys > of Nets. You could just iterate over the keys rather than the whole > table, though: > > for net in Nets.keys(): > # Nets.iterkeys() wou

encode/decode misunderstanding

2007-07-26 Thread Tim Arnold
Hi, I'm beginning to understand the encode/decode string methods, but I'd like confirmation that I'm still thinking in the right direction: I have a file of latin1 encoded text. Let's say I put one line of that file into a string variable 'tocline', as follows: tocline = 'Ficha Datos de p\xe9rdi

Re: Why PHP is so much more popular for web-development

2007-07-26 Thread Paul Rubin
Jeffrey Froman <[EMAIL PROTECTED]> writes: > Consider a PHP-based CMS that allows users to upload files. Because the > application runs as the webserver user, uploaded files, and the directory > where they reside, must be accessible and writable by that user. It is the > same user that any other ho

Re: Fwd: I am giving up perl because of assholes on clpm -- switching to Python

2007-07-26 Thread Danyelle Gragsone
Wow.. How about we let this die now? This isn't Perl its python. Let it die there. Danyelle -- http://mail.python.org/mailman/listinfo/python-list

Re: Why PHP is so much more popular for web-development

2007-07-26 Thread SamFeltus
PHP is just a more inclusive community. The PHP community is more concerned with the casual user and the end user. This is PHP's core strength, and one of Python's core weaknesses. The Python community would be wise to adopt PHP's concern for the end user. That being said, I don't think you wil

Re: From D

2007-07-26 Thread [EMAIL PROTECTED]
On Jul 26, 12:18 am, Ben Finney <[EMAIL PROTECTED]> wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > IDLE 1.2c1 > > >>> s = '123 456' > > >>> s.split() > > ['123', '456'] > > The str.split method has no bearing on this discussion, It most certainly does. To make '123 456' into an integ

◘►Access FREE Satellite TV on your PC or Laptop◄◘

2007-07-26 Thread K. Brown
Legally Access 1000's of Television Channels From All Over The World Watch all your favorite shows on your Computer! Save 1000's of $$$ over many years on cable and satellite bills. INSTANT DOWNLOAD Learn More About it at Link below: http://tvonpc.cq.bz -- http://mail.python.org/mailman/list

Re: adding a docstring to an instancemethod

2007-07-26 Thread jelle
Hi Gabriella, thanks for pointing me in the right direction: eo.eoTruncatedSelectOne.setup.im_func.func_doc = 'method string goes here' works beautifully! cheers, -jelle -- http://mail.python.org/mailman/listinfo/python-list

Re: is_iterable function.

2007-07-26 Thread Marc 'BlackJack' Rintsch
On Thu, 26 Jul 2007 15:02:39 +, Neil Cerutti wrote: > Based on the discussions in this thread (thanks all for your > thoughts), I'm settling for: > > def is_iterable(obj): > try: > iter(obj).next() > return True > except TypeError: > return False > except KeyError: > ret

Re: I am giving up perl because of assholes on clpm -- switching to Python

2007-07-26 Thread Paul Boddie
zentara wrote: > > This is where the big boys play, you have to be able to be able to > scuffle and take punishment if you are wrong or unduly ignorant. > You also need to squash somehow who attacks you, when you > know you are right. Where is this again? High school? I can understand people getti

Re: I am giving up perl because of assholes on clpm -- switching to Python

2007-07-26 Thread Steve Holden
zentara wrote: > On Wed, 25 Jul 2007 14:45:29 -0500, [EMAIL PROTECTED] wrote: > >> Python is a better language, with php support, anyway, but I am fed up >> with attitudes of comp.lang.perl.misc. Assholes in this newsgroup ruin >> Perl experience for everyone. Instead of being helpful, snide remar

Re: wxGlade: Who knows how to drive this application?

2007-07-26 Thread vasudevram
Steve Holden wrote: > I've been trying to use wxGlade recently and I am finding it something > of a challenge. Is there any user who finds the user interface > satisfactory and the operation of the program predictable? Good (for me) that you posted this question, as I got to know about wxGlade (

Re: Any reason why cStringIO in 2.5 behaves different from 2.4?

2007-07-26 Thread Stefan Behnel
Stefan Scholl wrote: > Stefan Behnel <[EMAIL PROTECTED]> wrote: >> Stefan Scholl wrote: >>> Stefan Behnel <[EMAIL PROTECTED]> wrote: Stefan Scholl wrote: > Well, http://docs.python.org/lib/module-xml.sax.html is missing > the fact, that I can't use Unicode with parseString(). > >>>

Re: I am giving up perl because of assholes on clpm -- switching to Python

2007-07-26 Thread Sherm Pendley
Ben Finney <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] writes: > >> Python is a better language, with php support, anyway, but I am fed >> up with attitudes of comp.lang.perl.misc. > > Please, if you must fred the troll, drop comp.lang.python from the > discussion (i.e. post trplies only to th

Re: From D

2007-07-26 Thread Leo Petr
On Jul 24, 10:10 am, Stargaming <[EMAIL PROTECTED]> wrote: > On Tue, 24 Jul 2007 03:19:53 -0700, bearophileHUGS wrote: > > There are various things I like about the D language that I think Python > > too may enjoy. Here are few bits (mostly syntactical ones): > > > 1) (we have discussed part of thi

ctypes:passing python class instances through c and back

2007-07-26 Thread m2i3k
Hi I have C code with requires me to register a python callback. I am able to get the callback working well using ctypes if I use global functions without any context argument for the callback. Now I want to register a python class member function for callback, and give "self" as the context argum

Fwd: I am giving up perl because of assholes on clpm -- switching to Python

2007-07-26 Thread matt westerburg
-- Forwarded message -- From: matt westerburg <[EMAIL PROTECTED]> Date: Jul 26, 2007 11:09 AM Subject: Re: I am giving up perl because of assholes on clpm -- switching to Python To: zentara <[EMAIL PROTECTED]> Welcome, the people here are friendly occasional argument, not very oft

Re: is_iterable function.

2007-07-26 Thread Neil Cerutti
Based on the discussions in this thread (thanks all for your thoughts), I'm settling for: def is_iterable(obj): try: iter(obj).next() return True except TypeError: return False except KeyError: return False The call to iter will fail for objects that don't support the iterat

Re: I am giving up perl because of assholes on clpm -- switching to Python

2007-07-26 Thread zentara
On Wed, 25 Jul 2007 14:45:29 -0500, [EMAIL PROTECTED] wrote: >Python is a better language, with php support, anyway, but I am fed up >with attitudes of comp.lang.perl.misc. Assholes in this newsgroup ruin >Perl experience for everyone. Instead of being helpful, snide remarks, >back-biting, scare t

SQLObject 0.9.1

2007-07-26 Thread Oleg Broytmann
Hello! I'm pleased to announce the 0.9.1 release of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use and quick to get started wi

Re: Why PHP is so much more popular for web-development

2007-07-26 Thread Roel Schroeven
Jeff schreef: > No programming language can fix bad programmers. And if cost is an > issue, www.nearlyfreespeech.net has Python, clisp, and OCaml. But only via CGI, which means every request results in a new instance of the interpreter. -- If I have been able to see further, it was only becaus

Generating PDF reports

2007-07-26 Thread marcpp
Hi i'm introducing to do reports from python, any recomendation? -- http://mail.python.org/mailman/listinfo/python-list

Re: first, second, etc line of text file

2007-07-26 Thread Mike
On Jul 26, 8:46 am, "Daniel Nogradi" <[EMAIL PROTECTED]> wrote: > > > A very simple question: I currently use a cumbersome-looking way of > > > getting the first, second, etc. line of a text file: > > > > for i, line in enumerate( open( textfile ) ): > > > if i == 0: > > > print 'First

  1   2   >