Re: A Unicode problem -HELP

2006-05-17 Thread Martin v. Löwis
manstey wrote: > Thanks very much. Your def comma_separated_utf8(items): approach raises > an exception in codecs.py, so I tried = u", ".join(word_info + parse + > gloss), which works perfectly. So I want to understand exactly why this > works. word_info and parse and gloss are all tuples. does st

Re: Process forking on Windows - or what is MQSeries

2006-05-17 Thread Andrew Robert
Gary Herron wrote: > Andrew Robert wrote: > > > The windows CreateProcess call has many of the same semantics as the > Unix fork, i.e., a new process is created sharing all the resources of > the original process. The "subprocess" modules uses CreateProcess, but > if that does not give you suf

Re: Proposal for new operators to python that add syntactic sugar for hierarcical data.

2006-05-17 Thread Ben Finney
"glomde" <[EMAIL PROTECTED]> writes: > With element tree package. > > # build a tree structure > root = ET.Element("html") > head = ET.SubElement(root, "head") > title = ET.SubElement(head, "title") > title.text = "Page Title" > body = ET.SubElement(root, "body") > body.set("bgcolor

Re: Tabs versus Spaces in Source Code

2006-05-17 Thread Edmond Dantes
Oliver Bandel wrote: > [EMAIL PROTECTED] opalinski from opalpaweb wrote: ... > Yes, as I started programming I also preferred tabs. > And with growing experience on how to handle this in true life > (different editors/systems/languages...) I saw, that > converting the "so fine tabs" was annoying.

Re: How to tell if function was passed a list or a string?

2006-05-17 Thread Ben Finney
"rh0dium" <[EMAIL PROTECTED]> writes: > I want this function to be smart enough to tell if it's a list and > do the funky concatonation otherwise don't. Bad code smell. Don't try to be too clever with the data types passed to you; instead, operate on them as though the caller has passed the right

excel centering columns

2006-05-17 Thread Lance Hoffmeyer
Hey all, Having problems centering a column Can someone explain how to center a column using python? import win32com.client import re import codecs import win32com.client.dynamic import time import datetime from win32com.client.dynamic import Dispatch from win32com.client import constants t2

Re: python vs perl lines of code

2006-05-17 Thread Michael Tobis
"The plural of anecdote is not data." It's a pithy quote, but it isn't QOTW in my book, simply because it isn't true in general. Talk to some paleoclimatologists. There is no way to get uniform measures of ancient climate. What should we do then? Should we ignore the information we have? Are the

Re: How to tell if function was passed a list or a string?

2006-05-17 Thread Roy Smith
Ben Finney <[EMAIL PROTECTED]> wrote: > Currently there's no good duck-typing way to differentiate > strings from other sequences. I suppose you could do something like: try: foo.isalpha except AttributeError: print "foo is not a string" but other than proving that you don't *have* to use

Re: Tabs are EVIL *and* STUPID, end of discussion. (Re: Tabs versus Spaces in Source Code)

2006-05-17 Thread William Studenmund
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On May 17, 2006, at 8:46 PM, Edward Elliott wrote: > Dave Hansen wrote: > >> On Wed, 17 May 2006 17:28:26 GMT in comp.lang.python, Edward Elliott >>> Just for the sake of completeness: >>> >>> cat file |sed 's/\t//g' >> >> That doesn't always work

Re: Tabs versus Spaces in Source Code ('semantic' vs. arbitrary indentation)

2006-05-17 Thread achates
Carl J. Van Arsdall wrote: > The converse can also be said, "it's difficult to make sure everyone > uses spaces and not tabs". > > I think we've just about beat this discussion to death... nice work > everyone! Yeah - we've got to the repeating ourselves stage. But that's the problem with this i

RE: Test professionalism (was: count items in generator)

2006-05-17 Thread Delaney, Timothy (Tim)
Cameron Laird wrote: > Gulp. OK, you've got me curious: how many people habitually frame > their unit tests with resource constraints? I think I take testing > seriously, and certainly also am involved with resource limits often, > but I confess I've never aimed to write all my tests in terms o

Re: Pyparsing: Specify grammar at run time

2006-05-17 Thread Paul McGuire
"Khoa Nguyen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I run into another issue with my grammar: My input record contains a common part and an extended part. Based on the value of the common part, the extended part will be different. So, I am thinking of parsing the common part

Re: How to tell if function was passed a list or a string?

2006-05-17 Thread trebucket
>>> import types >>> type("") is types.ListType False >>> type("") is types.StringType True >>> type([]) is types.StringType False >>> type([]) is types.ListType True -- http://mail.python.org/mailman/listinfo/python-list

Re: Pyparsing: Specify grammar at run time

2006-05-17 Thread Paul McGuire
"Khoa Nguyen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I run into another issue with my grammar: My input record contains a common part and an extended part. Based on the value of the common part, the extended part will be different. So, I am thinking of parsing the common part

Re: How to tell if function was passed a list or a string?

2006-05-17 Thread Ben Finney
Roy Smith <[EMAIL PROTECTED]> writes: > Ben Finney <[EMAIL PROTECTED]> wrote: > > Currently there's no good duck-typing way to differentiate strings > > from other sequences. > > I suppose you could do something like: > > try: >foo.isalpha > except AttributeError: >print "foo is not a st

Re: excel centering columns

2006-05-17 Thread John Machin
> from win32com.client import constants > sh2.Columns(lastcol).HorizontalAlignment = constant.xlCenter > NameError: name 'constant' is not defined 1. So why not try reading the error message and fixing the problem instead of thrashing about madly? 2. You have run makepy on your Excel library, hav

Re: Tabs are EVIL *and* STUPID, end of discussion. (Re: Tabs versus Spaces in Source Code)

2006-05-17 Thread Terry Hancock
Edward Elliott wrote: >Dave Hansen wrote: > > >I fail to see why less 'will work' but cat 'doesn't always work'. > The distinction is not in the choice of program, but in the way it is being used... >The net >effect of both is the same. Unless you're in some weird place that pipes >aren't al

Re: python vs perl lines of code

2006-05-17 Thread Ben Finney
"Michael Tobis" <[EMAIL PROTECTED]> writes: > "The plural of anecdote is not data." > > It's a pithy quote, but it isn't QOTW in my book, simply because it > isn't true in general. Talk to some paleoclimatologists. > > There is no way to get uniform measures of ancient climate. What > should we

Re: python vs perl lines of code

2006-05-17 Thread Edward Elliott
brian d foy wrote: > You have to note that rewriting a program, even in the same language, > tends to make it shorter, too. These things are measures of programmer > skill, not the usefulness or merit of a particular language. I completely agree. But you have to start somewhere. > Shorter doe

Re: How to tell if function was passed a list or a string?

2006-05-17 Thread Ben Finney
[EMAIL PROTECTED] writes: > >>> import types > >>> type("") is types.ListType > False > >>> type("") is types.StringType > True > >>> type([]) is types.StringType > False > >>> type([]) is types.ListType > True This is even worse than an 'isinstance' check; it refuses even subclasses of the types

Re: python vs perl lines of code

2006-05-17 Thread Edward Elliott
achates wrote: > It probably says something about your coding style, particularly in > perl. I've found (anecdotally of course) that while perl is potentially > the more economical language, writing *legible* perl takes a lot more > space. I'm sure it does. My perl (from 5 years ago) may be cons

Re: python vs perl lines of code

2006-05-17 Thread John Bokma
Edward Elliott <[EMAIL PROTECTED]> wrote: > But again, the interesting thing to me isn't what could one do, it's > what are people actually doing in the real world? In that case: there is probably more Perl out there that makes us cry compared to Python :-D. -- John Bokma Freelance so

Re: python vs perl lines of code

2006-05-17 Thread Edward Elliott
Adam Jones wrote: > Without any more information I would say the biggest contributor to > this dissimilarity is your experience. Having spent an additional five > years writing code you probably are better now at programming than you > were then. I am fairly confident that if you were to take anot

Re: Tabs are EVIL *and* STUPID, end of discussion. (Re: Tabs versus Spaces in Source Code)

2006-05-17 Thread Edward Elliott
William Studenmund wrote: > The problem is that tabs take you to the next tab stop, they don't > expand to a fixed number of spaces. Got it. You're talking about using tabs other than for initial line indentation on a source file. Yes, then tab expansion is not perfect. -- Edward Elliott UC B

Re: Tabs are EVIL *and* STUPID, end of discussion. (Re: Tabs versus Spaces in Source Code)

2006-05-17 Thread Edward Elliott
Terry Hancock wrote: > Now, of course, the data I provide is nasty, mean, poorly-formatted > data, abhorable by space-zealots and tab-libertines alike (;-)), but the > point is, unless you have set up your editor to syntax color spaces > and tabs differently, you won't see the difference in the or

Re: Tabs versus Spaces in Source Code

2006-05-17 Thread Terry Hancock
Edmond Dantes wrote: >The real issue is, of course, that ASCII is showing its age and we should >probably supplant it with something better. But I know that will never fly, >given the torrents of code, configuration files, and everything else in >ASCII. Even Unicode couldn't put a dent in it, desp

Re: Tabs versus Spaces in Source Code ('semantic' vs. arbitrary indentation)

2006-05-17 Thread Dave Hansen
On 17 May 2006 16:13:54 -0700 in comp.lang.python, "achates" <[EMAIL PROTECTED]> wrote: >Carl J. Van Arsdall wrote: > >> The converse can also be said, "it's difficult to make sure everyone >> uses spaces and not tabs". >> >> I think we've just about beat this discussion to death... nice work >> e

Re: Proposal for new operators to python that add syntactic sugar for hierarcical data.

2006-05-17 Thread Scott David Daniels
glomde wrote: > i I would like to extend python so that you could create hiercical > tree structures (XML, HTML etc) easier ... > With syntactical sugar: > > # build a tree structure > root = ET.Element("html") > *!*root: > *!*head("head"): > *!*title("title): > *

Re: I'm just not cut out for web programming, I guess :)

2006-05-17 Thread John Salerno
Paul McNett wrote: > Are you sure the python that the web server runs has the cryptogen > module available? Yes, this module and the cryptogen module (and the quotes.txt file) are all in the same directory on the server. > Have you set the execute bit on your script? Yes, I have them both s

ANN: NumPy 0.9.8 released

2006-05-17 Thread Travis E. Oliphant
NumPy 0.9.8 has been released. It can be downloaded from http://numeric.scipy.org The release notes are attached. Best regards, -Travis Oliphant NumPy 0.9.8 is a bug-fix and optimization release with a few new features. The C-API was changed so that extensions compiled against

Re: Tabs versus Spaces in Source Code ('semantic' vs. arbitrary indentation)

2006-05-17 Thread Edward Elliott
We've finally hit the meta-discussion point. Instead of talking about tabs and spaces, we're talking about talking about tabs and spaces. Which frankly is a much more interesting conversation anyway. achates wrote: > Does it matter? Perhaps not if we can use tools which enable us to > bridge th

Re: python vs perl lines of code

2006-05-17 Thread Edward Elliott
Michael Tobis wrote: > Edward also asked if others had similar experiences. If others did, the > assemblage of their opinions would in fact consttitute data. I have no > idea why people are giving him such grief over this request. Thank you, Michael. It was starting to feel like I'd asked about

Re: python vs perl lines of code

2006-05-17 Thread Edward Elliott
Ben Finney wrote: > Those samples can be independently verified by any skilled observer at > another time. This is what distinguishes them from anecdotes, and > breaks your analogy. Anyone who has my source files can run the same tests. The measures are repeatable and reliable, even if at the mo

Re: python vs perl lines of code

2006-05-17 Thread Ben Finney
Edward Elliott <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > > Those samples can be independently verified by any skilled > > observer at another time. This is what distinguishes them from > > anecdotes, and breaks your analogy. > > Anyone who has my source files can run the same tests. W

Re: creating a new database with mysqldb

2006-05-17 Thread Jesse Hager
John Salerno wrote: > Since the connect method of mysqldb requires a database name, it seems > like you can't use it without having a database already created. So is > there a way to connect to your mysql server (without a specified > database) in order to create a new database (i.e., the CREATE DA

Re: excel centering columns

2006-05-17 Thread Lance Hoffmeyer
I did read the error message. I did not understand why 'constant' was not defined. In perl I did not have to run anything like 'makepy' to get constants to work. And no, I don't want to go back to perl. Python appears to integrate with packages more readily than perl does. I was unaware of 'ma

MySQLdb - parameterised SQL - how to see resulting SQL ?

2006-05-17 Thread shearichard
Hi - I've got SQL that looks like this ... cursor = self.MySQLDb_conn.cursor(cursorclass=MySQLdb.cursors.DictCursor) sqlQuery = "SELECT * FROM T1 WHERE C1 = %s and C2 = %s" sql = cursor.execute(sqlQuery,(strURLAlias,strSessionID)) rows = cursor.fetchall() cursor.close ... i would be interested in

Re: CGI errror in (only in) IIS 6.0 server 2003

2006-05-17 Thread net4xbox360
You have to enable the correct web extensions. Whatever you do, do not ever enable all as that is a huge security risk. I'll be adding a "how-to" for enabling it for IIS 5.1 which runs on windows xp. I put together a tutorial here: http://python.markrowsoft.com/iiswse.asp <[EMAIL PROTECTED]>

Re: excel centering columns

2006-05-17 Thread Ben Finney
Lance Hoffmeyer <[EMAIL PROTECTED]> writes: > import win32com.client > import re > import codecs > import win32com.client.dynamic > import time > import datetime > from win32com.client.dynamic import Dispatch > from win32com.client import constants These statements create code objects (some of th

Re: ANN: NumPy 0.9.8 released

2006-05-17 Thread David M. Cooke
"Travis E. Oliphant" <[EMAIL PROTECTED]> writes: > NumPy 0.9.8 has been released. It can be downloaded from > > http://numeric.scipy.org > > The release notes are attached. > > Best regards, > > -Travis Oliphant > NumPy 0.9.8 is a bug-fix and optimization release with a > few new features. T

Re: python vs perl lines of code

2006-05-17 Thread Edward Elliott
Ben Finney wrote: > I responded to a post that seemed to claim that anecdotes about events > can be treated as data about events. They can't; that's what I'm > arguing. And conveniently ignoring the key part of my post. Here it is again for those who missed it: "Before the days of cheap video,

Re: MySQLdb - parameterised SQL - how to see resulting SQL ?

2006-05-17 Thread Dan Sommers
On 17 May 2006 18:41:55 -0700, [EMAIL PROTECTED] wrote: > Hi - I've got SQL that looks like this ... > cursor = > self.MySQLDb_conn.cursor(cursorclass=MySQLdb.cursors.DictCursor) > sqlQuery = "SELECT * FROM T1 WHERE C1 = %s and C2 = %s" > sql = cursor.execute(sqlQuery,(strURLAlias,strSessionID)) >

Re: python vs perl lines of code

2006-05-17 Thread Ben Finney
Edward Elliott <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > > I responded to a post that seemed to claim that anecdotes about events > > can be treated as data about events. They can't; that's what I'm > > arguing. > > And conveniently ignoring the key part of my post. Here it is again f

Re: MySQLdb - parameterised SQL - how to see resulting SQL ?

2006-05-17 Thread Ben Finney
[EMAIL PROTECTED] writes: > ... i would be interested in seeing what the actual SQL used by the > .execute looks like after the replacements have been done. Is there a > way of doing this ? I also think this would be a very useful feature for enabling logging, debugging, and other introspection.

Re: I'm just not cut out for web programming, I guess :)

2006-05-17 Thread John Salerno
John Salerno wrote: > Paul McNett wrote: > >> Are you sure the python that the web server runs has the cryptogen >> module available? > > Yes, this module and the cryptogen module (and the quotes.txt file) are > all in the same directory on the server. > >> Have you set the execute bit on you

Re: creating a new database with mysqldb

2006-05-17 Thread John Salerno
Jesse Hager wrote: > In every MySQL library I have ever seen, the database parameter is > optional. You may either omit it or pass an empty string. It is just a > shortcut so the application does not need to send a "USE" command to > select the active database. I tried it without the db paramet

Re: Tabs versus Spaces in Source Code

2006-05-17 Thread Jorge Godoy
achates wrote: > Jorge Godoy wrote > >>Emacs guess what's used in the file and allows me to use tabs all the >>time, doing the correct thing... > > That sounds like useful behaviour. > > Maybe this is an area where modern editors might be able to save us > from ourselves. I'll admit I'm suspici

Re: I'm just not cut out for web programming, I guess :)

2006-05-17 Thread John Salerno
John Salerno wrote: > Ok, I've tinkered with this thing for a while, and I keep fixing little > problems, but I always get a 500 Internal Server error when I go to this > site: Ok, in case anyone is curious, I figure out my problems. Let me first give you a hint: my web server is running Python

getting the value of an attribute from pdb

2006-05-17 Thread Gary Wessle
Hi how can I "using pdb" get a value of an attribute?, read the docs and played around with pdb 'p' for no avail. thanks class main: def __init__(self, master): self.master = master self.master.title('parent') self.master.geometry('200x150+300+225') ... root = Tk() ***

how to make the program notify me explicitly

2006-05-17 Thread hankssong
Hi everyone, I'm writing a program that can retrieve some specified info from a web page, such as python topics I interested on a bbs. Now I had written the python script (run in the background), but I don't know how to make the program notify me explicitly, so I can be easily informed. I don't kn

Re: I'm just not cut out for web programming, I guess :)

2006-05-17 Thread Ben Finney
John Salerno <[EMAIL PROTECTED]> writes: > So the bottom line is I'm kind of screwed until I can get 1and1 to > update their Python! :) But at least I figured out some stuff. You should also look around for other hosting options. A web hosting provider that doesn't give access to server logs isn

Re: how to make the program notify me explicitly

2006-05-17 Thread Ben Finney
"hankssong" <[EMAIL PROTECTED]> writes: > Now I had written the python script (run in the background), but I > don't know how to make the program notify me explicitly, so I can be > easily informed. What methods are available? Designing your daemon involves figuring out how it will communicate w

Re: MySQLdb - parameterised SQL - how to see resulting SQL ?

2006-05-17 Thread Damjan
> ... i would be interested in seeing what the actual SQL used by the > .execute looks like after the replacements have been done. Is there a > way of doing this ? On my development machine I'm using the "--log" argument to MySQL so that it logs all queries and connections. I wouldn't recommend th

Re: excel centering columns

2006-05-17 Thread Lance Hoffmeyer
Once I imported the EXCEL 10.0 library using 'makepy utility' everything worked fine. And, yes, my typing mistake. Should have been 'constants' and not 'constant' Lance -- http://mail.python.org/mailman/listinfo/python-list

Re: creating a new database with mysqldb

2006-05-17 Thread BartlebyScrivener
I was hoping you'd find this earlier when I suggested that you type: creating a new database with MySQL into google. It's the number one hit: http://coronet.iicm.edu/mysql/create.html If you send the commands listed there via the commandline or through MySQLdb you should be in business. -- h

Re: Possible constant assignment operators ":=" and "::=" for Python

2006-05-17 Thread Steve Holden
Piet van Oostrum wrote: >>Edward Elliott <[EMAIL PROTECTED]> (EE) wrote: > > >>EE> Piet van Oostrum wrote: >> >[EMAIL PROTECTED] (T) wrote: >>T> As you can see, the "constant" A can be modified this easily. But if >>T> there were an intuitive mechanism to declare a symbol to be i

Re: where do you run database scripts/where are DBs 'located'?

2006-05-17 Thread Steve Holden
NoNickName wrote: > Gerard Flanagan wrote: > > >>Interactive SQL tutorial: http://www.sqlcourse.com/ ; >>http://sqlcourse2.com/ >> >>Indirectly helpful maybe: >>http://initd.org/tracker/pysqlite/wiki/basicintro >> >>HTH >> >>Gerard > > > There's also the TechBookReport SQL tutorial - which is

Re: Large Dictionaries

2006-05-17 Thread Chris Foote
Richie Hindle wrote: > [Chris] >> Has anyone written a fast hash module which is more optimal for >> large datasets ? > > PyJudy might be what you're looking for, though I've never used it: > > http://www.dalkescientific.com/Python/PyJudy.html > > "Judy's key benefits are scalability, high per

Re: Tabs versus Spaces in Source Code

2006-05-17 Thread ashesh
If I work on your project, I follow the coding and style standards you specify. Likewise if you work on my project you follow the established standards. Fortunately for you, I am fairly liberal on such matters. I like to see 4 spaces for indentation. If you use tabs, that's what I will see

Re: Large Dictionaries

2006-05-17 Thread Chris Foote
Claudio Grondi wrote: > Chris Foote wrote: >> Klaas wrote: >> 22.2s 20m25s[3] >>> >>> 20m to insert 1m keys? You are doing something wrong. >> >> I've put together some simplified test code, but the bsddb >> module gives 11m for 1M keys: >> > I have run your code for the bsddb on my P4 2.8 G

Reference Counts

2006-05-17 Thread raghu
Hi All, I am a new user of Python and am having a bit of problem understanding the Reference counting and memory leakage issues. Requesting help from experienced users I wrote the following simple program. #!/usr/bin/python import sys global a print "Total Reference count at the start ="

Re: Reference Counts

2006-05-17 Thread Heiko Wundram
Am Donnerstag 18 Mai 2006 08:28 schrieb raghu: > #!/usr/bin/python > > import sys > global a > > print "Total Reference count at the start =",sys.gettotalrefcount() > a=1 > print "a ref count =",sys.getrefcount(a) > b=a > print "a ref count =",sys.getrefcount(a) > > del a > del b > > print "Total R

Re: Proposal for new operators to python that add syntactic sugar for hierarcical data.

2006-05-17 Thread glomde
There are some difference which are quite essential. First of all I dont se how you set attributes with that and then I dont see how you can mix python code with the creation. So how do you do this: root = ET.Element("html") *!*root: *!*head("head"): *!*title("title): fo

Python - Web Display Technology

2006-05-17 Thread SamFeltus
I am trying to figure out why so little web development in Python uses Flash as a display technology. It seems most Python applications choose HTML/CSS/JS as the display technology, yet Flash is a far more powerful and elegant display technology. On the other hand, HTML/JS seems clunky and antiqu

<    1   2   3