Which is better: using an if/else construct to simulate a C switch or
use a dictionary? Example:
def foo():
if c == 1:
doCase1()
elif c == 2:
doCase2()
elif c == 3:
doCase3()
elif c == 4:
doCase4()
elif c == 5:
doCase5()
else:
raise "shouldn't
On Mon, 18 Jun 2007 05:28, faulkner <[EMAIL PROTECTED]> wrote:
>On Jun 18, 12:35 am, Matt Chisholm <[EMAIL PROTECTED]> wrote:
>> Hi. I was wondering if there had ever been an official decision on
>> the idea of adding labeled break and continue functionality to Python.
>
>python-dev just mentione
Dear Experts,
How does one use pdb and doctest.testmod(raise_on_error=True)? What I would
like to happen is that when a doctest fails (e.g., by raising an exception),
I can do import pdb; pdb.pm() to figure out what went wrong. But when I do
pdb.pm() I end up in doctest.DebugRunner.report_unexpec
En Tue, 19 Jun 2007 14:57:10 -0300, <[EMAIL PROTECTED]> escribió:
>> > #win32event.WAIT_TIMEOUT = 2 --- This just makes the loop
>> > never execute because
>> > # the WaitFor... part always returns 258
>>
>> WAIT_TIMEOUT is 258. How do you see it is 2?
>> py> import win32event
>> p
asincero ha escrit:
> def foo():
>def doCase1():
> pass
>def doCase2():
> pass
>def doCase3():
> pass
>def doCase4():
> pass
>def doCase5():
> pass
>
>handle_case = {}
>handle_case[1] = doCase1()
>handle_case[2] = doCase2()
>handle_
Hi:
I want to redirect stdout to a textctrl I have. From what I read in
the wxpython documentation, I can use the wxLogTextCtrl class to do
this. I am doing the following:
class MyGui(gui.MyFrame): #gui.MyFrame generated by wxGlade
def __init__(self, *args, **kwds):
gui.MyFrame.__ini
Ed wrote:
> On 19 Juni, 07:14, Harry George
>> I've used emacs since the 1980's.
> ...
>> --
>> Harry George
>> PLM Engineering Architecture
>
> I've asked this question on an emacs forum and got no response, so I
> presume the answer is no, but I see, Harry, that you're a veteran, so
> maybe you'
On 6/19/07, Stef Mientki <[EMAIL PROTECTED]> wrote:
> hello,
>
> I need to search a piece of text and make all words that are equal
> (except their case) also equal in their case, based on the first occurrence.
> So I'm using a dictionary to store names and attributes of objects.
> As as I need to
Hi there,
unfortunately, I'm compelled to apply a sort of monkey patching at the
code of an existing libreary that I can't modify directly.
Here's my question
Having such code:
class test:
def caller(self):
self.b()
def called(self):
pass
...(if it is possible) how can I
Mirko Dziadzka wrote:
> Hi all
>
> I'm playing around with metaclasses and noticed, that there is small
> but mesurable a performance difference in the code shown below. With a
> more complex example I get a 5 percent performance penalty for using a
> metaclass. Until today I assumed, that a meta
Matt Chisholm schrieb:
> On Mon, 18 Jun 2007 05:28, faulkner <[EMAIL PROTECTED]> wrote:
>
>> On Jun 18, 12:35 am, Matt Chisholm <[EMAIL PROTECTED]> wrote:
>>
>>> Hi. I was wondering if there had ever been an official decision on
>>> the idea of adding labeled break and continue functionali
billiejoex schrieb:
> Hi there,
> unfortunately, I'm compelled to apply a sort of monkey patching at the
> code of an existing libreary that I can't modify directly.
> Here's my question
> Having such code:
>
> class test:
>
> def caller(self):
> self.b()
>
> def called(self):
>
Hi,
I would like to be able to control Firefox through Python. I see
there's pyWinAuto, which might work if they had good documentation.
I've also messed with win32 modules, but I don't think Firefox will
work with those too nicely since it isn't a COM-based program.
I've also found some Python F
> ...(if it is possible) how can I get, from method "called", the name
> of function/method that called it (in this case "caller")?
The traceback module will give you access to the call stack.
>>> import traceback
>>> def foo():
... return traceback.extract_stack()
...
>>> def bar():
...
> Is there any simple way to fix this damned bug??
Sure: just fixed your damned code!!
Regards,
Marttin
--
http://mail.python.org/mailman/listinfo/python-list
First, sorry about the mess, let see if kontact works better with
newsgroups.
Marc 'BlackJack' Rintsch wrote:
>> ok but my problem is not understand what is the specific problem at line
>> 1173
>
> You can't just look at that line and ignore the rest. There are 604 (!)
> errors, some about tabl
Evan Klitzke wrote:
> On 6/19/07, Stef Mientki <[EMAIL PROTECTED]> wrote:
>> hello,
>>
>> I need to search a piece of text and make all words that are equal
>> (except their case) also equal in their case, based on the first
>> occurrence.
>> So I'm using a dictionary to store names and attributes
Diez B. Roggisch wrote:
> With other OOP languages you mean Java. Which does have static
> methods because they lack the notion of a function by its own, so
> the shoehorned them into their "everything is inside a
> class"-paradigm.
ACK, but doesn't C++ have static methods too?
Regards,
Björn
On 19 Giu, 22:50, Stefan Sonnenberg-Carstens
<[EMAIL PROTECTED]> wrote:
> billiejoex schrieb:
>
>
>
> > Hi there,
> > unfortunately, I'm compelled to apply a sort of monkey patching at the
> > code of an existing libreary that I can't modify directly.
> > Here's my question
> > Having such code:
>
William Allison wrote:
> Not a tutorial, but I found this little snippet:
>
> http://www.ibiblio.org/obp/pyBiblio/tips/elkner/vim4python.php
>
> I thought the last line was especially neat.
Nice. Thanks to you two, I'm going to try that out.
Regards,
Björn
--
BOFH excuse #414:
tachyon emi
On Jun 19, 3:16 pm, Alejandro <[EMAIL PROTECTED]> wrote:
> Hi:
>
> I want to redirect stdout to a textctrl I have. From what I read in
> the wxpython documentation, I can use the wxLogTextCtrl class to do
> this. I am doing the following:
>
> class MyGui(gui.MyFrame): #gui.MyFrame generated by wxG
[EMAIL PROTECTED] wrote:
> On Jun 19, 3:27 pm, Ben Finney
>> And as "peter" mentions, it awaits only someone doing that work
>> and contributing it to Python. Those who can't see why it would
>> be hard are welcome to do so.
>
> The classic answer.
Yes, because of the classic problem with unsala
On Jun 19, 10:50 pm, Stefan Sonnenberg-Carstens
<[EMAIL PROTECTED]> wrote:
> billiejoex schrieb:
> > ...(if it is possible) how can I get, from method "called", the name
> > of function/method that called it (in this case "caller")?
> inspect.stack is your friend ;-)
If you start doing such thing
Matt Haggard wrote:
> I'm using PIL (Python Imaging Library) to generate button images.
> They consist of a left end image, a middle, repeating image and a
> right side image anyway, that's not important
>
> I'm using a TTF font for the text of the button (Verdana.TTF) and it
> keeps cutting t
I am trying to run the agent on one machine that will execute the script
of a remote machine.
Could you please help me in this regards.
vikas
"Legal Disclaimer: This electronic message and all contents contain information
from Cybage Software Private Limited which may be privileged, conf
Sérgio Monteiro Basto wrote:
> but is one single error that blocks this.
> Finally I found it , it is :
> if I put :
>
> p = re.compile('"align')
> content = p.sub('" align', content)
>
> I can parse the html
> I don't know if it a bug of HTMLParser
Sure, and next time your key doesn't open y
asincero <[EMAIL PROTECTED]> wrote:
> Which is better: using an if/else construct to simulate a C switch or
> use a dictionary? Example:
Here is a technique I've used a lot. I think I learnt it from "Dive
into Python"
class foo(object):
def do_1(self):
print "I'm 1"
Hi!
See Mozlab: http://dev.hyperstruct.net/mozlab
and give a report, please.
Thank you in advance.
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
Neil Cerutti <[EMAIL PROTECTED]> writes:
> |>oug writes:
>> Sussman's statements are not ironic because Scheme is a
>> language that is designed to be extended by the end-user (even
>> syntactically), while keeping the core language minimal. This
>> is a rather different design philosophy from t
Although it is not present in ANSI C, the GNU version of stftime
supports the conversion character %z, which is a time offset from GMT.
The four digit time offset is required in RFC 2822 dates/times, and is
used by a number of other programs as well. I need to convert times
that use this convention
billiejoex wrote:
> Hi there,
> unfortunately, I'm compelled to apply a sort of monkey patching at the
> code of an existing libreary that I can't modify directly.
> Here's my question
> Having such code:
>
> class test:
>
> def caller(self):
> self.b()
>
> def called(self):
>
billiejoex wrote:
> Hi there,
> unfortunately, I'm compelled to apply a sort of monkey patching at the
> code of an existing libreary that I can't modify directly.
> Here's my question
> Having such code:
>
> class test:
>
> def caller(self):
> self.b()
>
> def called(self):
>
David Rushby wrote:
> On Jun 19, 4:28 pm, John Machin <[EMAIL PROTECTED]> wrote:
>> On Jun 19, 9:17 pm, Kai Rosenthal <[EMAIL PROTECTED]> wrote:
>>
>>> Hello,
>>> how can I determine the architecture (32 or 64bit) with python 2.2 on
>>> Windows or Unix (AIX, Solaris) OS, without the modul platform?
Thank you for all the responses. In light of what you've told me I
have gone back to storing my specific dictionaries in text files and
then reading them in to the class.
Thank you,
Nik
--
http://mail.python.org/mailman/listinfo/python-list
Stef Mientki wrote:
> Evan Klitzke wrote:
>> On 6/19/07, Stef Mientki <[EMAIL PROTECTED]> wrote:
>>> hello,
>>>
>>> I need to search a piece of text and make all words that are equal
>>> (except their case) also equal in their case, based on the first
>>> occurrence.
>>> So I'm using a dictionary
Evan Klitzke wrote:
> Although it is not present in ANSI C, the GNU version of stftime
> supports the conversion character %z, which is a time offset from GMT.
> The four digit time offset is required in RFC 2822 dates/times, and is
> used by a number of other programs as well. I need to convert ti
On Jun 19, 8:13 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote:
> Rob Cowie wrote:
> > I currently use easy_install to install packages from a custom,
> > locally hosted package_index. The index consists of a single html doc
> > with a list of package names and urls. All works well.
>
> > I would like
"Douglas Alan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
|| But it wasn't based on a "misquote of Tim Peters"; it was based on an
| *exact* quotation of Tim Peters.
My mistake. The misquotation is in the subject line and other's posts here
and in other threads.
| > and a mis
On Jun 19, 10:49 am, [EMAIL PROTECTED] wrote:
> Hello all,
>
> I've been trying to get Python to cross compile to linux running on an
> ARM. I've been fiddling with the cross compile patches
> here:http://sourceforge.net/tracker/index.php?func=detail&aid=1597850&grou...
>
> and I've had some succe
"Terry Reedy" <[EMAIL PROTECTED]> writes:
> Nonetheless, picking on and characterizing Tim's statement as
> anti-flexibility and un-scientific is to me writing of a sort that I
> would not tolerate from my middle-school child.
Now it is you who are taking Sussman's comments out of context.
Sussma
On Tue, 19 Jun 2007 17:46:35 -0400, Douglas Alan wrote:
> I think that most people who program in Scheme these days don't do it
> to write practical software. They either do it to have fun, or for
> academic purposes. On the other hand, most people who program in
> Python are trying to get real
Steven D'Aprano <[EMAIL PROTECTED]> writes:
> On Tue, 19 Jun 2007 17:46:35 -0400, Douglas Alan wrote:
>> I think that most people who program in Scheme these days don't do it
>> to write practical software. They either do it to have fun, or for
>> academic purposes. On the other hand, most peop
Robert Bauck Hamar <[EMAIL PROTECTED]> wrote:
> Jerry Hill wrote:
>> On 6/15/07, HMS Surprise <[EMAIL PROTECTED]> wrote:
>>> I want to print a count down timer on the same line. I tried
>>> print '\r', timeLeft,
>>> which just appends to the same line.
>> Sounds to me like whatever you're p
I expressed my creativity & created two routines, listsort & dictsort.
def listsort(l,cmp=None): l.sort(cmp); return l
def dictsort(d,cmp=None):return [(k,d[k])for k in listsort(d.keys(),cmp=cmp)]
Basically I am more familiar with sorting inside a for loop, eg in
bourne shell one can do "for lo
This is a wxPython question.. the wxPython group is pretty much
inactive.
I have an MDI parent frame and child frame set up. In the child frame,
I want to use part of the frame to display the output from a .py that
is mainly matplotlib (a graph) in a section of the frame. How can I
get it to autom
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
> On Jun 19, 3:27 pm, Ben Finney <[EMAIL PROTECTED]>
> wrote:
> > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
> > > Just to be more precise: curses is not a requirement, a
> > > multi-platform console library with a single API is. So are there
>
How do I transfer the file name which is input in one .py (an MDI
parent frame in wxPython) to another .py (an MDI child frame)? The
parent gets the file name from the user via a file select dialog, but
the child frame is the one that needs to know what file it is working
with.
Thanks
--
http://
asincero <[EMAIL PROTECTED]> writes:
> def foo():
>def doCase1():
> pass
>def doCase2():
> pass
>def doCase3():
> pass
>def doCase4():
> pass
>def doCase5():
> pass
>
>handle_case = {}
>handle_case[1] = doCase1()
>handle_case[2] = doCas
Tobiah <[EMAIL PROTECTED]> writes:
> Can I do:
>
> getattr(current_module, 'foo')
>
> where 'current_module' is a handle the the one
> that the code is in? Just like
The python-list archives
http://mail.python.org/pipermail/python-list/> are your friend.
Google is able to search within a site h
I barely even know how to program in python. I downloaded this
easygui, and I was writing useful gui application within a few
minutes. I can hardly believe it.
Any other noobs here, you may want to give this a try.
http://www.ferg.org/easygui/
--
http://mail.python.org/mailman/listinfo/python-l
> In python I must kick off a sort on the line before I start the
> iteration. (This does make sense because at the end of the day the sort
> has complete BEFORE the for loop can proceed - that is... until the day
> when python lists have a secondary index ;-).
>
> group_list=group_dict.keys()
> g
Greetings,
I have been working on a little project today to help me better
understand classes in Python (I really like Python). I am a self
taught programmer and consider myself to fall in the "beginner"
category for sure. It was initially sparked by reading about "state
machines". This was my att
En Tue, 19 Jun 2007 05:14:58 -0300, EuGeNe Van den Bulke
<[EMAIL PROTECTED]> escribió:
> I am trying to use the poplib library to get emails using the retr
> method. The small program bellow works but the message aren't flagged as
> read which puzzles me. I believe the pop server is qmail 1.0.6
--- Douglas Alan <[EMAIL PROTECTED]> wrote:
>
> For the record, I have a huge problem with
> NIH-syndrome, and think
> that every programming language in the world could
> learn a thing or
> two from what other languages have gotten right.
>
Which should includes natural languages in my opinion
Choice answer. It exactly hit the mark.
I implemented "sorted" as follows:
#!/usr/bin/env python
d=dict(zip("cba",(2,1,3)))
for k in sorted(d,key=lambda k: d[k]): print k,d[k]
Output:
b 1
c 2
a 3
I am glad I asked. Now I know.
Thanᚷ
NevilleDNZ
On Wed, 2007-06-20 at 02:57 +0200, BJörn Lindqv
Stefan Behnel wrote:
> Sérgio Monteiro Basto wrote:
>> but is one single error that blocks this.
>> Finally I found it , it is :
>> > if I put :
>> >
>> p = re.compile('"align')
>> content = p.sub('" align', content)
>>
>> I can parse the html
>> I don't know if it a bug of HTMLParser
>
> Sure,
En Tue, 19 Jun 2007 19:40:10 -0300, Steven Bethard
<[EMAIL PROTECTED]> escribió:
> Stef Mientki wrote:
>> Evan Klitzke wrote:
>>> On 6/19/07, Stef Mientki <[EMAIL PROTECTED]> wrote:
I need to search a piece of text and make all words that are equal
(except their case) also equal i
Steven D'Aprano <[EMAIL PROTECTED]> writes:
> So, once you've succeeded in your campaign to make Python more like
> Scheme, what language will you use for getting real work done?
>
> And how long will it take before Schemers start agitating for it to become
> more like Scheme?
While you've dutifu
En Tue, 19 Jun 2007 16:34:50 -0300, Steven Bethard
<[EMAIL PROTECTED]> escribió:
> Tobiah wrote:
>>
>> getattr(current_module, 'foo')
>>
>> where 'current_module' is a handle the the one
>> that the code is in? Just like
>
> You can try __import__() with __name__::
>
> >>> foo = 42
>
En Tue, 19 Jun 2007 18:06:40 -0300, billiejoex <[EMAIL PROTECTED]> escribió:
> On 19 Giu, 22:50, Stefan Sonnenberg-Carstens
> <[EMAIL PROTECTED]> wrote:
>> billiejoex schrieb:
>>
>>
>> > ...(if it is possible) how can I get, from method "called", the name
>> > of function/method that called it (in
En Tue, 19 Jun 2007 21:57:30 -0300, BJörn Lindqvist <[EMAIL PROTECTED]>
escribió:
> It's not true that the sort must complete (or that the whole file must
> be read for that matter), Python has cool generators which makes the
> above possible.
That's not possible, the input must be read complet
On Jun 19, 6:34 pm, [EMAIL PROTECTED] wrote:
> Greetings,
>
> I have been working on a little project today to help me better
> understand classes in Python (I really like Python). I am a self
> taught programmer and consider myself to fall in the "beginner"
> category for sure. It was initially sp
En Tue, 19 Jun 2007 22:34:27 -0300, <[EMAIL PROTECTED]> escribió:
> I have been working on a little project today to help me better
> understand classes in Python (I really like Python). I am a self
> taught programmer and consider myself to fall in the "beginner"
> category for sure. It was initi
I am using Python to process particle data from a physics simulation.
There are about 15 MB of data associated with each simulation, but
there are many simulations. I read the data from each simulation into
Numpy arrays and do a simple calculation on them that involves a few
eigenvalues of small m
Thank you both for the insightful responses(I knew I came to the right
place)!
Steven -- The original inspiration was a "State Machine" your code re-
write was what I was trying to accomplish but quickly got in way over
my head. Thank you for expanding on that aspect of it. That will give
me some
On 6/19/07, Paul Boddie <[EMAIL PROTECTED]> wrote:
> Evan Klitzke wrote:
> > Although it is not present in ANSI C, the GNU version of stftime
> > supports the conversion character %z, which is a time offset from GMT.
> > The four digit time offset is required in RFC 2822 dates/times, and is
> > use
none wrote:
> Gabriel Genellina wrote:
>
>> En Mon, 18 Jun 2007 16:38:18 -0300, Sergio Monteiro Basto
>> <[EMAIL PROTECTED]> escribió:
>>
>>> Can someone explain me, what is wrong with this site ?
>>>
>>> python linkExtractor3.py http://www.noticiasdeaveiro.pt > test
> ok but my problem is not u
Does the script resides on the remote machine or do we have to transfer the
script to the remote machine.If remote and agent machine are linux then you
can use rsh/ssh to do so.
On 6/19/07, Vikas Saini <[EMAIL PROTECTED]> wrote:
I am trying to run the agent on one machine that will execute the
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have been working at this problem, and I think I need a permutation
> algorithm that does
> the following:
>
> Given a list of elements that are either a character or a character
> follows by a number, e.g.
>
> ['a', 'b', 'c1', 'd', 'e1',
On 6/19/07, Bjoern Schliessmann
<[EMAIL PROTECTED]> wrote:
> BartlebyScrivener wrote:
> > VIM
>
> *clap-clap*
>
> BTW, are there tutorials on the more arcane vim functions that come
> in handy with Python?
I don't know of any vim functions that are python specific, but to me
the two somewhat arcan
On 6/19/07, Vikas Saini <[EMAIL PROTECTED]> wrote:
> I am trying to run the agent on one machine that will execute the script of
> a remote machine.
It's not clear what OS you're using. But if you're running a
Unix/Linux system and it's a relatively simple script that you want to
run, you should j
billiejoex wrote:
> Hi there,
> unfortunately, I'm compelled to apply a sort of monkey patching at the
> code of an existing libreary that I can't modify directly.
...
>
> ...(if it is possible) how can I get, from method "called", the name
> of function/method that called it (in this case "caller
On Jun 20, 12:37 pm, [EMAIL PROTECTED] (Alex Martelli) wrote:
> [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > Hi,
>
> > I have been working at this problem, and I think I need apermutation
> > algorithm that does
> > the following:
>
> > Given a list of elements that are either a character or a
Kai Rosenthal schrieb:
> how can I determine the architecture (32 or 64bit) with python 2.2 on
> Windows or Unix (AIX, Solaris) OS, without the modul platform?
On Windows, the architecture is always 32-bit, as Python 2.2 does not
support Win64. On Unix, looking for sys.maxint is enough for AIX
and
>> What happens when you fire up a 64-bit Python and type
>> import sys; sys.maxint
>> at it?
>
> That's not suitable, because of the differences between LP64 and LLP64
> (http://en.wikipedia.org/wiki/64-bit#64-bit_data_models ).
For the systems that the OP mentioned, sys.maxint is just fine:
This Saturday we'll be holding our 4th Saturday meeting of the DFW Pythoneers,
at the usual location of Nerdbooks.com bookstore in Richardson. For
directions, visit the Nerdbooks.com website. We start at 2pm and run until
5pm, and then go out for a group dinner.
At this meeting one of our local
The os I am using is window Xp.
Thanks&Regards,
Vikas Saini
Do or do not. There is no try.
-Original Message-
From: Evan Klitzke [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 20, 2007 10:21 AM
To: Vikas Saini
Cc: python-list@python.org
Subject: Re: Execute script
On 6/19/07, Kai Rosenthal <[EMAIL PROTECTED]> wrote:
> Hello,
> how can I determine the architecture (32 or 64bit) with python 2.2 on
> Windows or Unix (AIX, Solaris) OS, without the modul platform?
> Thanks for your hints, Kai
For Unix systems you can probably use os.uname() and check what
archit
> Alright, I looked into this a little more, and those symbols
> definitely exist in my compiled python executable. How are extensions
> linked to the python interpreter?
Python assumes that extension modules can be linked against the
executable, i.e. that *at run-time* those symbols will get
reso
Hi,
Is there a script available online something similar that can
connect to the database, get the regression database results and
display a graph of pass rate onto the web page.
Thanks in advance,
Regards,
VishnuMohan
--
http://mail.python.org/mailman/listinfo/python-list
On Jun 19, 9:21 pm, Ed <[EMAIL PROTECTED]> wrote:
>
> Have you ever seen an, "Extractmethod," function for emacs? Whereby
> you highlight some lines of code, press a key, and the code is whisked
> into its ownmethod, with the appropriatemethodinvocation left in
> its place. If you could post a link
On Wed, 20 Jun 2007 02:57:30 +0200, BJörn Lindqvist
wrote:
> It's not true that the sort must complete (or that the whole file must
> be read for that matter)
That would be a really good trick. How are you supposed to know which
item comes first until you've seen them all?
--
Steven.
--
http
Douglas Alan wrote:
> I think that most people who program in Scheme these days don't do it
> to write practical software. They either do it to have fun, or for
> academic purposes. On the other hand, most people who program in
> Python are trying to get real work done. Which is precisely why I
Michele Simionato <[EMAIL PROTECTED]> writes:
> I see Python or C as much better practical implementations
> of Sussman's quote about minimalism than real Scheme (for
> an example of real Scheme, I refer for instance to the PLT
> implementation).
Python and C as programming languages are like demo
101 - 184 of 184 matches
Mail list logo