Re: Newb Tkinter Question: Object has no attribute 'tk'

2006-06-30 Thread Simon Yau
python programming newb wrote: > > I'm new to python and tkinter. I'm trying to write a program that > opens the root window with a button that then opens a toplevel window > that then has it's own widgets. I can get the new toplevel window to > open but none of the widgets appear. The console gi

Re: efficiency question

2006-06-30 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: > > when in doubt, ask the compiler: > > def code(x): > if x in ("abc", "def", "xyz"): > doStuff() > elif x in ("pqr", "tuv", "123"): > doOtherStuff() > > import dis > dis.dis(code) > > prints: > > 2 0 LOAD_FAST0 (x) >

Re: beautifulsoup .vs tidy

2006-06-30 Thread Ravi Teja
bruce wrote: > hi... > > never used perl, but i have an issue trying to resolve some html that > appears to be "dirty/malformed" regarding the overall structure. in > researching validators, i came across the beautifulsoup app and wanted to > know if anybody could give me pros/cons of the app as it

Re: Modelica

2006-06-30 Thread Srijit Kumar Bhadra
Is it possible to process Modelica models with Python? I found one possible approach: (a) Use ModelicaXML (http://www.ida.liu.se/~adrpo/ModelicaXML) to represent Modelica code as XML (b) Generate Python code (using numpy and scipy) from this XML file. Is there any better approach? Best Regards, S

beautifulsoup .vs tidy

2006-06-30 Thread bruce
hi... never used perl, but i have an issue trying to resolve some html that appears to be "dirty/malformed" regarding the overall structure. in researching validators, i came across the beautifulsoup app and wanted to know if anybody could give me pros/cons of the app as it relates to any of the o

Re: property __doc__

2006-06-30 Thread Robert Kern
David Isaac wrote: > To access the doc string of a property, > I have to use the class not an instance. > Why? Because getting the attribute from the instance gets the calculated value (the value returned from the getter function), not the actual property object. -- Robert Kern "I have come to

property __doc__

2006-06-30 Thread David Isaac
To access the doc string of a property, I have to use the class not an instance. Why? Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Maximize main window with code

2006-06-30 Thread James Stroud
JohnJohnUSA wrote: > I am new to Python. How do I get the following program to appear > initially with the window maximized? Thanks for your help! > > from Tkinter import * > # set up the window itself > top = Tk() > F = Frame(top) > F.pack() > # add the widgets > lHello = Label(F, text="Hello")

Re: pyuno and PDF output

2006-06-30 Thread w chun
On 6/23/06, w chun <[EMAIL PROTECTED]> wrote: > > 2. use the short form to instantiate a PropertyValue > > REPLACE: > PDF = PropertyValue("FilterName", 0, "writer_pdf_Export", 0) > WITH: > PDF = PropertyValue("FilterName", "writer_pdf_Export") after trying this again, i dis

Re: Concatenating strings

2006-06-30 Thread Steven Bethard
John Henry wrote: > I have a list of strings (some 10,000+) and I need to concatenate them > together into one very long string. The obvious method would be, for > example: > > alist=["ab","cd","ef",.,"zzz"] > blist = "" > for x in alist: >blist += x > > But is there a cleaner and faster

Re: Concatenating strings

2006-06-30 Thread Robert Kern
John Henry wrote: > Sorry if this is a dumb question. > > I have a list of strings (some 10,000+) and I need to concatenate them > together into one very long string. The obvious method would be, for > example: > > alist=["ab","cd","ef",.,"zzz"] > blist = "" > for x in alist: >blist += x

Concatenating strings

2006-06-30 Thread John Henry
Sorry if this is a dumb question. I have a list of strings (some 10,000+) and I need to concatenate them together into one very long string. The obvious method would be, for example: alist=["ab","cd","ef",.,"zzz"] blist = "" for x in alist: blist += x But is there a cleaner and faster wa

Concatenating strings

2006-06-30 Thread John Henry
Sorry if this is a dumb question. I have a list of strings (some 10,000+) and I need to concatenate them together into one very long string. The obvious method would be, for example: alist=["ab","cd","ef",.,"zzz"] blist = "" for x in alist: blist += x But is there a cleaner and faster wa

Maximize main window with code

2006-06-30 Thread JohnJohnUSA
I am new to Python. How do I get the following program to appear initially with the window maximized? Thanks for your help! from Tkinter import * # set up the window itself top = Tk() F = Frame(top) F.pack() # add the widgets lHello = Label(F, text="Hello") lHello.pack() bQuit = Button(F, text="

Re: Cycles between package imports

2006-06-30 Thread Martin Blais
On 6/22/06, Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > "Martin Blais" <[EMAIL PROTECTED]> wrote: > > >On 18 Jun 2006 05:25:14 -0700, John Roth <[EMAIL PROTECTED]> wrote: > > > >> The general rule is: don't do that. It doesn't work, and the > >> hoops you hav

ANN: nose 0.9 released

2006-06-30 Thread [EMAIL PROTECTED]
I'm pleased to announce the release of nose 0.9. nose provides an alternate test discovery and running process for unittest, one that is intended to mimic the behavior of py.test as much as is reasonably possible without resorting to too much magic. nose can be installed via easy_install: easy_ins

Re: efficiency question

2006-06-30 Thread Scott David Daniels
David Harvey wrote: > if x in ("abc", "def", "xyz"): > doStuff() > elif x in ("pqr", "tuv", "123"): > doOtherStuff() > elif ... If the code really looks like this: # one-time-only code big_dispatch_table = {} for function, keys in [ (doStuff,

Re: list comprehension

2006-06-30 Thread Simon Forman
Bruno Desthuilliers wrote: > Andy Dingley <[EMAIL PROTECTED]> wrote: > > Simon Forman wrote: > > > >>There's more to it, but that's the basic idea. > > > > This much I knew, but _why_ and _when_ would I choose to use list > > comprehension (for good Python style), rather than using a simple > > "tr

Re: list comprehension

2006-06-30 Thread Simon Forman
a wrote: > hi simon thanks for your reply You're most welcome > what if i want to do this > feed_list=[] > feed_id=[] > for ix in feeds_list_select: > global feeds_list > global feeds_id >

Re: optparse multiple arguments

2006-06-30 Thread Steven Bethard
Ritesh Raj Sarraf wrote: > Now if someone uses it as: > ./foo --my-option a b c > > I want somehow to store all the three arguments Currently optparse doesn't support options with an arbitrary number of arguments. I'm currently working on a optparse-inspired replacement which does support this

Re: list comprehension

2006-06-30 Thread a
hi simon thanks for your reply what if i want to do this feed_list=[] feed_id=[] for ix in feeds_list_select: global feeds_list global feeds_id feeds_list.append(ix.url)

Re: handling unicode data

2006-06-30 Thread Martin v. Löwis
Filipe wrote: > output --- > u'Fran\xd8a' > FranØa > > > > What do you think? Might it be Pymssql doing something wrong? I think the data in your database is already wrong. Are you sure the valu

Re: Newb Tkinter Question: Object has no attribute 'tk'

2006-06-30 Thread Simon Forman
python programming newb wrote: > Hi all, first post. > > I'm new to python and tkinter. I'm trying to write a program that > opens the root window with a button that then opens a toplevel window > that then has it's own widgets. I can get the new toplevel window to > open but none of the widgets

Re: Regular Expression - old regex module vs. re module

2006-06-30 Thread Steve
Hi All! Thanks for your suggestions and comments! I was able to use some of your code and suggestions and have come up with this new version of Report.py. Here's the updated code : - #!/usr/bin/env python """Provides two classes

Re: How to control permission of file?

2006-06-30 Thread Schüle Daniel
> True, but I don't see what it has to do with my question. my mistake, I misunderstood your question as Sreeram said, os.open can be used help(os.open) Help on built-in function open: open(...) open(filename, flag [, mode=0777]) -> fd Open a file (for low level IO). >>> import

Re: How to control permission of file?

2006-06-30 Thread Grant Edwards
On 2006-06-30, Schüle Daniel <[EMAIL PROTECTED]> wrote: >> When one open()s a file (that doesn't exist) for writing , how >> does one control that file's permissions (it's "mode" in Unix >> terms). > > what do you mean by "contor file's mode"? Are you asking what a file's mode is? Under Unix,

Re: How to control permission of file?

2006-06-30 Thread Schüle Daniel
Grant Edwards schrieb: > When one open()s a file (that doesn't exist) for writing , how > does one control that file's permissions (it's "mode" in Unix > terms). what do you mean by "contor file's mode"? usually you try to open and if you are not allowed you will get the exception >>> try: ...

Re: Import bug: Module executed twice when imported!

2006-06-30 Thread Michael Abbott
In article <[EMAIL PROTECTED]>, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > Set __name__ to 'subtest' as it would be if you had really imported > subtest and the import system will correctly name the modules, causing > imptest to be imported only once. Ach. I get it now. -- http://mail.py

Re: Module executed twice when imported!

2006-06-30 Thread Michael Abbott
In article <[EMAIL PROTECTED]>, Georg Brandl <[EMAIL PROTECTED]> wrote: > That's because __name__ is normally set to the module's name in the package > hierarchy. When you set it to "some1.some2", Python thinks it's > in a subpackage A. So what I *should* have set it to is the module name *w

Re: Import bug: Module executed twice when imported!

2006-06-30 Thread Georg Brandl
Peter Maas wrote: > The docs tell us > (http://www.python.org/doc/2.4.2/lib/built-in-funcs.html): > > - begin --- > execfile(filename[, globals[, locals]]) > > This function is similar to the exec statement, but parses a file > instead of a str

Re: Module executed twice when imported!

2006-06-30 Thread Georg Brandl
Michael Abbott wrote: > In article <[EMAIL PROTECTED]>, > John Salerno <[EMAIL PROTECTED]> wrote: > >> > (http://docs.python.org/lib/built-in-funcs.html#l2h-24) >> > "It is different from the import statement in that it does not use the >> > module administration --" >> >> Just after the above s

Newb Tkinter Question: Object has no attribute 'tk'

2006-06-30 Thread python programming newb
Hi all, first post. I'm new to python and tkinter. I'm trying to write a program that opens the root window with a button that then opens a toplevel window that then has it's own widgets. I can get the new toplevel window to open but none of the widgets appear. The console gives me: AttributeEr

Re: Import bug: Module executed twice when imported!

2006-06-30 Thread Peter Maas
Michael Abbott wrote: > In article <[EMAIL PROTECTED]>, > Michael Abbott <[EMAIL PROTECTED]> wrote: > >> --- test.py --- >> import imptest >> execfile('subtest.py', dict(__name__ = 'subtest.py')) >> --- imptest.py --- >> print 'Imptest imported' >> --- subtest.py --- >> import imptest >> --- >> >

Re: How to control permission of file?

2006-06-30 Thread Grant Edwards
On 2006-06-30, K.S.Sreeram <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: >> When one open()s a file (that doesn't exist) for writing , how >> does one control that file's permissions (it's "mode" in Unix >> terms). > > Check out 'os.open' > It returns a file descriptor, and if you need a file o

Re: Reddit broke - should have remained on Lisp?

2006-06-30 Thread Larry Clapp
On 2006-06-30, Luis M. González <[EMAIL PROTECTED]> wrote: > Alok wrote: >> While posting a comment on http://www.reddit.com I got an error >> page with the following curious statement on it. >> >> "reddit broke (sorry)" >> "looks like we shouldn't have stopped using lisp..." >> >> See screenshot a

Re: Regular Expression - old regex module vs. re module

2006-06-30 Thread Jim Segrave
In article <[EMAIL PROTECTED]>, Paul McGuire <[EMAIL PROTECTED]> wrote: >"Jim Segrave" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] > >I can see that the OP omitted the concept of "@|||" centering, since the >Python string interpolation forms only support right or left justified >fi

Re: Immutability

2006-06-30 Thread Georg Brandl
Georg Brandl wrote: > Steve Holden wrote: >> Georg Brandl wrote: >>> Steve Holden wrote: >> [...] >>> Would it make sense, in the single argument case, to default the doc value to fget.__doc__ to support that use case, or should we just not create read-only properties by using proper

Re: Py2exe make wxPython window looks bad

2006-06-30 Thread zdp
Great, thanks all [EMAIL PROTECTED] 写道: > zdp wrote: > > Dear all: > > > > I made a window program by wxPython. Split windows, treectrl, listctrl > > and textctrl are used. When I program in python, the look & feel of the > > window controls are like the windos XP look & feel, with thin and flat

Re: How to control permission of file?

2006-06-30 Thread K.S.Sreeram
Grant Edwards wrote: > When one open()s a file (that doesn't exist) for writing , how > does one control that file's permissions (it's "mode" in Unix > terms). Check out 'os.open' It returns a file descriptor, and if you need a file object you can use 'os.fdopen' on the file descriptor Regards Sr

Re: Reddit broke - should have remained on Lisp?

2006-06-30 Thread Fredrik Lundh
Alok wrote: > Their site was more responsive last year. http://tinyurl.com/zhary -- http://mail.python.org/mailman/listinfo/python-list

How to control permission of file?

2006-06-30 Thread Grant Edwards
When one open()s a file (that doesn't exist) for writing , how does one control that file's permissions (it's "mode" in Unix terms). -- Grant Edwards grante Yow! We just joined the at civil hair patrol!

Re: Regular Expression - old regex module vs. re module

2006-06-30 Thread Paul McGuire
"Jim Segrave" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The poster was excluding escaped (with a '\' character, but I've just > looked up the Perl format statement and in fact fields always begin > with a '@', and yes having no digits on one side of the decimal point > is legal

Re: Module executed twice when imported!

2006-06-30 Thread Michael Abbott
In article <[EMAIL PROTECTED]>, John Salerno <[EMAIL PROTECTED]> wrote: > > (http://docs.python.org/lib/built-in-funcs.html#l2h-24) > > "It is different from the import statement in that it does not use the > > module administration --" > > Just after the above statement, it also says: > > "it

Re: Import bug: Module executed twice when imported!

2006-06-30 Thread Jean-Paul Calderone
On Fri, 30 Jun 2006 19:13:00 +0100, Michael Abbott <[EMAIL PROTECTED]> wrote: >Bump > >In article <[EMAIL PROTECTED]>, > Michael Abbott <[EMAIL PROTECTED]> wrote: > >> --- test.py --- >> import imptest >> execfile('subtest.py', dict(__name__ = 'subtest.py')) >> --- imptest.py --- >> print 'Imptest

Re: efficiency question

2006-06-30 Thread diffuser78
can you please explain how to read these output...I mean how to understand them. A quick glance tells you that the latter approach has less number of instructions and thats why its better. Any more insight would help a lot. MTD wrote: > For the sake of comparison: > > >>> def cod(x): > ... tuppl

Re: Regular Expression - old regex module vs. re module

2006-06-30 Thread Jim Segrave
In article <[EMAIL PROTECTED]>, Paul McGuire <[EMAIL PROTECTED]> wrote: >"Jim Segrave" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> In article <[EMAIL PROTECTED]>, >> Paul McGuire <[EMAIL PROTECTED]> wrote: >> >> >Not an re solution, but pyparsing makes for an easy-to-follow prog

Re: Regular Expression - old regex module vs. re module

2006-06-30 Thread Paul McGuire
"Jim Segrave" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If fails for floats specified as ###. or .###, it outputs an integer > format and the decimal point separately. It also ignores \# which > should prevent the '#' from being included in a format. > Here's a little more stud

Re: string replace

2006-06-30 Thread johnzenger
Check out the .translate method and the string.maketrans documentation. You can use it to delete a list of characters all in one line: >>> s = "I am the walrus" >>> import string >>> s.translate(string.maketrans("",""),"aeiou") 'I m th wlrs' Michele Petrazzo wrote: > Hi, > a lot of times I nee

Re: sum fonction in gadfly

2006-06-30 Thread Robert Hicks
[EMAIL PROTECTED] wrote: > Robert Hicks wrote: > > [EMAIL PROTECTED] wrote: > > > why are people so concerned > > > that it's not changing? > > > > > > > I didn't mean to be irritating and I wasn't concerned about it not > > changing but I could probably have stated the question a little bett

Re: Py2exe make wxPython window looks bad

2006-06-30 Thread diffuser78
My question is not exactly related. In windows you create exe using py2exe. What is the Linux equivalent of it ? I am assuming you just make your .py file executable by doint this. Please correct me if I am wrong. *** chmoad a+c file_name.py

Re: Module executed twice when imported!

2006-06-30 Thread John Salerno
Simon Forman wrote: > I don't get it either but there may be a clue in the docs for the > execfile() function > (http://docs.python.org/lib/built-in-funcs.html#l2h-24) > > "It is different from the import statement in that it does not use the > module administration --" Just after the above stat

Re: sum fonction in gadfly

2006-06-30 Thread aaronwmail-usenet
Robert Hicks wrote: > [EMAIL PROTECTED] wrote: > > why are people so concerned > > that it's not changing? > > > > I didn't mean to be irritating and I wasn't concerned about it not > changing but I could probably have stated the question a little better. > For some reason I thought it was a

Re: efficiency question

2006-06-30 Thread diffuser78
So nice to know this that you can compare your own code using this methodology. I was completely unaware of this. Thank you so much. Fredrik Lundh wrote: > David Harvey wrote: > > > Suppose I write > > > > if x in ("abc", "def", "xyz"): > > doStuff() > > > > elif x in ("pqr", "tuv", "123"): > >

Re: Import bug: Module executed twice when imported!

2006-06-30 Thread Michael Abbott
Bump In article <[EMAIL PROTECTED]>, Michael Abbott <[EMAIL PROTECTED]> wrote: > --- test.py --- > import imptest > execfile('subtest.py', dict(__name__ = 'subtest.py')) > --- imptest.py --- > print 'Imptest imported' > --- subtest.py --- > import imptest > --- > >$ python test.py >Impt

Re: Numeric help!

2006-06-30 Thread Carl Banks
Sheldon wrote: > average(compress(ravel(equal(wk,z)),ravel(sattmp)),axis=None) > This is much more compact and elegant. Thanks for pointing this out. > I don't know why average() returned a divide by zero error and to avoid > this I inserted this if statement. Now it works much better ! Probably

Re: print shell output in a file

2006-06-30 Thread Juho Schultz
Juergen Huber wrote: > hello, > > one more question i will have! > > now i have written a little programm, which delivers me an output on the > shell! > > > Is there a way to put this output in an file?!?! i searched about 2h for > this, but i couldn`t find an answer! > > thnks, juergen Others h

Re: Reddit broke - should have remained on Lisp?

2006-06-30 Thread Pascal Costanza
[EMAIL PROTECTED] wrote: > Kay Schluehr wrote: >> Please, since this is a Python+Lisp cross-thread and you seem to have >> background info: can you explain why Lisp hackers have turned >> themselves into Python newbies for Reddit impl. and finally complain >> about the language switch? What was cau

Re: list comprehension

2006-06-30 Thread [EMAIL PROTECTED]
Andy Dingley <[EMAIL PROTECTED]> wrote: > Simon Forman wrote: > > > There's more to it, but that's the basic idea. > > This much I knew, but _why_ and _when_ would I choose to use list > comprehension (for good Python style), rather than using a simple > "traditional" loop ? To make dynamically ne

Re: Regular Expression - old regex module vs. re module

2006-06-30 Thread Paul McGuire
"Jim Segrave" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > In article <[EMAIL PROTECTED]>, > Paul McGuire <[EMAIL PROTECTED]> wrote: > > >Not an re solution, but pyparsing makes for an easy-to-follow program. > >TransformString only needs to scan through the string once - the > >"r

Re: sum fonction in gadfly

2006-06-30 Thread Robert Hicks
[EMAIL PROTECTED] wrote: > Robert Hicks wrote: > > I haven't been keeping up. Is Gadfly still in development? > > I always find this question a little > irritating -- gadfly is perfect the > way it is :). If it ain't broke don't > fix it. At least until the python guys > make another non-backwar

Re: Way for see if dict has a key

2006-06-30 Thread Georg Brandl
Bruno Desthuilliers wrote: >>> value = dict.get(key, None) >> >> >> value = dict.get(key) > > Yes - but : > 1/ not everybody knows that dict.get() takes a second optional param. > Note that, while it happens that the default return value of dict.get() > is the same as in the above example, but

Re: Chapter 9 Tutorial for Classes Not Working

2006-06-30 Thread John Salerno
tac-tics wrote: >> x = MyClass >> xf = x.f >> while True: >>print xf() > > Python has some VERY nasty gotchas concerning parenthesis (or lack > there of). Is this really a gotcha? I don't think you should blame Python for this mistake. Even a novice programmer like myself can

Re: Regular Expression - old regex module vs. re module

2006-06-30 Thread Paul McGuire
"Jim Segrave" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > If fails for floats specified as ###. or .###, it outputs an integer > format and the decimal point separately. It also ignores \# which > should prevent the '#' from being included in a format. > True. What is the spec

Re: python for windows internet filter / firewall

2006-06-30 Thread Michele Petrazzo
[EMAIL PROTECTED] wrote: > Thanks for a detailed reply. > I thing that now we are becoming OT... :) > because is restricts traffic on a port based on content, but you're > correct, they aren't the same thing at all. > So, what you want to do? Open and close a destination IP (domain), following

fcgi server in python?

2006-06-30 Thread thorley
Does any one know of a fcgi SEVER implementation for python? I've seen lots of great stuff for the client/application side, but not a server. By server, I mean the program that accepts requests from the browser and passes them to the web app over fcgi. Usaually this is done by Apace or Lightttpd,

Re: python for windows internet filter / firewall

2006-06-30 Thread thorley
Thanks for a detailed reply. > Firewall and filter are two things totally separated! Sorry for being to general. I want to create a filter like dansgaurdian. I was thinking of it also as a firewall because is restricts traffic on a port based on content, but you're correct, they aren't the same t

Re: Way for see if dict has a key

2006-06-30 Thread Bruno Desthuilliers
Fredrik Lundh wrote: > Bruno Desthuilliers wrote: > >> Seems that if "key in dict" do a simple linear search > > > that would be rather silly. > > hint: http://pyref.infogami.com/__contains__ Of course. It's just me being silly... :( Thanks F -- bruno desthuilliers python -c "print '@'.joi

Re: Reddit broke - should have remained on Lisp?

2006-06-30 Thread olsongt
Kay Schluehr wrote: > > Please, since this is a Python+Lisp cross-thread and you seem to have > background info: can you explain why Lisp hackers have turned > themselves into Python newbies for Reddit impl. and finally complain > about the language switch? What was cause for their decision to use

Re: handling unicode data

2006-06-30 Thread Filipe
> In summary > > + Depends on what your requirements are, but... > > + Go for ADODBAPI for the widest spread of versions and licenses, but > the least cross-platformability > + Go for Object Craft MSSQL for <= 2.3 and best overall behaviour > + Go for pymssql for >= 2.4 with some small limitations

Re: Way for see if dict has a key

2006-06-30 Thread Fredrik Lundh
Bruno Desthuilliers wrote: > Seems that if "key in dict" do a simple linear search that would be rather silly. hint: http://pyref.infogami.com/__contains__ -- http://mail.python.org/mailman/listinfo/python-list

Re: handling unicode data

2006-06-30 Thread Filipe
Martin v. Löwis wrote: > > What do you mean by "ANSI-to-OEM conversion is enabled"? > > See AutoAnsiToOem in > http://support.microsoft.com/default.aspx?scid=KB;EN-US;199819 > I checked the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Client\DB-Lib", and verified AutoAnsiToOem w

Re: handling unicode data

2006-06-30 Thread Filipe
Marc 'BlackJack' Rintsch wrote: > The `unicode()` call doesn't fail here but the ``print`` because printing > unicode strings means they have to be encoded into a byte string again. > And whatever encoding the target of the print (your console) uses, it > does not contain the unicode character u'\x

Re: handling unicode data

2006-06-30 Thread Filipe
Frank Millman wrote: > You did not mention the odbc module from Mark Hammond's win32 > extensions. This is what I use, and it works for me. I believe it is > not 100% DB-API 2.0 compliant, but I have not had any problems. > > I have not tried connecting to the database from a Linux box (or from > a

Re: Way for see if dict has a key

2006-06-30 Thread Eric Deveaud
Bruno Desthuilliers wrote: > Fredrik Lundh wrote: > > Bruno Desthuilliers wrote: > > > >>> on my machine, "key in dict" is about twice as fast as the full > > > >>> try/getitem construct when the key is present in the dict, > > > >> > >> Doesn't it depends on the number of keys in the dict ? >

Re: Regular Expression - old regex module vs. re module

2006-06-30 Thread Jim Segrave
In article <[EMAIL PROTECTED]>, Paul McGuire <[EMAIL PROTECTED]> wrote: >Not an re solution, but pyparsing makes for an easy-to-follow program. >TransformString only needs to scan through the string once - the >"reals-before-ints" testing is factored into the definition of the >formatters variable

VPW: early registration deadline today!

2006-06-30 Thread Brian Quinlan
What's New? === The deadline for early-bird registration for the Vancouver Python Workshop is today! Early-bird registration is significantly discounted over normal registration, so register now at: http://www.vanpyz.org/conference/registration.html About the Vancouver Python Workshop

Re: Chapter 9 Tutorial for Classes Not Working

2006-06-30 Thread tac-tics
> x = MyClass > xf = x.f > while True: >print xf() Python has some VERY nasty gotchas concerning parenthesis (or lack there of). In the first line here, you assign x = MyClass. That means x becomes an alias for the class MyClass. not an object like you intended. Look back

Re: Way for see if dict has a key

2006-06-30 Thread Alex Martelli
Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Michele Petrazzo wrote: > > > what the preferred way for see if the dict has a key? > > We have a lot of solutions: > > > > key in dict > > new syntax (2.3 and later). Fine with Python 2.2 as well, actually -- so, "new" only in an _extremely_ loose sen

Re: Way for see if dict has a key

2006-06-30 Thread Bruno Desthuilliers
Georg Brandl wrote: > Bruno Desthuilliers wrote: > >> looping wrote: >> >>> Michele Petrazzo wrote: >>> Bruno Desthuilliers wrote: >> but what the better > > > Depends on the context. > If know only one context: see if the key are into the dict... What

Re: Reddit broke - should have remained on Lisp?

2006-06-30 Thread Alok
Fredrik Lundh wrote: > "Alok" wrote: > > > While posting a comment on http://www.reddit.com I got an error page > > with the following curious statement on it. > > > > "reddit broke (sorry)" > > "looks like we shouldn't have stopped using lisp..." > > > > See screenshot at > > http://photos1.blogg

Re: Way for see if dict has a key

2006-06-30 Thread Bruno Desthuilliers
Fredrik Lundh wrote: > Bruno Desthuilliers wrote: > >>> on my machine, "key in dict" is about twice as fast as the full > >>> try/getitem construct when the key is present in the dict, > >> >> Doesn't it depends on the number of keys in the dict ? > > > why would it depend on the number of key

Re: Chapter 9 Tutorial for Classes Not Working

2006-06-30 Thread Ant
> class MyClass: > "A simple example class" > i = 12345 > def f(self): > return 'hello world' Nothing wrong with this. > From here I run: > x = MyClass Here's your problem - x is a class, *not* an instance of a class (i.e. an object). Methods operate on objects, not clas

Re: Chapter 9 Tutorial for Classes Not Working

2006-06-30 Thread Fredrik Lundh
Tom Grove wrote: > I am trying the classes example from the tutorial because some other > class related stuff I am doing is not working either. > > Straight from Chapter 9: > > class MyClass: > "A simple example class" > i = 12345 > def f(self): > return 'hello world' > >

Re: Way for see if dict has a key

2006-06-30 Thread Fredrik Lundh
Paul McGuire wrote: > Another factor to consider is if "default" is not something simple like 0 or > None, but is an object constructed and initialized with some expensive > initialization code (like access to a database). In this case: > > dict.get(key, ExpensiveObjectToCreate()) > > alwa

Re: Way for see if dict has a key

2006-06-30 Thread Fredrik Lundh
Bruno Desthuilliers wrote: >> on my machine, "key in dict" is about twice as fast as the full >> try/getitem construct when the key is present in the dict, > > Doesn't it depends on the number of keys in the dict ? why would it depend on the number of keys in the dict ? -- http://mail.pytho

Re: Reddit broke - should have remained on Lisp?

2006-06-30 Thread Alok
Luis M. González wrote: Luis, Thank you very much for you detailed and careful response. I very much appreciate your comments. > Alok wrote: > > Luis M. González wrote: > > > Alok wrote: > > > > I was merely describing my experience and inviting others' response > > > > about theirs. > > > > >

Re: Chapter 9 Tutorial for Classes Not Working

2006-06-30 Thread Damjan
> class MyClass: > "A simple example class" > i = 12345 > def f(self): > return 'hello world' > > > From here I run: > x = MyClass Did you mean x = MyClass() > xf = x.f > while True: >print xf() > > This gives the following error: > > Traceback (most r

Re: print shell output in a file

2006-06-30 Thread Juergen Huber
hello, if i would type in your code, i became the following output in the "output.txt" - file BOOL | 4 | 50463|201852 but why?! he wouldn´t do that for all the entrys in the csv file! but only for the first one in the file! Stephan Wassipaul wrote: > f = file('output.txt','w'

Chapter 9 Tutorial for Classes Not Working

2006-06-30 Thread Tom Grove
Here is my version: Python 2.4.3 (#2, May 9 2006, 21:56:54) [GCC 3.4.4 [FreeBSD] 20050518] on freebsd6 I am trying the classes example from the tutorial because some other class related stuff I am doing is not working either. Straight from Chapter 9: class MyClass: "A simple example class

Re: XMLLIB

2006-06-30 Thread Stephan Wassipaul
Gnosis (http://gnosis.cx/download/) is able to do this if you mean something like pickling, but with an XML-like ouput. -- http://mail.python.org/mailman/listinfo/python-list

Re: No error while sending via TCP Socket

2006-06-30 Thread Grant Edwards
On 2006-06-30, Martin Bürkle <[EMAIL PROTECTED]> wrote: > I have writen a programm using TCP sockets. After i get the > connection to another socket I cut the Ethernet cable. Then I > send a message. The program doesnt raise any exception. Can > somebody tell me why Because send() has successfull

Re: Regular Expression - old regex module vs. re module

2006-06-30 Thread Paul McGuire
"Steve" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi All, > > I'm having a tough time converting the following regex.compile patterns > into the new re.compile format. There is also a differences in the > regsub.sub() vs. re.sub() > > Could anyone lend a hand? > > Not an re so

Re: print shell output in a file

2006-06-30 Thread Stephan Wassipaul
f = file('output.txt','w') print >>f, '%-30s | %-12d | %-12d |%-12d ' % (typename, size / count, count, size) f.close() > hello, > > one more question i will

Re: print shell output in a file

2006-06-30 Thread tac-tics
It sounds like you want to use print >> If you have an open object with a "write" property, you can do print >> thefile, mystring and Python will simply redirect the output to "thefile" instead of sys.stdout. -- http://mail.python.org/mailman/listinfo/python-list

Re: string replace

2006-06-30 Thread Jim Segrave
In article <[EMAIL PROTECTED]>, Michele Petrazzo <[EMAIL PROTECTED]> wrote: >Hi, >a lot of times I need to replace more than one char into a string, so I >have to do something like > >value = "test" >chars = "e" >for c in chars: > value = value.replace(c, "") > >A solution could be that "replace

No Cookie: how to implement session?

2006-06-30 Thread Kornkatz88
I don't understand the reason for 'Cookies'. When you are pay to belong to AOL or another network why is it necessary to set up an additional address in order to be able to have access to some information? We are not all computer talented, even at this date. Some of us only use it for convenienc

Re: Icono en wxpython

2006-06-30 Thread gbsuar
Thank. But I to solve my problem. On other hand I commented that I writed a litle program for to send and to recive data from the Serial Port in byte format, no chars. I wanted publish this GNU program in brief. Do you would like to translate to frances? Thank -- http://mail.python.org/mailman/li

Re: string replace

2006-06-30 Thread Tim Chase
> a lot of times I need to replace more than one char into a > string, so I have to do something like > > value = "test" > chars = "e" > for c in chars: >value = value.replace(c, "") > > A solution could be that "replace" accept a tuple/list of > chars, like that was add into the new 2.5 for

Re: string replace

2006-06-30 Thread Schüle Daniel
> A solution could be that "replace" accept a tuple/list of chars, like > that was add into the new 2.5 for startswith. > > I don't know, but can be this feature included into a future python > release? I don't know, but I think it would be useful as for now I use this >>> import re >>> cha

RE: string replace

2006-06-30 Thread Cihal Josef
Hi Mechele, In string s u want to replace string "b" or "c" to -> "x" import re s ="a1b2c3" re.sub("[bc]","x",s) Sincerely josef Josef -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michele Petrazzo Sent: Friday, June 30, 2006 4:03 PM To: pytho

  1   2   >