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.
> > >
> >
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
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
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'
>
>
> 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
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
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
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
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
> 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
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
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
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 ?
>
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
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
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
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
> 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
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
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
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
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,
[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
"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
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
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
[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
"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
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
[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
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
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
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
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"):
> >
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
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
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
[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
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
"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
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
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
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
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
"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
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!
Alok wrote:
> Their site was more responsive last year.
http://tinyurl.com/zhary
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
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
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
>> ---
>>
>
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
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
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
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
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
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:
...
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,
> 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
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
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
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
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)
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
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
>
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
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,
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
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
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="
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
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
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
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
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
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")
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
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
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
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
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
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)
>
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
101 - 186 of 186 matches
Mail list logo