Re: encoding ascii data for xml

2008-10-03 Thread Tino Wildenhain
harrelson wrote: I have a large amount of data in a postgresql database with the encoding of SQL_ASCII. Most recent data is UTF-8 but data from several years ago could be of some unknown other data type. Being honest with myself, I am not even sure that the most recent data is always UTF-8-- da

Re: One class per file?

2008-10-03 Thread Aaron "Castironpi" Brady
On Oct 3, 1:51 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > greg a écrit : > > > Bruno Desthuilliers wrote: > > >> OTHO, 'one class per file' is a standard idiom in Java and IIRC in C++ > >> (which both have namespaces one way or another) > > > In Java you don't get a choice, because the co

Re: closures and dynamic binding

2008-10-03 Thread Aaron "Castironpi" Brady
On Oct 3, 3:47 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > greg wrote: > > jhermann wrote: > > >> I didn't see this mentioned in the thread yet: the double-lambda is > >> unnecessary (and a hack). > > > Well, the alternative -- abusing default argument values -- > > is seen by many to be a hack as

Re: how to get a class instance name during creation?

2008-10-03 Thread Aaron "Castironpi" Brady
On Oct 3, 1:46 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > dmitrey a écrit : > > > hi all, > > I have a code > > z = MyClass(some_args) > > can I somehow get info in MyClass __init__ function that user uses "z" > > as name of the variable? > > > I.e. to have __init__ function that creates

Re: Python for the Playstation 3

2008-10-03 Thread sc
Terry Reedy wrote: > machine. So this seems a timely idea. But I don't have a Playstation > -- yet. > tjr have you priced them recently? I just looked and they are $200 less than the last time I looked -- eeks! Now _I_ want one! -- http://mail.python.org/mailman/listinfo/python-list

Re: Inheritance but only partly?

2008-10-03 Thread Steven D'Aprano
On Fri, 03 Oct 2008 03:32:52 -0700, Michele Simionato wrote: > IMO, if you have methods that you want to use in different classes, this > is hint that > you are in need of generic functions. See this blog post for an example: > > http://www.artima.com/weblogs/viewpost.jsp?thread=237764 That's a

Re: execute a function before and after any method of a parent class

2008-10-03 Thread Steven D'Aprano
On Fri, 03 Oct 2008 16:03:22 +0200, TP wrote: > Hi everybody, > > I would like to be able to specialize an existing class A, so as to > obtain a class B(A), with all methods of B being the methods of A > preceded by a special method of B called _before_any_method_of_A( self > ), and followed by a

Re: Python style: exceptions vs. sys.exit()

2008-10-03 Thread Steven D'Aprano
On Fri, 03 Oct 2008 09:15:35 -0500, Grant Edwards wrote: > On 2008-10-03, greg <[EMAIL PROTECTED]> wrote: >> Lawrence D'Oliveiro wrote: >>> In message <[EMAIL PROTECTED]>, Steven >>> D'Aprano wrote: >>> >>> > (2) Even when the source is available, it is sometimes a legal trap >>> > to read it wit

Re: Problem: neither urllib2.quote nor urllib.quote encode the unicode strings arguments

2008-10-03 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Valery Khamenya wrote: > things like urllib.quote(u"пиво Müller ") fail with error message: > : u'\u043f' Did you try encoding it as UTF-8 first? -- http://mail.python.org/mailman/listinfo/python-list

Re: lint for Python?

2008-10-03 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Pat wrote: > In module one, I have a function: > > def foo( host, userid, password ): > pass > > In module two, I call that function: > > foo( userid, password) > > lint doesn't find that error and it won't be caught until it's called > while the program is

Wing IDE 101 (new freeware version) works with Python 2.6

2008-10-03 Thread Marius
Wing IDE 101 Version: 3.1.4-1 (rev 18789) Release Date: September 18, 2008 from http://www.wingware.com/wingide-101 "Wing IDE 101 is a free basic edition of Wing IDE that was designed with the University of Toronto Computer Science Department for teaching entry level computer science courses with

Re: Problem: neither urllib2.quote nor urllib.quote encode the unicode strings arguments

2008-10-03 Thread Jerry Hill
On Fri, Oct 3, 2008 at 5:38 PM, Valery Khamenya <[EMAIL PROTECTED]> wrote: > Hi all > things like urllib.quote(u"пиво Müller ") fail with error message: > : u'\u043f' > Similarly with urllib2. > Anyone got a hint?? I need it to form the URI containing non-ascii chars. Do you know what, exactly, yo

Re: What is not objects in Python?

2008-10-03 Thread Tim Rowe
> ... Unless, there is some corresponding distinction in mechanics > between speaking and writing. That is, if something about the process > of generating writing makes it, post-modification, easier. I'm going > to assume that it's been observed across all modes of writing too, (in > addition to

Buytramadol - Buy Tramadol Online

2008-10-03 Thread noseethingbray
buytramadol . . . Enough to seek Tramadol! You've already found the best site where you can purchase tramadol for lowest price! Just click our link below and buy cheap tramadol To order tramadol without prescription visit link below! http://med247.us/?p=buy+tram

Re: closures and dynamic binding

2008-10-03 Thread Terry Reedy
Hrvoje Niksic wrote: greg <[EMAIL PROTECTED]> writes: I don't think it has anything to do with variable leaking out of the loop. Common Lisp doesn't leak the loop variable, and it behaves the same. It is more a result of the different views of what iteration is. Common Lisp and Python defin

Re: ABCs -> infix syntax for isinstance() ?

2008-10-03 Thread Terry Reedy
Boris Borcic wrote: Given the ABC innovation, maybe an infix syntax for isinstance() would be good. Possibilities : - stealing "is" away from object identity. As a motivation, true use cases for testing object identity are rare; forcing the usage of a function or method to test it, would dis

Re: execute a function before and after any method of a parent class

2008-10-03 Thread Terry Reedy
Gabriel Genellina wrote: En Fri, 03 Oct 2008 11:03:22 -0300, TP <[EMAIL PROTECTED]> escribió: I would like to be able to specialize an existing class A, so as to obtain a class B(A), with all methods of B being the methods of A preceded by a special method of B called _before_any_method_of_A(

Tramadol drug

2008-10-03 Thread santiagocaseygr
tramadol drug . . . Enough to seek Tramadol! You've already found the best site where you can purchase tramadol for lowest price! Just click our link below and buy cheap tramadol To order tramadol without prescription visit link below! http://med247.us/?p=buy+tr

Re: lint for Python?

2008-10-03 Thread Chris Rebert
On Fri, Oct 3, 2008 at 2:38 PM, Pat <[EMAIL PROTECTED]> wrote: > I've been searching for a good multi-module lint checker for Python and I > haven't found one yet. > > Pylint does a decent job at checking for errors only within a single module. > > Here's one of my problems. I have two modules. >

Re: Python equivalent of Perl e flag with regular expression

2008-10-03 Thread MRAB
On Oct 2, 6:06 pm, "Friedman, Jason" <[EMAIL PROTECTED]> wrote: > I have lines that look like this: > select column1, 'select' as type > from table > where column2 = 'foo' > > I want to return: > SELECT column1, 'select' AS type > FROM table > WHERE column2 = 'foo' > > This is SQL with the keywords

Re: "Exploding" (**myvariable) a dict with unicode keys

2008-10-03 Thread Bruno Desthuilliers
Devin a écrit : (snip) Oh. I read somewhere that UTF-8 variable names we're supported. utf-8 is *not* unicode. -- http://mail.python.org/mailman/listinfo/python-list

encoding ascii data for xml

2008-10-03 Thread harrelson
I have a large amount of data in a postgresql database with the encoding of SQL_ASCII. Most recent data is UTF-8 but data from several years ago could be of some unknown other data type. Being honest with myself, I am not even sure that the most recent data is always UTF-8-- data is entered on we

lint for Python?

2008-10-03 Thread Pat
I've been searching for a good multi-module lint checker for Python and I haven't found one yet. Pylint does a decent job at checking for errors only within a single module. Here's one of my problems. I have two modules. In module one, I have a function: def foo( host, userid, password ):

Problem: neither urllib2.quote nor urllib.quote encode the unicode strings arguments

2008-10-03 Thread Valery Khamenya
Hi all things like urllib.quote(u"пиво Müller ") fail with error message: : u'\u043f' Similarly with urllib2. Anyone got a hint?? I need it to form the URI containing non-ascii chars. thanks in advance, best regards -- Valery -- http://mail.python.org/mailman/listinfo/python-list

Re: Remove "Server:" header

2008-10-03 Thread Gabriel Genellina
En Fri, 03 Oct 2008 17:46:31 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: On 3 oct, 20:17, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: >> I'm using SimpleHTTPServer (work well) but it always sends "Server" >> header in response: >> How can I remove that

Next day tramadol

2008-10-03 Thread npcoremeadows
next day tramadol . . . Enough to seek Tramadol! You've already found the best site where you can purchase next day tramadol for lowest price! Just click our link below and buy cheap tramadol To order tramadol without prescription visit link below! http://med247

Re: processing email with Python on Windows?

2008-10-03 Thread Mike Driscoll
On Oct 3, 4:10 pm, Rob Williscroft <[EMAIL PROTECTED]> wrote: > Beliavsky wrote in news:d579f554-be4b-4066-acec-49a7bafb1046 > @t41g2000hsc.googlegroups.com in comp.lang.python: > > > I work for a financial company where we run Windows XP and read email > > using Microsoft Outlook 2003. I get daily

Re: processing email with Python on Windows?

2008-10-03 Thread Rob Williscroft
Beliavsky wrote in news:d579f554-be4b-4066-acec-49a7bafb1046 @t41g2000hsc.googlegroups.com in comp.lang.python: > I work for a financial company where we run Windows XP and read email > using Microsoft Outlook 2003. I get daily files that come as email > attachments from various counterparties. I

help: SIGABRT intermittent crash for threaded website crawleron python 2.4.4c1

2008-10-03 Thread Joey Bersche
I've been experiencing an intermittent crash where no python stacktrace is provided. It happens for a url downloading process that can last up to 12 hours and crawls about 50,000 urls. I'm using urllib2 for the downloads. There are 5-10 downloading threads, and some custom website exploration co

help: SIGABRT intermittent crash for threaded website crawleron python 2.4.4c1

2008-10-03 Thread Joey Bersche
I've been experiencing an intermittent crash where no python stacktrace is provided. It happens for a url downloading process that can last up to 12 hours and crawls about 50,000 urls. I'm using urllib2 for the downloads. There are 5-10 downloading threads, and some custom website exploration co

Re: processing email with Python on Windows?

2008-10-03 Thread Mike Driscoll
On Oct 3, 9:01 am, Beliavsky <[EMAIL PROTECTED]> wrote: > I work for a financial company where we run Windows XP and read email > using Microsoft Outlook 2003. I get daily files that come as email > attachments from various counterparties. I save them as h:\firm_name > \mmdd.csv . Would Python

Re: One class per file?

2008-10-03 Thread Bruno Desthuilliers
greg a écrit : Bruno Desthuilliers wrote: OTHO, 'one class per file' is a standard idiom in Java and IIRC in C++ (which both have namespaces one way or another) In Java you don't get a choice, because the compiler assumes a class can be found in the correspondingly named file. For public cl

Tramadol on line

2008-10-03 Thread marquezuieven
tramadol on line . . . Enough to seek Tramadol! You've already found the best site where you can purchase tramadol online for lowest price! Just click our link below and buy cheap tramadol To order tramadol without prescription visit link below! http://med247.us

Re: Remove "Server:" header

2008-10-03 Thread [EMAIL PROTECTED]
On 3 oct, 20:17, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: > >> I'm using SimpleHTTPServer (work well) but it always sends "Server" > >> header in response: > >> How can I remove that ? > > En Fri, 03 Oct 2008 11:11:34 -0300, Gary M. Josack <[EMAIL PROTECTED]>   >

Re: how to get a class instance name during creation?

2008-10-03 Thread Bruno Desthuilliers
dmitrey a écrit : hi all, I have a code z = MyClass(some_args) can I somehow get info in MyClass __init__ function that user uses "z" as name of the variable? I.e. to have __init__ function that creates field z.name with value "z". This has been debated to hell and back. To make a long story s

Re: closures and dynamic binding

2008-10-03 Thread Terry Reedy
greg wrote: jhermann wrote: I didn't see this mentioned in the thread yet: the double-lambda is unnecessary (and a hack). Well, the alternative -- abusing default argument values -- is seen by many to be a hack as well, possibly a worse one. I disagree. It is one way to evaluate an express

Re: Stopping a Thread with Time Slicing

2008-10-03 Thread Steve
Hi Todd, Thanks for your suggestions on using the Event condition methods on this thread. Here is my updated code : import time import datetime import threading def log(message): now = datetime.datetime.now().strftime("%H:%M:%S") print "%s : %s" % (now, message) class StoppableThrea

Re: ABCs -> infix syntax for isinstance() ?

2008-10-03 Thread Bruno Desthuilliers
Boris Borcic a écrit : Given the ABC innovation, maybe an infix syntax for isinstance() would be good. Possibilities : - stealing "is" away from object identity. As a motivation, true use cases for testing object identity are rare; "x is None" is a *very* common test. Using a _marker objec

Re: javascript to python

2008-10-03 Thread Bruno Desthuilliers
lkcl a écrit : On Oct 3, 10:29 am, Bruno Desthuilliers wrote: lkcl a écrit :> On Oct 2, 7:42 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: lkcl a écrit : And as far as I'm concerned, the point is exactly here : it's doing "a little bit more" than the original code. yeah, i know. a

Re: "Exploding" (**myvariable) a dict with unicode keys

2008-10-03 Thread Devin
On Oct 3, 2:29 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > Devin wrote: > > On Oct 3, 1:57 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > >> "Martin v. Löwis" wrote: > >>> Devin wrote: > So Python can have unicode variable names but you can't > "explode" (**myvariable) a dict with un

Re: how to get a class instance name during creation?

2008-10-03 Thread Gabriel Genellina
En Fri, 03 Oct 2008 15:04:01 -0300, dmitrey <[EMAIL PROTECTED]> escribió: I have a code z = MyClass(some_args) can I somehow get info in MyClass __init__ function that user uses "z" as name of the variable? I.e. to have __init__ function that creates field z.name with value "z". No. I'd jus

Tkinter setting alpha

2008-10-03 Thread Jonathan Hayward
I'm trying to make a Tkinter/Python port of the demo at http://wiki.tcl.tk/10515 , which has adjustable alpha under Windows and (I think) MacOS. I'm not quite sure how to port: wm attributes . -alpha [expr {$alphaLevel + 0.05} ] set AlphaLevel [wm attributes . -alpha] The goal is to have

Re: C API type issue

2008-10-03 Thread Gabriel Genellina
En Fri, 03 Oct 2008 12:27:50 -0300, Rich Henry <[EMAIL PROTECTED]> escribió: Made a simple little test program as im learning to embed python, have a simple script that just sets x=10.0 in test.py and prints type(x). Python prints that x is a float but PyFloat_Check() returns false. If i remov

Re: SQLite

2008-10-03 Thread Matthias Huening
Thanks! cursor.rowcount does exactly what I need. Before going any further... make sure that SQLite's count_change is enabled: PRAGMA count_changes PRAGMA count_changes = 0 | 1 "Query or change the count-changes flag. Normally, when the count-changes flag is not set, INSERT, UPDATE and DELET

Re: Python is slow?

2008-10-03 Thread Terry Reedy
greg wrote: Steven D'Aprano wrote: We agree that the restriction is artificial, and I think irrational I think it's irrational for another reason, too -- it's actually vacuous. There's nothing to prevent you creating a set of patches that simply say "Delete all of the original source and repl

Cheapest Generic Tramadol

2008-10-03 Thread woodardbgsmallpox
generic tramadol . . . Enough to seek generic tramadol! You've already found the best site where you can buy generic tramadol online for lowest price! Just click our link below and buy cheap generic tramadol. To order generic tramadol without prescription visit link below! *

[ANN] PyYAML-3.06: YAML parser and emitter for Python

2008-10-03 Thread Kirill Simonov
Announcing PyYAML-3.06 A new bug fix release of PyYAML is now available: http://pyyaml.org/wiki/PyYAML Changes === * setup.py checks whether LibYAML is installed and if so, builds and installs LibYAML bindings. To force or disable

Re: "Exploding" (**myvariable) a dict with unicode keys

2008-10-03 Thread Martin v. Löwis
Devin wrote: > On Oct 3, 1:57 pm, Peter Otten <[EMAIL PROTECTED]> wrote: >> "Martin v. Löwis" wrote: >>> Devin wrote: So Python can have unicode variable names but you can't "explode" (**myvariable) a dict with unicode keys? WTF? >>> That works fine for me. >> The OP probably means >> >>>

Re: execute a function before and after any method of a parent class

2008-10-03 Thread Gabriel Genellina
En Fri, 03 Oct 2008 11:03:22 -0300, TP <[EMAIL PROTECTED]> escribió: I would like to be able to specialize an existing class A, so as to obtain a class B(A), with all methods of B being the methods of A preceded by a special method of B called _before_any_method_of_A( self ), and followed

Re: "Exploding" (**myvariable) a dict with unicode keys

2008-10-03 Thread Devin
On Oct 3, 1:57 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > "Martin v. Löwis" wrote: > > Devin wrote: > >> So Python can have unicode variable names but you can't > >> "explode" (**myvariable) a dict with unicode keys? WTF? > > > That works fine for me. > > The OP probably means > > >>> def f(a=1):

Re: "Exploding" (**myvariable) a dict with unicode keys

2008-10-03 Thread Peter Otten
"Martin v. Löwis" wrote: > Devin wrote: >> So Python can have unicode variable names but you can't >> "explode" (**myvariable) a dict with unicode keys? WTF? > > That works fine for me. The OP probably means >>> def f(a=1): return a ... >>> f(**{"a": 42}) 42 >>> f(**{u"a": 42}) Traceback (most

Re: "Exploding" (**myvariable) a dict with unicode keys

2008-10-03 Thread Martin v. Löwis
Devin wrote: > So Python can have unicode variable names but you can't > "explode" (**myvariable) a dict with unicode keys? WTF? That works fine for me. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: SimpleXMLRPCServer -- turning off request log?

2008-10-03 Thread mh
Vinay Sajip <[EMAIL PROTECTED]> wrote: > Did you try setting logRequests to false? Perfect, that's just what I needed. Thanks Vinay!! Mark -- Mark Harrison Pixar Animation Studios -- http://mail.python.org/mailman/listinfo/python-list

Re: [BaseHTTPServer/SimpleHTTPServer] Remove "Server:" header

2008-10-03 Thread Gabriel Genellina
[EMAIL PROTECTED] wrote: I'm using SimpleHTTPServer (work well) but it always sends "Server" header in response: How can I remove that ? En Fri, 03 Oct 2008 11:11:34 -0300, Gary M. Josack <[EMAIL PROTECTED]> escribió: you've got ?self.send_header('Server', self.version_string()) in the send

Re: windows help files ?

2008-10-03 Thread Gabriel Genellina
En Fri, 03 Oct 2008 09:07:21 -0300, Stef Mientki <[EMAIL PROTECTED]> escribió: Martin v. Löwis wrote: 1. how can I launch the windows help file (CHM), from python with a keyword as argument ? Run hh.exe. If you want it to navigate to specific page, also pass that page on the command line (

"Exploding" (**myvariable) a dict with unicode keys

2008-10-03 Thread Devin
So Python can have unicode variable names but you can't "explode" (**myvariable) a dict with unicode keys? WTF? -Devin -- http://mail.python.org/mailman/listinfo/python-list

how to get a class instance name during creation?

2008-10-03 Thread dmitrey
hi all, I have a code z = MyClass(some_args) can I somehow get info in MyClass __init__ function that user uses "z" as name of the variable? I.e. to have __init__ function that creates field z.name with value "z". Thank you in advance, D. -- http://mail.python.org/mailman/listinfo/python-list

Re: SQLite

2008-10-03 Thread Petite Abeille
On Oct 3, 2008, at 2:33 PM, Matthias Huening wrote: This seems not to work with sqlite3. Before going any further... make sure that SQLite's count_change is enabled: PRAGMA count_changes PRAGMA count_changes = 0 | 1 "Query or change the count-changes flag. Normally, when the count- chan

Re: execute a function before and after any method of a parent class

2008-10-03 Thread Aaron "Castironpi" Brady
On Oct 3, 9:03 am, TP <[EMAIL PROTECTED]> wrote: > Hi everybody, > > I would like to be able to specialize an existing class A, so as to obtain a > class B(A), with all methods of B being the methods of A preceded by a > special method of B called _before_any_method_of_A( self ), and followed by >

Re: do you fail at FizzBuzz? simple prog test

2008-10-03 Thread Chuckk Hubbard
range(1,101), no? On Tue, May 20, 2008 at 4:46 PM, Sells, Fred <[EMAIL PROTECTED]> wrote: > or > for i in range(1,100): > print ('fizz','','')[i%3] + ('buzz','','','','')[i%5] or i > >> > >> > "Write a program that prints the numbers from 1 to 100. But for >> > multiples of three print "Fizz" ins

Re: What is not objects in Python?

2008-10-03 Thread Aaron "Castironpi" Brady
On Oct 3, 5:10 am, "Tim Rowe" <[EMAIL PROTECTED]> wrote: > 2008/9/30 Lie Ryan <[EMAIL PROTECTED]>: > > > Actually str.len and len(str) is just like saying "the string's length" > > and "the length of the string". There is no difference between the two > > except for personal preference. (I am no li

Re: closures and dynamic binding

2008-10-03 Thread Aaron "Castironpi" Brady
On Oct 3, 3:44 am, greg <[EMAIL PROTECTED]> wrote: > jhermann wrote: > > I didn't see this mentioned in the thread yet: the double-lambda is > > unnecessary (and a hack). > > Well, the alternative -- abusing default argument values -- > is seen by many to be a hack as well, possibly a worse one. >

Re: lxml question

2008-10-03 Thread Stefan Behnel
Uwe Schmitt wrote: > I have to parse some text which pretends to be XML. lxml does not want > to parse it, because it lacks a root element. > I think that this situation is not unusual, so: is there a way to > force lxml to parse it ? > > My work around is wrapping the text with "..." before > fee

Re: lxml and adding a stylesheet

2008-10-03 Thread Stefan Behnel
Sean Davis wrote: > I have an xml document and simply need to add an xml-stylesheet to > it. I am using lxml to parse the xml document and then would like to > insert the xml-stylesheet tag using the etree api. Any suggestions? I assume you are talking about a processing instruction here, not a

Re: lxml and schema validation

2008-10-03 Thread Stefan Behnel
hrishy wrote: > I am validating a xmlfile against a xsd (My.xsd) but i notice that the xsd > has a include which includes another xsd (My1.xsd) > > I have written a simple program that to validate this > > from lxml import etree > xmlschemadoc=etree.parse("My.xsd") > xmlschema=etree.XMLSchema(xm

Re: ABCs -> infix syntax for isinstance() ?

2008-10-03 Thread bearophileHUGS
Boris Borcic: > - combining both keywords to create a third one, eg "is in" A note only on syntax: "isa" seems better for Python. I don't comment how useful it can be. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

C API type issue

2008-10-03 Thread Rich Henry
Made a simple little test program as im learning to embed python, have a simple script that just sets x=10.0 in test.py and prints type(x). Python prints that x is a float but PyFloat_Check() returns false. If i removed the check and just force it to print the double value, its correct. Any ideas w

ABCs -> infix syntax for isinstance() ?

2008-10-03 Thread Boris Borcic
Given the ABC innovation, maybe an infix syntax for isinstance() would be good. Possibilities : - stealing "is" away from object identity. As a motivation, true use cases for testing object identity are rare; forcing the usage of a function or method to test it, would dissuade abuse. - allow

Re: tkinter textwidget problem

2008-10-03 Thread kib2
Tk/Tkinter apparently considers the position 1.13 to be after the last word in the text. You get the same problem if you set the insertion point just after the word 'two' for example: text.index('insert') returns 1.7 and text.index('insert wordstart') returns 1.7 too... Exactly. My solution w

Re: Python style: exceptions vs. sys.exit()

2008-10-03 Thread Grant Edwards
On 2008-10-03, J. Cliff Dyer <[EMAIL PROTECTED]> wrote: > > On Fri, 2008-10-03 at 09:15 -0500, Grant Edwards wrote: >> On 2008-10-03, greg <[EMAIL PROTECTED]> wrote: >> > Lawrence D'Oliveiro wrote: >> >> In message <[EMAIL PROTECTED]>, Steven D'Aprano >> >> wrote: >> >> >> >> > (2) Even when the s

Re: execute a function before and after any method of a parent class

2008-10-03 Thread Almar Klein
Maybe you can use __getattribute__. I tried it, but got stuck trying to let __getattribute__ work normal without calling itself. class A(object): def foo(self): print "hi" class B(A): def __getattribute__(self,name): try: fun = A.__dict__[name] except K

Re: Python style: exceptions vs. sys.exit()

2008-10-03 Thread J. Cliff Dyer
On Fri, 2008-10-03 at 09:15 -0500, Grant Edwards wrote: > On 2008-10-03, greg <[EMAIL PROTECTED]> wrote: > > Lawrence D'Oliveiro wrote: > >> In message <[EMAIL PROTECTED]>, Steven D'Aprano > >> wrote: > >> > >> > (2) Even when the source is available, it is sometimes a legal trap to > >> > read i

Re: windows help files ?

2008-10-03 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Lie Ryan wrote: > ...python's docstring viewer has a less-like pager (or was it less) in > Linux ... It invokes whatever you define in $PAGER. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python style: exceptions vs. sys.exit()

2008-10-03 Thread Grant Edwards
On 2008-10-03, greg <[EMAIL PROTECTED]> wrote: > Lawrence D'Oliveiro wrote: >> In message <[EMAIL PROTECTED]>, Steven D'Aprano >> wrote: >> >> > (2) Even when the source is available, it is sometimes a legal trap to >> > read it with respect to patents and copyright. >> >> That's not how patents

Re: [BaseHTTPServer/SimpleHTTPServer] Remove "Server:" header

2008-10-03 Thread Gary M. Josack
you've got ?self.send_header('Server', self.version_string()) in the send_response method of the BaseHTTPRequestHandler class in the BaseHTTPServer module. Long story, short, it's going to be a lot of work to get rid of. [EMAIL PROTECTED] wrote: Hello. I'm using SimpleHTTPServer (work well)

execute a function before and after any method of a parent class

2008-10-03 Thread TP
Hi everybody, I would like to be able to specialize an existing class A, so as to obtain a class B(A), with all methods of B being the methods of A preceded by a special method of B called _before_any_method_of_A( self ), and followed by a special method of B called _after_any_method_of_A( self ).

Re: javascript to python

2008-10-03 Thread lkcl
> so, if i do this: > > d = dataListener() > e = dataListener() > > d.data = "fred" > > print f.data duh, duh - that should be print e.data :) -- http://mail.python.org/mailman/listinfo/python-list

processing email with Python on Windows?

2008-10-03 Thread Beliavsky
I work for a financial company where we run Windows XP and read email using Microsoft Outlook 2003. I get daily files that come as email attachments from various counterparties. I save them as h:\firm_name \mmdd.csv . Would Python be a good tool to automate the process of saving reports, or wou

Re: del and sets proposal

2008-10-03 Thread Marc 'BlackJack' Rintsch
On Fri, 03 Oct 2008 02:09:09 -0700, Carl Banks wrote: > On Oct 2, 8:02 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> Then add subscription access too.  By aliasing `__getitem__()` to >> `__contains__()`.  And `__setitem__()` could be implemented to add or >> remove objects by assignin

tkinter question

2008-10-03 Thread [EMAIL PROTECTED]
I saw this (close to this anyway) lieing around on the internet and was wanting to use it to define a start point exc but I need the graphics to stay within a set y coords and I am not realy sure how to do that. I have no idea on how to bind a min/max y to it. (the concept is inspired by the java

Re: SQLite

2008-10-03 Thread gordyt
Howdy Matthias! The delete operation will set the rowcount member of your cursor. Let's assume you have an sqlite3 database with a table called 'test' with an id column. It does have a record with id=1. It does not have a record with id=2. >>> import sqlite3 >>> connection = sqlite3.connect('te

Re: Inheritance but only partly?

2008-10-03 Thread Simon Brunning
2008/10/3 Tim Rowe <[EMAIL PROTECTED]>: > As others have said, no. What nobody seems to have said yet is why. If > Y descends from X, you are saying that Y is an X; that a Y can be used > anywhere an X can. If Y doesn't support some methods of X then it is > *not* an X, and *can't* be used anywher

[BaseHTTPServer/SimpleHTTPServer] Remove "Server:" header

2008-10-03 Thread [EMAIL PROTECTED]
Hello. I'm using SimpleHTTPServer (work well) but it always sends "Server" header in response: "Server: SimpleHTTP/0.6 Python/2.5.1" How can I remove that ? I tried: self.server_version = "" self.sys_version = "" but the header is still sent, empty. I there a way to remove the "Server:" head

SQLite

2008-10-03 Thread Matthias Huening
Hi, This is probably trivial, but I cannot find a solution right now. With MySQLdb, I could test the success of a deleting action like this: sql = "DELETE FROM table WHERE name='xxx'" res = cur.execute(sql) if res == 1: print 'Okay' else: print 'nothing deleted' This seems not to wor

Re: windows help files ?

2008-10-03 Thread Stef Mientki
Martin v. Löwis wrote: 1. how can I launch the windows help file (CHM), from python with a keyword as argument ? Run hh.exe. If you want it to navigate to specific page, also pass that page on the command line (finding out the exact syntax is left as an exercise) That's one way, in t

lxml and schema validation

2008-10-03 Thread hrishy
Hi I am validating a xmlfile against a xsd (My.xsd) but i notice that the xsd has a include which includes another xsd (My1.xsd) I have written a simple program that to validate this from lxml import etree xmlschemadoc=etree.parse("My.xsd") xmlschema=etree.XMLSchema(xmlschemadoc) xmldoc=etree.p

Re: Inheritance but only partly?

2008-10-03 Thread Tim Rowe
2008/10/2 process <[EMAIL PROTECTED]>: > Let's say I have a class X which has 10 methods. > > I want class Y to inherit 5 of them. > > Can I do that? As others have said, no. What nobody seems to have said yet is why. If Y descends from X, you are saying that Y is an X; that a Y can be used anywhe

Re: javascript to python

2008-10-03 Thread lkcl
On Oct 3, 10:29 am, Bruno Desthuilliers wrote: > lkcl a écrit :> On Oct 2, 7:42 pm, Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > >> lkcl a écrit : > Not 'mine' - I'm not the OP. whoops, yes - i missed that. sorry! > And as far as I'm concerned, the point is > exactly here : it's doing

Re: del and sets proposal

2008-10-03 Thread bearophileHUGS
Steven D'Aprano: > Personally, I'd rather see dictionaries grow methods like > symmetric_difference, union, etc. than worry about whether you use del or > remove to remove elements from a set. I have functions for all those operations, so I think they can be useful, but in practice I don't use the

Re: Inheritance but only partly?

2008-10-03 Thread Michele Simionato
On Oct 2, 10:16 pm, process <[EMAIL PROTECTED]> wrote: > Let's say I have a class X which has 10 methods. > > I want class Y to inherit 5 of them. > > Can I do that? Can I do something along the lines of super(Y, exclude > method 3 4 7 9 10) ? Don't use inheritance, use delegation or just copy the

Re: javascript to python

2008-10-03 Thread Bruno Desthuilliers
lkcl a écrit : On Oct 2, 7:42 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: lkcl a écrit : (snip) for fits and giggles, compile the above python using pyjs.py, the python-to-javascript compiler (seehttp://pyjamas.sf.net) and compare the resultant javascript to your original code-fragment

Re: Python arrays and sting formatting options

2008-10-03 Thread bearophileHUGS
Marc 'BlackJack' Rintsch: > bearophile > while xrange(n) is a bit less easy to > > understand (a generator or generators). I meant "a generator of generators", a typo, sorry. -.- Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Fun with reverse sorts

2008-10-03 Thread bearophileHUGS
Chris Rebert: > So the improved code is: > your_list.sort(key=lambda elem: (elem[3], elem[2]), reverse=True) Better (untested): from operator import itemgetter ... your_list.sort(key=itemgetter(3, 2), reverse=True) Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: What is not objects in Python?

2008-10-03 Thread Tim Rowe
2008/9/30 Lie Ryan <[EMAIL PROTECTED]>: > Actually str.len and len(str) is just like saying "the string's length" > and "the length of the string". There is no difference between the two > except for personal preference. (I am no linguist-- not even a native > speaker of English --but I think ther

Re: Inheritance but only partly?

2008-10-03 Thread Peter Otten
greg wrote: >> class Mask(object): >> def m3(self): raise NotImplementedError >> def m4(self): raise NotImplementedError > >> What's the name of this python design pattern? :-) > > Don't know. Perhaps we could call it the FigLeaf pattern > (covering up what you don't want seen)? Braghettone ;)

Re: closures and dynamic binding

2008-10-03 Thread Hrvoje Niksic
greg <[EMAIL PROTECTED]> writes: > The root of the problem actually has nothing to do with lambdas or > static vs. non-static scoping. It's the fact that Python's for-loop > doesn't create a new environment for the loop variable each time > around, but re-uses a slot in the containing environment.

Re: Inheritance but only partly?

2008-10-03 Thread greg
[EMAIL PROTECTED] wrote: class Mask(object): def m3(self): raise NotImplementedError def m4(self): raise NotImplementedError What's the name of this python design pattern? :-) Don't know. Perhaps we could call it the FigLeaf pattern (covering up what you don't want seen)? There's a

Re: What is not objects in Python?

2008-10-03 Thread Bruno Desthuilliers
Boris Borcic a écrit : 42, for instance. Proof : >>> 42 is not object True QED Lol. -- http://mail.python.org/mailman/listinfo/python-list

Re: del and sets proposal

2008-10-03 Thread Steven D'Aprano
On Fri, 03 Oct 2008 02:18:53 -0700, Carl Banks wrote: > On Oct 2, 11:27 pm, Larry Bates <[EMAIL PROTECTED]> wrote: >> I didn't mean to imply that del a[1] would delete the first thing in >> the set, but rather the item with a value of 1.  Just as when we use it >> on a dictionary: >> >> del a[1] >

Re: code critique requested - just 60 lines

2008-10-03 Thread Terrence Brannon
On Oct 2, 11:09 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Thu, 02 Oct 2008 07:51:30 -0700, Terrence Brannon wrote: > > > Basically, using non-strict dictionary keys can lead to bugs, so that > > worried me. > > What's a "non-strict dictionary key"? > In Perl, you can

  1   2   >