> By the way, don't be tempted to write a bare except clause:
>
> try:
> ...
> except:
> ...
>
> There are very few reasons for such a thing, as they are too broad and
> catch too many things, masking errors, preventing user keyboard
> interrupts, etc. Avoid them.
Doh! That is what I did :)
Thanks Alan,
For clarify that. The speed is not an issue people just need config
files generated from xml to feed EDA simulations and validations tools.
Karim
On 08/12/2010 09:39 AM, Alan Gauld wrote:
"Karim" wrote
Anyway, you're right I found what I needed at:
http://sourceforge.net/pro
On Fri, 13 Aug 2010 11:56:31 am Pete wrote:
> Hi,
>
> I've been writing some code which uses callbacks. I have not used
> callbacks much before, but it does not seem too difficult so far.
>
> One thing though - I noticed that when an exception is raised in the
> callback function, that exception do
Hi,
I've been writing some code which uses callbacks. I have not used callbacks
much before, but it does not seem too difficult so far.
One thing though - I noticed that when an exception is raised in the callback
function, that exception doesn't actually "show up" in the calling program.
Two
Hi: Thank you very much for the detailed reply. My problem is I know I am
doing the indentation wrong; but I cannot get it right in IDLE.
Could you take a look at this please:
>>> x=3
>>> if x==0:
print "x is 0"
>>> elif x&1==1:
SyntaxError: invalid syntax
See, the moment I am pressing Enter the
Thank you Karim.. the code is not actually part of anything... but is a
textbook example, literally (Python Power by Matt Telles).
On Wed, Aug 11, 2010 at 9:59 AM, Karim wrote:
>
> Hello,
>
> This code works for me:
>
>
> >>> x=3
> >>> if x==0:
> ... print "x is 0"
> ... elif x&1 ==1:
> ...
Thank you Adam.
On Tue, Aug 10, 2010 at 7:03 PM, Adam Bark wrote:
> On 11/08/10 02:34, Sudarshana Banerjee wrote:
>
> Hi: I am trying to teach myself Python, and am stuck at the indentation
> with the elif statement.
>
> This is what I am trying to type (as copied from the textbook):
>
> x=3
>
On Thu, Aug 12, 2010 at 6:35 AM, Steven D'Aprano wrote:
> On Thu, 12 Aug 2010 04:59:26 pm Chris Fuller wrote:
> > The preferred and most graceful way is to use neither, as others have
> > pointed out. However, you can't return an exit code that way
>
> Of course you can. Exiting out the end of th
> > def __init__(self, value):
> > self.text(value)
>
> self.text = value # is the way to do this, if you're using it as a
> property.
>
> That worked perfectly! So it seems I was botching the syntax. Many thanks
for the quick response!!
Serdar
> Does anyone know if it's possible to call a property setter inside of a
> class's init method? Below is a code sample of what I'm trying to do.
Just a quick guess:
> class Question(object);
replace the semi-colon with a colon (I assume it's just a typo, since you don't
get an error for th
Hey all,
Does anyone know if it's possible to call a property setter inside of a
class's init method? Below is a code sample of what I'm trying to do.
class Question(object);
def __init__(self, value):
self.text(value)
@property
def text(self):
return self._text
ANKUR AGGARWAL wrote:
> Hey- suppose we have a file name-"my file number"
> if we want to execute it into the terminal it would be like - my\ file\
> number
>
> so wondering is there any one in the python that change the enter string
> into the terminal string one-
> like if user enter the file n
On Thu, 12 Aug 2010 04:59:26 pm Chris Fuller wrote:
> The preferred and most graceful way is to use neither, as others have
> pointed out. However, you can't return an exit code that way
Of course you can. Exiting out the end of the program returns an exit
code of zero, and raising an uncaught e
> Ok. I appreciate ur response and its gud somewhat... But we dont have only
> space=" " . this '\' rules also applies to '(' ')' and all that stuff also...
> so i was looking for the builtin function that fully converts it... Is there
> any one??
This may depend on your system, but generally,
Evidenca B d.o.o. wrote:
Hi.
I have a problem. I am making pa program which, makes a .txt document, the
problem is in my language have special character like this: č,š,ž. They don
t appear in aschi code, but you can find them in UTF-8 code. So wen I wont
to save with writelines a string with
> a = "my file number"
> a.replace(' ', '\\ ')
>> 'my\\ file\\ number'
>
> What if a has more than 1 space between words? Then I think this would
> be a safer way.
>
print "\\ ".join("my file number".split())
> my\ file\ number
If those spaces are in the actual filename, you'll wa
On 12 August 2010 12:07, Sander Sweers wrote:
> Deque took 0.009195 seconds
> 693.01178383827209 / 10 (default times run by timeit)
Messed up the deque results :(
Deque took 0.009195 seconds
919.49732708930969 / 10 (default times run by timeit)
Greets
Sander
On 12 August 2010 10:40, Evert Rol wrote:
a = "my file number"
a.replace(' ', '\\ ')
> 'my\\ file\\ number'
What if a has more than 1 space between words? Then I think this would
be a safer way.
>>> print "\\ ".join("my file number".split())
my\ file\ number
Greets
Sander
__
Knacktus wrote:
Hi everyone,
I'm wondering what's the fastet datatype in python to lookup the last
element in an ordered collection. I know about lists, of course, and
read about deques. As I understand deques have better performance for
popping and adding elements, but I didn't understand wh
On 12 August 2010 09:44, Alan Gauld wrote:
>> I'm wondering what's the fastet datatype in python to lookup the last
>> element in an ordered collection.
>
> When in doubt timeit()
Out of curiosity I used timeit and lists are faster if we iterate over
them one by one. Now this is my first go with
> Hey- suppose we have a file name-"my file number"
> if we want to execute it into the terminal it would be like - my\ file\ number
>
> so wondering is there any one in the python that change the enter string into
> the terminal string one-
> like if user enter the file name with path- "my file
Hey- suppose we have a file name-"my file number"
if we want to execute it into the terminal it would be like - my\ file\
number
so wondering is there any one in the python that change the enter string
into the terminal string one-
like if user enter the file name with path- "my file number". i wa
The preferred and most graceful way is to use neither, as others have pointed
out. However, you can't return an exit code that way, and it sometimes isn't
feasible to structure your code to allow it. I prefer SystemExit, because it
doesn't require adding something to the namespace (the sys mo
"Knacktus" wrote
I'm wondering what's the fastet datatype in python to lookup the
last element in an ordered collection.
When in doubt timeit()
But I would expect a standard list to be prettyy fast isf you are
only concerned about accessing the last element [-1]
Also, the collections will
"Karim" wrote
Anyway, you're right I found what I needed at:
http://sourceforge.net/projects/elmer/files/elmer/elmer1.1.5/elmer1.1.5.tar.gz/download
This is the open source Elmer distribution.
OK, glad you found something and I'm sure it will be worth a try.
But I'm pretty sure it will hav
25 matches
Mail list logo