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

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

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

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: 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

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
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: 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: 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: 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: 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: 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: 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: 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

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

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() ***

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

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: 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: 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: 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: 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 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 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: 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: 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: 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]>

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: 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

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: 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: 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 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: 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

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: 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

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: 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: 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 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 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: 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: 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
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: 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
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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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

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: 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

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: 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: 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: 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: Tabs versus Spaces in Source Code ('semantic' vs. arbitrary indentation)

2006-05-17 Thread Carl J. Van Arsdall
glomde wrote: >> > > But If you work in a team it is kind of hard to make sure that > everybody use tabs and not spaces. And it is not very easy to spot > either. > The converse can also be said, "it's difficult to make sure everyone uses spaces and not tabs". I think we've just about be

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

2006-05-17 Thread Diez B. Roggisch
glomde schrieb: > i I would like to extend python so that you could create hiercical > tree structures (XML, HTML etc) easier and that resulting code would be > more readable than how you write today with packages like elementtree > and xist. > I dont want to replace the packages but the packages c

Re: [silly] Does the python mascot have a name ?

2006-05-17 Thread John Bokma
John D Salt wrote: > Andy Sy <[EMAIL PROTECTED]> wrote in > news:[EMAIL PROTECTED]: > >> http://mail.python.org/pipermail/python-list/2003-September/185612.html > > "Odi" must be the Dutch for "Monty". Nope. If it was Dutch it would probably be Odie -- John Mex

Re: Time to bundle PythonWin

2006-05-17 Thread John Bokma
"Tim N. van der Leeuw" <[EMAIL PROTECTED]> wrote: > > John Bokma wrote: >> "Robert Hicks" <[EMAIL PROTECTED]> wrote: >> >> > No it isn't. >> >> Learn to quote when you use Google's Usenet garbage. >> > > I don't know why you consider it 'garbage', How many people use GG without quoting, annoyin

Re: python vs perl lines of code

2006-05-17 Thread John Bokma
Edward Elliott <[EMAIL PROTECTED]> wrote: > John Bokma wrote: > >> Edward Elliott <[EMAIL PROTECTED]> wrote: >>> Evaluating my experiences yes, relating your own no. >> >> What would the point be? Most important to me would be: am I happy >> with the result? And that rarely has to do with the nu

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

2006-05-17 Thread George Sakkis
glomde wrote: > i I would like to extend python so that you could create hiercical > tree structures (XML, HTML etc) easier and that resulting code would be > more readable than how you write today with packages like elementtree > and xist. Given that python doesn't have syntactic sugar for somet

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

2006-05-17 Thread Roy Smith
In article <[EMAIL PROTECTED]>, "rh0dium" <[EMAIL PROTECTED]> wrote: > The question is how do you tell that the data you were passed is a list > or not? >>> x = [] >>> isinstance (x, list) True -- http://mail.python.org/mailman/listinfo/python-list

Pyparsing: Specify grammar at run time

2006-05-17 Thread Khoa Nguyen
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 first and check the common's value and then parse again for the rest of th

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

2006-05-17 Thread Paul McNett
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: > > I don't necessarily even want help just yet, I'd like to figure it out > myself, but can someone at least tell me

Re: constucting a lookup table

2006-05-17 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > BTW, just for kicks to compare languages, how would one implement the > same "lookup" table using C/C++? It would be a good lesson in high > level vs. lower level programming > Something vaguely like: unsigned char hwdict[89 - 60][401 - 80]; int setsize(int height

Re: How to add columns to python arrays

2006-05-17 Thread Michael Spencer
Terry Reedy wrote: > "Michael Spencer" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> If you're just looking for a multi-dimensional array type, and don't need >> maximum speed or the vast range of array-processing that numpy offers, >> then >> *pyarray* provides a pure-python s

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

2006-05-17 Thread glomde
i I would like to extend python so that you could create hiercical tree structures (XML, HTML etc) easier and that resulting code would be more readable than how you write today with packages like elementtree and xist. I dont want to replace the packages but the packages could be used with the new

Re: python vs perl lines of code

2006-05-17 Thread brian d foy
In article <[EMAIL PROTECTED]>, Edward Elliott <[EMAIL PROTECTED]> wrote: > This is just anecdotal, but I still find it interesting. Take it for what > it's worth. I'm interested in hearing others' perspectives, just please > don't turn this into a pissing contest. > > I'm in the process of con

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

2006-05-17 Thread rh0dium
Hi All, I have the nice little function (below) which used to work great assuming the data[key] passed to it was a list. Well now I want to update this a bit. I want this function to be smart enough to tell if it's a list and do the funky concatonation otherwise don't. def insert(self, table

Re: python vs perl lines of code

2006-05-17 Thread Adam Jones
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 another crack at these same pro

Re: python vs perl lines of code

2006-05-17 Thread achates
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. -- http://mail.python.org/mailman/listinfo/python-list

Re: IDLE confusion

2006-05-17 Thread Scott David Daniels
Christophe wrote: > Terry Reedy a écrit : >> "Christophe" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> >>> Try in the IDLE menu [Shell] "Restart Shell" (Ctrl+F6) each time you >>> have changed something in your files - this "resets" anything previously >>> imported, which stay

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

2006-05-17 Thread Dan M
On Wed, 17 May 2006 20:51:07 +, 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: > > I don't necessarily even want help just yet, I'd like to figure it out > myse

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

2006-05-17 Thread glomde
> But generally, I don't do layout like that. I'd do: > >--->cursor.execute( >--->--->--->'select id, item, amount, field4, >--->--->--->'from table1 where amount>100' >--->) > >Which keeps looking fine, no matter what tab size, and without mixing >tabs and spaces. > Which only wor

Re: Question about exausted iterators

2006-05-17 Thread George Sakkis
Christophe wrote: > Is there a good reason why when you try to take an element from an > already exausted iterator, it throws StopIteration instead of some other > exception ? I've lost quite some times already because I was using a lot > of iterators and I forgot that that specific function param

Re: python vs perl lines of code

2006-05-17 Thread Aahz
In article <[EMAIL PROTECTED]>, Edward Elliott <[EMAIL PROTECTED]> wrote: > >Fair enough, but advocacy isn't at all what I'm after. Anecdotes are fine, >after all what is data but a collection of anecdotes? :) "The plural of anecdote is not data." -- Aahz ([EMAIL PROTECTED]) <*>

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

2006-05-17 Thread John Salerno
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: I don't necessarily even want help just yet, I'd like to figure it out myself, but can someone at least tell me why I'm not getting helpful fee

Re: creating a new database with mysqldb

2006-05-17 Thread Lou Losee
On 5/17/06, Philippe Martin <[EMAIL PROTECTED]> wrote: 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

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

2006-05-17 Thread Edward Elliott
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. If you don't see why, you don't understand > my objection to TAB characters in text files. > >>less -x4 fi

Re: Python script windows servcie

2006-05-17 Thread Mivabe
Serge Orlov submitted this idea : > Mivabe wrote: >> >> No-one who can help me or did i visit the wrong group for this >> 'problem'? > > Indeed. Next time you'd better ask in a windows specific list: Ke, thnx :-) -- No line here today Posted by news://news.nb.nu -- http://mail.python.or

Re: creating a new database with mysqldb

2006-05-17 Thread John Salerno
BartlebyScrivener wrote: > I would learn basic, commandline SQL first and get comfortable creating > tables, querying your dbs etc. THEN, add Python. Otherwise you spin > your wheels not knowing whether it's your use of the Python modules or > your bad SQL commands that are fouling things up. > >

Re: creating a new database with mysqldb

2006-05-17 Thread John Salerno
Heiko Wundram wrote: > Of course, you need to log on with a user who is allowed to create databases. yeah, this is where I'm stuck. The only "logging on" i know how to do is with the connect method, but that requires a database to exist already -- http://mail.python.org/mailman/listinfo/python-

gettext errors with wxPython in linux

2006-05-17 Thread ianaré
given the foolowing code: import gettext gettext.install('messages', './locale', unicode=0) def __init__(self, parent): # initialise preferences self.prefs = self.getPrefs() # initialise language: language = self.prefs['language='] langdir = self.rea

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

2006-05-17 Thread Sybren Stuvel
Dave Hansen enlightened us with: > Assume the code was written by someone using 4-space tabs. To them, > the code is: > >def sqlcall(): >--->cursor.execute('select id, item, amount, field4, >--->--->--->--->...'from table1 where amount>100') > > (where ---> represents an 4-space t

Re: Python-list Digest, Vol 32, Issue 300

2006-05-17 Thread Khoa Nguyen
> Optional(f1SpecificFormat) + "," + Optional(f2SpecificFormat) + "," + ... > and so on. Thanks for your input again. This is exactly what I am trying. The only thing is it can get ugly if the number of fields are many -- I have about 61 fields right now. Just wondering if there is a "cleaner" a

Re: creating a new database with mysqldb

2006-05-17 Thread BartlebyScrivener
I would learn basic, commandline SQL first and get comfortable creating tables, querying your dbs etc. THEN, add Python. Otherwise you spin your wheels not knowing whether it's your use of the Python modules or your bad SQL commands that are fouling things up. http://sqlcourse.com/intro.html or I

Re: How to add columns to python arrays

2006-05-17 Thread Terry Reedy
"Michael Spencer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If you're just looking for a multi-dimensional array type, and don't need > maximum speed or the vast range of array-processing that numpy offers, > then > *pyarray* provides a pure-python single module solution. > >

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

2006-05-17 Thread achates
Dave Hansen wrote: >However, to twist an observation I've read about C++, while it's >clearly possible to use TABs in a sensible manner like this, it seems >that no one does. I think it's evident from this thread that quite a few people do that, judging by the fact that my previous post explaining

Re: creating a new database with mysqldb

2006-05-17 Thread Philippe Martin
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 D

Re: creating a new database with mysqldb

2006-05-17 Thread Heiko Wundram
Am Mittwoch 17 Mai 2006 21:23 schrieb John Salerno: > Well, the thing about it is that all the guides I find online seem to > begin with using a command prompt or a unix shell, neither of which will > work in my case. I'm trying to find a way to access my database server > using just a python scrip

Re: Large Dictionaries

2006-05-17 Thread Claudio Grondi
Chris Foote wrote: > Klaas wrote: > >>> 22.2s 20m25s[3] >> >> >> 20m to insert 1m keys? You are doing something wrong. > > > Hi Mike. > > 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 GHz and have

  1   2   3   >