Re: Text widget updates only after calling method exits (threading issue?)

2007-12-12 Thread Marc 'BlackJack' Rintsch
On Tue, 11 Dec 2007 17:58:37 -0800, mariox19 wrote: > If I am supposed to send messages to Tkinter objects only from the > main thread, how can I get the letters to appear 1 per second? Take a look at the `after()` method on widgets. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.

xmlrpclib.binary to a file doubt

2007-12-12 Thread Jose Ignacio Gisbert
Hi all, I have a problem in my application which uses xml-rpc methods. From one hand I can send a file to a server doing f=open(Myfile,'rb') g=f.read() name=(f.name).split("/") name=name[len(name)-1] calltosendmethod(xmlrpclib.Binary(g),name) And it works fine. But on the other han

Re: Is anyone happy with csv module?

2007-12-12 Thread Marc 'BlackJack' Rintsch
On Tue, 11 Dec 2007 20:08:21 -0300, Gabriel Genellina wrote: > data = [row for row in csv.reader(..)] A bit shorter:: data = list(csv.reader(..)) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

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

2007-12-12 Thread George Sakkis
On Dec 12, 2:18 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On Dec 12, 7:34 am, sturlamolden <[EMAIL PROTECTED]> wrote: > > I am not sure why a new type annotation syntax was needed Python 3: > > Because people care about a feature when there is @syntax. Good point; the inverse is not true thou

Re: Text widget updates only after calling method exits (threading issue?)

2007-12-12 Thread Eric Brunel
On Wed, 12 Dec 2007 02:58:37 +0100, mariox19 <[EMAIL PROTECTED]> wrote: > Are Tkinter widgets running on their own thread? No. And usually, GUI toolkits and threads don't mix well... > If I try to make a simple application that will print the letters A to > Z to a Tkinter Text widget, and I spac

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

2007-12-12 Thread Kay Schluehr
On Dec 12, 9:04 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Dec 12, 2:18 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > On Dec 12, 7:34 am, sturlamolden <[EMAIL PROTECTED]> wrote: > > > I am not sure why a new type annotation syntax was needed Python 3: > > > Because people care about a fe

Re: ANN: UliPad 3.8.1 released!

2007-12-12 Thread Gary Herron
limodou wrote: > Bug fix verion. > >1. Remove profile invoke(big mistake) >2. Fix svn plugin checkout bug > > Download: > http://ulipad.googlecode.com/files/ulipad.3.8.1.zip > http://ulipad.googlecode.com/files/ulipad.3.8.1.exe > Can you please take the time, when making such an announc

Re: Help needed with python unicode cgi-bin script

2007-12-12 Thread Duncan Booth
"weheh" <[EMAIL PROTECTED]> wrote: > John and Martin, > > Thanks for your help. However, I have identified the culprit to be > with Apache and the command: > AddDefaultCharset utf-8 > which forces my browser to utf-8 encoding. > > It looks like your suggestions to change charset were incorre

Re: new style class

2007-12-12 Thread Bruce Coram
Steven Regrettably I have to reply to your post because it misses the point of my initial post completely. I suggested that Eric Raymond's advice provided cover for people who were rude, hostile or arrogant. There are two obvious responses: his advice does not provide such cover or it does

Re: Is anyone happy with csv module?

2007-12-12 Thread massimo s.
Thanks to everyone in this thread. As always on this newsgroup, I learned very much. I'm also quite embarrassed of my ignorance. Only excuse I have is that I learned programming and Python by myself, with no formal (or informal) education in programming. So, I am often clumsy. On Dec 12, 1:29 am,

Re: ANN: UliPad 3.8.1 released!

2007-12-12 Thread limodou
Please visit the site: http://code.google.com/p/ulipad I'm sorry forgot that. -- I like python! UliPad <>: http://code.google.com/p/ulipad/ meide <>: http://code.google.com/p/meide/ My Blog: http://www.donews.net/limodou -- http://mail.python.org/mailman/listinfo/python-list

Re: "do" as a keyword

2007-12-12 Thread Brian Blais
On Dec 11, 2007, at Dec 11:11:11 PM, Terry Reedy wrote: "Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] || | But loops that run at least once is a basic element of algorithms. | Perhaps not as common as the zero or more times of the while loop, but | still fu

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

2007-12-12 Thread Carl Friedrich Bolz
sturlamolden wrote: > On 11 Des, 20:25, John Nagle <[EMAIL PROTECTED]> wrote: > >> Shed Skin effort. Its author writes "Am I the only one seeing the potential >> of an implicitly statically typed Python-like-language that runs at >> practically the same speed as C++?" > > Don't forget about Pyrex

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

2007-12-12 Thread Nicola Larosa (tekNico)
sturlamolden wrote: > def fibo(n): > while 1: > try: > return fibo.seq[n] > except AttributeError: > fibo.seq = [0, 1, 1] > except IndexError: > fibo.seq.append( fibo.seq[-2] + fibo.seq[-1] ) I really like this formulation. However, i

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

2007-12-12 Thread George Sakkis
On Dec 12, 4:09 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > Curiously, whenever property syntax is discussed the > discussion loses track and is dragged away by needless side > discussions. Just look at Stephen Bethards withdrawn PEP 359 [1] in > which he finally muses about replacing the class

Re: Counter-spam: Change the subject

2007-12-12 Thread Paul Boddie
On Dec 12, 5:17 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > > As far as I know, that is unusual behavior. In Outlook Express and, I > believe, other readers I have used, the original subject is the one > displayed. And if I have already downloaded the original title and marked > the post as re

Re: "do" as a keyword

2007-12-12 Thread Antoon Pardon
On 2007-12-12, Terry Reedy <[EMAIL PROTECTED]> wrote: > > "Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >|| >| But loops that run at least once is a basic element of algorithms. >| Perhaps not as common as the zero or more times of the while loop, but >| still fun

Re: Python Class Best Practice

2007-12-12 Thread MarkE
On 4 Dec, 23:18, Rod Person <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > I've been doing python programming for about 2 years as a hobby and now > I'm finally able to use it at work in an enterprise environment. Since > I will be creating the base classes and lib

2008 computer new lang-python

2007-12-12 Thread ashik
thia is new ode adbbfy hsadhj http://www.freewebs.com/thuiss/ http://indianfriendfinder.com/go/g906725-pmem -- http://mail.python.org/mailman/listinfo/python-list

Re: Why does producer delay halt shell pipe?

2007-12-12 Thread dwhall
Thanks, N, it works like a charm. !!Dean On Dec 11, 12:49 pm, Nanjundi <[EMAIL PROTECTED]> wrote: > turn off python buffering & it should work. > export PYTHONUNBUFFERED=t -- http://mail.python.org/mailman/listinfo/python-list

psycopg

2007-12-12 Thread sujitha mary
hi all, while executing this cur.execute('insert into seq(id,sequence) values(3,'+content+')') i'm getting an error psycopg2.ProgrammingError: syntax error at or near "prophage" LINE 1: insert into seq(id,sequence) values(3,Tum2 prophage complete... -- http://mail.python.org/mailman/listinfo/pyth

Re:

2007-12-12 Thread Lee Capps
On Dec 11, 2007, at 5:14 PM, katie smith wrote: > "[16, 16, 2, 16, 2, 16, 8, 16]" Regular expressions might be a good way to handle this. import re s = '[16, 16, 2, 16, 2, 16, 8, 16]' get_numbers = re.compile('\d\d*').findall numbers = [int(x) for x in get_numbers(s)] See: http://docs.pytho

gnome/nautilus extensions ?

2007-12-12 Thread manatlan
Hello I'd like to create a new "nautilus extension" in python. I'd like to make a "nautilus side panel" ... is anybody has an example ? or just tell me where to find more info (google was not my friend on this search) -- http://mail.python.org/mailman/listinfo/python-list

Re: Are Python deques linked lists?

2007-12-12 Thread Neil Cerutti
On 2007-12-10, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Neil Cerutti <[EMAIL PROTECTED]> writes: > >> Anyhow, implementing linked lists in Python is not challenging, but >> they don't work well with Python iterators, which aren't suitable >> for a linked list's purposes--so you have to give up th

Re: psycopg

2007-12-12 Thread Calvin Spealman
Don't do that, for a number of reasons. String concatenation is really never a good idea and formatting your own query strings is exactly what leads to things like sql injection. Let the db library handle it for you: cur.execute('insert into seq(id,sequence) values(3, %s)', (content,)) Not

Re: Loading an exe icon into a pixmap/bitmap

2007-12-12 Thread kyosohma
On Dec 12, 12:09 am, [EMAIL PROTECTED] wrote: > I've been searching for a way to load an icon from an executable into > something that I can eventually display either through pygame or > pygtk. I've tried the stuff found > athttp://groups.google.com/group/comp.lang.python/browse_thread/thread/...

Re: GetPath to variable

2007-12-12 Thread kyosohma
On Dec 11, 5:42 am, "Connolly" <[EMAIL PROTECTED]> wrote: > Hey there, new Python user here. > > Currently, I'm working on a project in Python for my college work, I chose > to use Python since I heard of its great advantages, now for designing GUI's > I'm using the wxPython package. > What I'm try

Re: Is anyone happy with csv module?

2007-12-12 Thread Neil Cerutti
On 2007-12-11, massimo s. <[EMAIL PROTECTED]> wrote: > Hi, > > I'm struggling to use the python in-built csv module, and I > must say I'm less than satisfied. Apart from being rather > poorly documented, I find it especially cumbersome to use, and > also rather limited. What I dislike more is that

Re: Is anyone happy with csv module?

2007-12-12 Thread Neil Cerutti
On 2007-12-12, John Machin <[EMAIL PROTECTED]> wrote: >> It's clear that I am thinking to completely different usages >> for CSV than what most people in this thread. I use csv to >> export and import numerical data columns to and from >> spreadsheets. > > For that purpose, CSV files are the utter

Re: [Edu-sig] "do" as a keyword

2007-12-12 Thread kirby urner
> I find that when teaching beginning programmers, they usually think in > "until" terms, and not "while" terms. > If really beginning, an overview of this whole idea of control structures makes sense, such as this wikipedia article: http://en.wikipedia.org/wiki/Control_flow Then explain how Pyth

Re: problem parsing lines in a file

2007-12-12 Thread Kees Bakker
barronmo wrote: > I'm having difficulty getting the following code to work. All I want > to do is remove the '0:00:00' from the end of each line. Here is part > of the original file: > > 3,3,"Dyspepsia NOS",9/12/2003 0:00:00 >... > 20,3,"Bubonic plague",11/11/2003 0:00:00 > > output = open('my

How to get milliseconds when substructing datetime objects?

2007-12-12 Thread Dmitri O.Kondratiev
Please help to find simple solutiion for measuring times of operations with millisecond precision. For this I am trying to use datetime() objects: import time import datetime def dreamTime(secs): t1 = datetime.datetime.now() time.sleep(secs) t2 = datetime.datetime.now() dt = t2 -

Re: psycopg

2007-12-12 Thread J. Clifford Dyer
On Wed, Dec 12, 2007 at 09:08:44AM -0500, Calvin Spealman wrote regarding Re: psycopg: > >Don't do that, for a number of reasons. String concatenation is really >never a good idea and formatting your own query strings is exactly what >leads to things like sql injection. Let the db lib

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

2007-12-12 Thread sturlamolden
On 12 Des, 12:56, George Sakkis <[EMAIL PROTECTED]> wrote: > Ah, the 'make' statement.. I liked (and still do) that PEP, I think it > would have an impact comparable to the decorator syntax sugar, if not > more. I think it is one step closer to Lisp. I believe that it would be worth considering a

Re: Zipfile content reading via an iterator?

2007-12-12 Thread Tim Chase
Gabriel Genellina wrote: >> I'm dealing with several large items that have been zipped up to >> get quite impressive compression. However, uncompressed, they're >> large enough to thrash my memory to swap and in general do bad >> performance-related things. I'm trying to figure out how to >> prod

Re: Is anyone happy with csv module?

2007-12-12 Thread massimo s.
On Dec 12, 2:58 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-12-11, massimo s. <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I'm struggling to use the python in-built csv module, and I > > must say I'm less than satisfied. Apart from being rather > > poorly documented, I find it especially cu

__init__ method for containers

2007-12-12 Thread Neil Cerutti
List and deque disagree on what __init__ does. Which one is right? Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from collections import deque >>> x = deque([0, 1]) >>> x.__init__([2,

Stringified list back to list of ints

2007-12-12 Thread Paul McGuire
On Dec 12, 7:25 am, Lee Capps <[EMAIL PROTECTED]> wrote: > Regular expressions might be a good way to handle this. > > import re > > s = '[16, 16, 2, 16, 2, 16, 8, 16]' > get_numbers = re.compile('\d\d*').findall > > numbers = [int(x) for x in get_numbers(s)] > Isn't '\d\d*' the same as '\d+' ? A

Solve a graphical problem about different logos with a script

2007-12-12 Thread jimred73
Hi I have to bring alot of diffrent company logos into a harmony with each other. Therefore I'm looking for a way to measure the relation between white and colour so that i'm able to scale or shrink the logo that at the end, all logos have the same quotient and therefore have the same optic

Re: __init__ method for containers

2007-12-12 Thread Calvin Spealman
I agree that the behavior should be more consistant, but you also should not be calling __init__ more than once on any given instance and that in and of itself should probably constitute undefined behavior. On Dec 12, 2007, at 3:22 PM, Neil Cerutti wrote: > List and deque disagree on what __i

Re: Is anyone happy with csv module?

2007-12-12 Thread Marco Mariani
John Machin wrote: > For that purpose, CSV files are the utter pox and then some. Consider > using xlrd and xlwt (nee pyexcelerator) to read (resp. write) XLS > files directly. xlwt is unreleased (though quite stable, they say) at the moment, so the links are: easy_install xlrd svn co https://s

pygtk theme colors ?

2007-12-12 Thread manatlan
I understand nothing ... I'm trying to get the color of a normal background window and when I change my themes (i switch between a light and a dark theme) i obtain always the same output below : style = gtk.Button().get_style() l=[gtk.STATE_NORMAL,gtk.STATE_ACTIVE,gtk.STATE_PRELIGHT,gtk.STATE_SEL

Re: Is anyone happy with csv module?

2007-12-12 Thread Marco Mariani
massimo s. wrote: > As for people advicing xlrd/xlrwt: thanks for the useful tip, I didn't > know about it and looks cool, but in this case no way I'm throwing > another dependency to the poor users of my software. Csv module was > good because was built-in. The trouble with sending CSV files to

Re: Zipfile content reading via an iterator?

2007-12-12 Thread Gabriel Genellina
En Wed, 12 Dec 2007 12:03:12 -0300, Tim Chase <[EMAIL PROTECTED]> escribió: > As a side question, is there any catalog of Time Machine items > (instances where folks have asked for a feature only to have the > response be "it's already implemented in the development > version")? I've seen the T

Re: "do" as a keyword

2007-12-12 Thread Chris Mellon
On Dec 11, 2007 2:19 PM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Tue, 11 Dec 2007 15:06:31 +, Neil Cerutti wrote: > > > When I use languages that supply do-while or do-until looping constructs > > I rarely need them. > ... > > However, did you have an specific need for a do-while constr

Re: Stringified list back to list of ints

2007-12-12 Thread Calvin Spealman
I still hold my vote that if you need to reverse the "stringification" of a list, you shouldn't have stringified the list and lost hold of the original list in the first place. That is the solution above all others. On Dec 12, 2007, at 10:26 AM, Paul McGuire wrote: > On Dec 12, 7:25 am, Lee

RE: xmlrpclib.binary to a file doubt

2007-12-12 Thread Jose Ignacio Gisbert
I have resolved my problem!, I think it is easy for everyone, but I unknown “data” binary object attribute. So, code for store a file that is passed as a binary object would be: file = calltoreceivemethod() placetostore=open(filename,'wb') data=file.data placetostore.write(data) Regards, N

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

2007-12-12 Thread Chris Mellon
On Dec 12, 2007 8:36 AM, sturlamolden <[EMAIL PROTECTED]> wrote: > On 12 Des, 12:56, George Sakkis <[EMAIL PROTECTED]> wrote: > > > Ah, the 'make' statement.. I liked (and still do) that PEP, I think it > > would have an impact comparable to the decorator syntax sugar, if not > > more. > > I think

problem pickling a function

2007-12-12 Thread Emin.shopper Martinian.shopper
Dear Experts, I love the pickle module, but I occasionally have problems pickling a function. For example, if I create an instance g of class f and assign g.xto a function, then I cannot pickle g (example code below). I know that I can pickle f separately if I want to, and I understand why I get t

Re: __init__ method for containers

2007-12-12 Thread Neil Cerutti
On 2007-12-12, Calvin Spealman <[EMAIL PROTECTED]> wrote: > I agree that the behavior should be more consistant, but you > also should not be calling __init__ more than once on any > given instance and that in and of itself should probably > constitute undefined behavior. That seems wise to me,

Re: [Edu-sig] "do" as a keyword

2007-12-12 Thread michel paul
> they find the "while" logic to be unintuitive I've found that a good way to explain 'while' is to consider it as an 'if' statement that repeats. Kids grasp simple conditionals fairly easily. I would sometimes hear them talk about 'if loops' when they were actually trying to discuss conditional

Re: Is anyone happy with csv module?

2007-12-12 Thread Neil Cerutti
On 2007-12-12, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > John Machin <[EMAIL PROTECTED]> wrote: >> For that purpose, CSV files are the utter pox and then some. >> Consider using xlrd and xlwt (nee pyexcelerator) to read >> (resp. write) XLS files directly. > > FWIW, CSV is a much more generic

Re: TCP reset caused by socket.py

2007-12-12 Thread Object01
On Dec 11, 6:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 11 Dec 2007 10:51:13 -0300, Object01 <[EMAIL PROTECTED]> escribi�: > > > I've been working with the source code for Trac (http:// > > trac.edgewall.org/) lately and have run across a bizarre problem. It > > seems that all

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

2007-12-12 Thread J. Clifford Dyer
On Wed, Dec 12, 2007 at 06:36:49AM -0800, sturlamolden wrote regarding Re: Is a "real" C-Python possible?: > > On 12 Des, 12:56, George Sakkis <[EMAIL PROTECTED]> wrote: > > > Ah, the 'make' statement.. I liked (and still do) that PEP, I think it > > would have an impact comparable to the decora

Re: problem pickling a function

2007-12-12 Thread Calvin Spealman
On Dec 12, 2007, at 11:01 AM, Emin.shopper Martinian.shopper wrote: > Dear Experts, > > I love the pickle module, but I occasionally have problems pickling > a function. For example, if I create an instance g of class f and > assign g.x to a function, then I cannot pickle g (example code > b

Newbie NameError problem

2007-12-12 Thread MartinRinehart
I don't understand what I don't understand in the following: -- # reader.py - testing char-by-char marching methods f = open('sample_decaf.d', 'r') text = f.readlines() f.close() # this is C-style, 15 lines, in Python: end_line = len(text) line_ptr = 0 whi

Re: __init__ method for containers

2007-12-12 Thread Raymond Hettinger
On Dec 12, 7:22 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > List and deque disagree on what __init__ does. Which one is > right? File a bug report and assign to me. Raymond -- http://mail.python.org/mailman/listinfo/python-list

Re: Is Python really a scripting language?

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

Re: __init__ method for containers

2007-12-12 Thread Calvin Spealman
On Dec 12, 2007, at 4:05 PM, Neil Cerutti wrote: > On 2007-12-12, Calvin Spealman <[EMAIL PROTECTED]> wrote: >> I agree that the behavior should be more consistant, but you >> also should not be calling __init__ more than once on any >> given instance and that in and of itself should probably >>

Re: Newbie NameError problem

2007-12-12 Thread Calvin Spealman
On Dec 12, 2007, at 11:26 AM, [EMAIL PROTECTED] wrote: > I don't understand what I don't understand in the following: You also don't understand how to ask for help properly. Your example is too large, for one. You want a "minimal working example" (http:// ironfroggy-code.blogspot.com/2007/02/m

Re: Is anyone happy with csv module?

2007-12-12 Thread J. Clifford Dyer
On Wed, Dec 12, 2007 at 10:08:38AM -0600, [EMAIL PROTECTED] wrote regarding Re: Is anyone happy with csv module?: > > FWIW, CSV is a much more generic format for spreadsheets than XLS. > For example, I deal almost exclusively in CSV files for simialr situations > as the OP because I also work wit

Re: pygtk theme colors ?

2007-12-12 Thread manatlan
I've found ... In fact, you'll need to "realize" the window, and you should obtain the real gtk theme style (if you didn't realize the window, you obtain the default gtk theme style) (I post it here, so i could find it in the future again ;-) w = gtk.Window() w.realize() style=w.get_style()

Re: problem pickling a function

2007-12-12 Thread Emin.shopper Martinian.shopper
On Dec 12, 2007 11:48 AM, Calvin Spealman <[EMAIL PROTECTED]> wrote: > On Dec 12, 2007, at 11:01 AM, Emin.shopper Martinian.shopper wrote: > > > But is there a way to assign functions to instances of a class > > without preventing pickleability? It doesn't seem unreasonable to > > me to want to as

DBApi Question with MySQL

2007-12-12 Thread Hans Müller
Hi, I'd like to modify some tables in a database in one transaction. This approach doesn't work: import MySQLdb con = MySQLdb.connect("servernam", user = "username", passwd = "verysecret, db = "test", use_unicode = True, charset = "utf8") cursor = con.cursor() con.begin() cursor.execute("del

Re: Is anyone happy with csv module?

2007-12-12 Thread Shane Geiger
Neil Cerutti wrote: > On 2007-12-12, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >> John Machin <[EMAIL PROTECTED]> wrote: >> >>> For that purpose, CSV files are the utter pox and then some. >>> Consider using xlrd and xlwt (nee pyexcelerator) to read >>> (resp. write) XLS files directly

Re: Newbie NameError problem

2007-12-12 Thread cokofreedom
On Dec 12, 5:51 pm, Paul Rudin <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > I don't understand what I don't understand in the following: > > I haven't tried to understand what your code is doing - but the > NameError arises because you try to use Loc before its definition. Put > the d

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

2007-12-12 Thread sturlamolden
On 12 Des, 17:44, "J. Clifford Dyer" <[EMAIL PROTECTED]> wrote: > Programmable syntax is a very powerful concept. You don't have to use the programmable syntax just because it's there. But I do realize it would be a misfeature if it is abused. Two points: * Programmable syntax would make it eas

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

2007-12-12 Thread sturlamolden
On 12 Des, 17:00, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > Python has not become what it is, and achieved the success it has, > because a bunch of people really wanted to use Lisp but didn't think > other people could handle it. > > The goal of these sorts of discussions should be to make Pytho

Re: Help needed with python unicode cgi-bin script

2007-12-12 Thread weheh
Hi Duncan, thanks for the reply. >> > FWIW, the code you posted only ever attempted to set the character set > encoding using an html meta tag which is the wrong place to set it. The > encoding specified in the HTTP headers always takes precedence. This is > why > the default charset setting in Ap

Re: Newbie NameError problem

2007-12-12 Thread Paul Rudin
[EMAIL PROTECTED] writes: > I don't understand what I don't understand in the following: I haven't tried to understand what your code is doing - but the NameError arises because you try to use Loc before its definition. Put the definition first and the error should go away. -- http://mail.pyth

Re: __init__ method for containers

2007-12-12 Thread Raymond Hettinger
On Dec 12, 8:41 am, Calvin Spealman <[EMAIL PROTECTED]> wrote: > It documents that deque.__init__ initializes it, as all __init__ > methods do. All init methods are also assumed to _only_ be called at > the start of the life of the object and never more than once, so > breaking that breaks assumpti

Re: Newbie NameError problem

2007-12-12 Thread Sion Arrowsmith
<[EMAIL PROTECTED]> wrote: >I don't understand what I don't understand in the following: > [ ... ] You've already got an answer as to what's causing your name error. But that's not your only problem. It looks like you need an introduction to enumerate(): for line_ptr, text in enumerate(file('sam

Improvements to the Python core (was: Is a "real" C-Python possible?)

2007-12-12 Thread Christian Heimes
Kay Schluehr wrote: > Given that the Python core team has been mostly silent about JIT > compilation and Armin Rigos work in particular which started 5 years > ago ( Psyco will not be promoted towards Python 3.0 and there is no > indication that anyone but Armin would maintain Psyco ) I wonder abo

Re: DBApi Question with MySQL

2007-12-12 Thread Jeff McNeil
Which storage engine are you using? My assumption is that you're using standard MyISAM tables, which will not support what you're trying to do. If you run the code below against MySQL tables created using InnoDB, it should work as expected. See http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-tra

Re: Newbie NameError problem

2007-12-12 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > I don't understand what I don't understand in the following: You already have the answer (hint: a Python module is sequentially executed when loaded by the interpreter) Just a couple side notes: > # but I need locations, so this is impure, 11-line, Python: > > l

classmethod inheritance

2007-12-12 Thread Yoav Goldberg
A lot of my code supplement/replace the constructor with class factory methods. So, instead of: > a= A(...) I would write: > a = A.from_file(...) > a = A.create(...) etc. This is implemented as follows: class A: def __init__(self, ...): pass @classmethod def from_file(cls, ):

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

2007-12-12 Thread Christian Heimes
Kay Schluehr wrote: > class A(object): > foo = property: > def fget(self): > return self._foo > def fset(self, value): > self._foo = value > > which was translated as follows: > > class A(object): > def thunk(): > def fget(self): >

Re: Rewriting Recipe/410687 without map and lambda

2007-12-12 Thread sofeng
On Dec 11, 8:29 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "sofeng" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > |I would like to use the following recipe to transpose a list of lists > | with different > lengths.http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/4106

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

2007-12-12 Thread George Sakkis
On Dec 12, 4:09 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > I vaguely remember a discussion a few years ago, where someone made > the quite reasonable suggestion of introducing some kind of > thunk_statement: > > class A(object): > foo = property: > def fget(self): > retu

Re: DBApi Question with MySQL

2007-12-12 Thread Paul McNett
Hans Müller wrote: > Hi, > > I'd like to modify some tables in a database in one transaction. > This approach doesn't work: > > import MySQLdb > > con = MySQLdb.connect("servernam", user = "username", passwd = "verysecret, > db = "test", use_unicode = True, charset = "utf8") > > cursor = con.

Re: Help needed with python unicode cgi-bin script

2007-12-12 Thread Duncan Booth
"weheh" <[EMAIL PROTECTED]> wrote: > Hi Duncan, thanks for the reply. >>> >> FWIW, the code you posted only ever attempted to set the character >> set encoding using an html meta tag which is the wrong place to set >> it. The encoding specified in the HTTP headers always takes >> precedence. This

Re: Is anyone happy with csv module?

2007-12-12 Thread Neil Cerutti
On 2007-12-12, Shane Geiger <[EMAIL PROTECTED]> wrote: > Neil Cerutti wrote: >> On 2007-12-12, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >>> John Machin <[EMAIL PROTECTED]> wrote: >>> For that purpose, CSV files are the utter pox and then some. Consider using xlrd and xlwt (

Re: __init__ method for containers

2007-12-12 Thread Neil Cerutti
On 2007-12-12, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > On Dec 12, 7:22 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> List and deque disagree on what __init__ does. Which one is >> right? > > File a bug report and assign to me. Will do. Registration in progress. -- Neil Cerutti -- http:/

Re: Newbie NameError problem

2007-12-12 Thread Paul Rudin
[EMAIL PROTECTED] writes: > On Dec 12, 5:51 pm, Paul Rudin <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] writes: >> > I don't understand what I don't understand in the following: >> >> I haven't tried to understand what your code is doing - but the >> NameError arises because you try to use Loc

Re: Improvements to the Python core

2007-12-12 Thread Paul Rudin
Christian Heimes <[EMAIL PROTECTED]> writes: > > We are happy and glad for every improvement regarding speed, memory > usage or features if and only if: ... > ... platform independent / supported on all platforms. Python runs > on machines from mobile phones to large main frames. JOOI - there ar

Re: TCP reset caused by socket.py

2007-12-12 Thread Bjoern Schliessmann
Gabriel Genellina wrote: > A RST when you close a socket is OK. Says who? MS? ;) Regards, Björn -- BOFH excuse #328: Fiber optics caused gas main leak -- http://mail.python.org/mailman/listinfo/python-list

Re: mimicking a file in memory

2007-12-12 Thread [EMAIL PROTECTED]
On Nov 20, 4:37 pm, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > Try with StringIO/cStringIO, these modules are supposed to give you > in-memoryobjects compatible with file object interface. I found this solution not working. I had similar problem: I wanted to write some string into the in- memory fi

Re: TCP reset caused by socket.py

2007-12-12 Thread Bjoern Schliessmann
Object01 wrote: > The server is multithreaded, handling each request on its own > thread. Ugh. > But is a RST really a part of a valid close operation? Depends on the state of the parties :) The proper way to close non-defunct connections is using FIN segments. > It was my understanding that

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

2007-12-12 Thread George Sakkis
On Dec 12, 1:12 pm, Christian Heimes <[EMAIL PROTECTED]> wrote: > Kay Schluehr wrote: > > class A(object): > > foo = property: > > def fget(self): > > return self._foo > > def fset(self, value): > > self._foo = value > > > which was translated as follows

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

2007-12-12 Thread Kay Schluehr
On Dec 12, 3:36 pm, sturlamolden <[EMAIL PROTECTED]> wrote: > On 12 Des, 12:56, George Sakkis <[EMAIL PROTECTED]> wrote: > > > Ah, the 'make' statement.. I liked (and still do) that PEP, I think it > > would have an impact comparable to the decorator syntax sugar, if not > > more. > > I think it is

Re: Tuples !?!?

2007-12-12 Thread Bjoern Schliessmann
Bruno Desthuilliers wrote: > [EMAIL PROTECTED] a écrit : >> The problem is '2' != 2 > > It would indeed be a problem if this expression eval'd to True. > That's the case in some, hem, 'languages', and believe me it's > *not* the RightThing. What kind of "hem" language is this? :) >>> '2' != 2 T

Re: mimicking a file in memory

2007-12-12 Thread Neil Cerutti
On 2007-12-12, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I found this solution not working. > outfile = StringIO.StringIO() > outfile.write(some_string + '\n') You need to rewind the file with outfile.seek(0) before proceeding, or storlines will encounter an immediate EOF when it attempts to

Re: TCP reset caused by socket.py

2007-12-12 Thread Object01
On Dec 12, 12:45 pm, Bjoern Schliessmann wrote: > Object01 wrote: > > The server is multithreaded, handling each request on its own > > thread. > > Ugh. > > > But is a RST really a part of a valid close operation? > > Depends on the state of the parties :) The proper way to close > non-defunct con

Re: TCP reset caused by socket.py

2007-12-12 Thread Jeff McNeil
Do you have any non-standard network hardware along the route? Perhaps a transparent proxy like a load balancer or a firewall of sorts? I've seen this type of thing happen before with load balancer gear. In my situation, I had a load balancer that kept a state table. If the load balancer didn't

Re: mimicking a file in memory

2007-12-12 Thread Peter Otten
[EMAIL PROTECTED] wrote: > On Nov 20, 4:37 pm, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > >> Try with StringIO/cStringIO, these modules are supposed to give you >> in-memoryobjects compatible with file object interface. > > I found this solution not working. > I had similar problem: I wanted to wr

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

2007-12-12 Thread Chris Mellon
On Dec 12, 2007 12:53 PM, George Sakkis <[EMAIL PROTECTED]> wrote: > On Dec 12, 1:12 pm, Christian Heimes <[EMAIL PROTECTED]> wrote: > > > Kay Schluehr wrote: > > > class A(object): > > > foo = property: > > > def fget(self): > > > return self._foo > > > def fset(sel

Re: Tuples !?!?

2007-12-12 Thread Bruno Desthuilliers
Bjoern Schliessmann a écrit : > Bruno Desthuilliers wrote: > >>[EMAIL PROTECTED] a écrit : > > >>>The problem is '2' != 2 >> >>It would indeed be a problem if this expression eval'd to True. >>That's the case in some, hem, 'languages', and believe me it's >>*not* the RightThing. > > > What kin

After running for four days, Python program stalled

2007-12-12 Thread John Nagle
Had a Python program stall, using no time, after running OK for four days. Python 2.4, Windows. Here's the location in Python where it's stalled. Any idea what it's waiting for? John Nagle 77FA1428 mov ecx,dword ptr [ebp-10h] 77FA142B mov dword

Re: Stringified list back to list of ints

2007-12-12 Thread bearophileHUGS
Another solution, possibly safer: >>> from cStringIO import StringIO >>> import csv >>> s = "[16, 16, 2, 16, 2, 16, 8, 16]" >>> sf = StringIO(s.strip()[1:-1]) >>> list(csv.reader(sf)) [['16', ' 16', ' 2', ' 16', ' 2', ' 16', ' 8', ' 16']] Bye, bearophile -- http://mail.python.org/mailman/listinf

Re: Is anyone happy with csv module?

2007-12-12 Thread J. Clifford Dyer
On Wed, Dec 12, 2007 at 11:02:04AM -0600, [EMAIL PROTECTED] wrote regarding Re: Is anyone happy with csv module?: > > J. Clifford Dyer <[EMAIL PROTECTED]> wrote: > > But the software you are dealing with probably doesn't actually > > need spreadsheets. It just needs digital ledgers. > > I saw

  1   2   >