Keep the try block small. For example if it's for a call to
open(filename, r) the only possible errors (assuming correct syntax)
are NameError for using an undefined variable and IOError for
specifying a file which doesnt exist.
Thanks. Since I'm new at this the error lists I saw just had the
On 22 May 2013 07:20, Jim Mooney cybervigila...@gmail.com wrote:
Keep the try block small. For example if it's for a call to
open(filename, r) the only possible errors (assuming correct syntax)
are NameError for using an undefined variable and IOError for
specifying a file which doesnt exist.
On Tue, May 21, 2013 at 11:25 PM, Bod Soutar bod...@googlemail.com wrote:
On 22 May 2013 07:20, Jim Mooney cybervigila...@gmail.com wrote:
Keep the try block small. For example if it's for a call to
open(filename, r) the only possible errors (assuming correct syntax)
are NameError for
snip
Personally, I recommend you start with doctests rather than nose or unittest.
Doctests can also be run using nose, maybe that's also an idea? Nose does
doctest, unittest, and its own tests. By default, test files need to have a
prefix test_. Unless you specify this either as a
Hi everyone.
I'm stuck on a problem while developing a small tool for Maya. Basically, I
have a folder with some filenames in it which have been returned by
os.listdir().
These filenames look something like...
apple_d.jpg
apple_si.jpg
apple_sg.jpg
box_d.jpg
box_si.jpg
pumpkin_d.jpg
Right now,
Andrew Triplett wrote:
I am on chapter two for Python Programming working on the challenges and
the question is:
1. Create a list of legal and illegal variable names. Describe why each is
either legal or illegal. Next, create a list of good and bad legal
variable names. Describe why each
Hello,
On Wed, May 22, 2013 at 5:49 PM, Stuart Tozer stuto...@gmail.com wrote:
Hi everyone.
I'm stuck on a problem while developing a small tool for Maya. Basically, I
have a folder with some filenames in it which have been returned by
os.listdir(). These filenames look something like...
forobjectinobjects:sorted(set(object.split('_',1)[0]))cmds.menuItem(label
=object,parent =objectMenu)
sorted returns the sorted list but you don't assign anything to it. You can
either assign it to a variable, or use the .sort method instead. Also, you
don't need to specify the maxsplit
Thanks very much guys- I'll get back to this when I have a spare moment and
let you know how I get on.
Cheers,
Stu
On Wed, May 22, 2013 at 11:06 AM, Albert-Jan Roskam fo...@yahoo.com wrote:
forobjectinobjects:sorted(set(object.split('_',1)[0]))cmds.menuItem(label
=object,parent
On Wed, May 22, 2013 at 6:02 AM, Andrew Triplett andrew139...@yahoo.com wrote:
I am on chapter two for Python Programming working on the challenges and the
question is:
1. Create a list of legal and illegal variable names. Describe why each is
either legal or illegal. Next, create a list of
On Wed, May 22, 2013 at 12:26 AM, Jim Mooney cybervigila...@gmail.com wrote:
Actually, I did notice that tests were zero, but the book I am using
does not mention needing the word 'test' as part of the regex. There
is only so much time in a day and so many books I can buy (and not all
Hi,
On 22 May 2013 05:26, Jim Mooney cybervigila...@gmail.com wrote:
But that brings up a point. Does this mean that if I have to test a
module with a lot of subroutines I have to rename every subroutine
with 'test' appended?
Some quick comments for what it's worth: (One of) the points
On 22 May 2013 05:26, Jim Mooney cybervigila...@gmail.com wrote:
But that brings up a point. Does this mean that if I have to test a
module with a lot of subroutines I have to rename every subroutine
with 'test' appended?
No, you don't rename the existing functions. But the testing
On 22/05/13 15:46, Jim Mooney wrote:
I'm looking at Try..Except
Try:
some statements
Except SomethingError as err:
other statements
The list of error statements is huge. How do I know which error
statement to put in place of SomethingError (or multiple errors for
that matter)? Or is
On 22/05/13 16:20, Jim Mooney wrote:
Keep the try block small. For example if it's for a call to
open(filename, r) the only possible errors (assuming correct syntax)
are NameError for using an undefined variable and IOError for
specifying a file which doesnt exist.
Jim, I don't know who you
On Wed, May 22, 2013 at 7:50 AM, Steven D'Aprano st...@pearwood.info wrote:
On 22/05/13 15:46, Jim Mooney wrote:
[...]
But don't do this in real code! In real code, the rules you should apply
are:
1) never hide programming errors by catching exceptions;
2) errors should only be caught
On Wed, May 22, 2013 at 8:07 AM, Steven D'Aprano st...@pearwood.info wrote:
On 22/05/13 16:20, Jim Mooney wrote:
[...}
A very important quote from Chris Smith:
I find it amusing when novice programmers believe their main job is
preventing programs from crashing. ... More experienced
On 22/05/13 23:31, boB Stepp wrote:
On Wed, May 22, 2013 at 7:50 AM, Steven D'Aprano st...@pearwood.info wrote:
On 22/05/13 15:46, Jim Mooney wrote:
[...]
But don't do this in real code! In real code, the rules you should apply
are:
1) never hide programming errors by catching
On 22/05/13 23:37, boB Stepp wrote:
On Wed, May 22, 2013 at 8:07 AM, Steven D'Aprano st...@pearwood.info wrote:
On 22/05/13 16:20, Jim Mooney wrote:
[...}
A very important quote from Chris Smith:
I find it amusing when novice programmers believe their main job is
preventing programs from
Thanks, Steve, for your last two posts. You have made things much
clearer for me.
On Wed, May 22, 2013 at 9:49 AM, Steven D'Aprano st...@pearwood.info wrote:
On 22/05/13 23:37, boB Stepp wrote:
On Wed, May 22, 2013 at 8:07 AM, Steven D'Aprano st...@pearwood.info
wrote:
[...]
Being a
Hi Andrew,
I'm sure the exercises at the end of the each chapters are there for you to
attempt. Asking for help here without attempting it is not the best way to
learn.
If however, you've tried something - and it didn't work, by all means ask
for help.
In the mean time show us what you have so
Please don't reply to digests. Each message has a Message-ID, and
replies have an IN-REPLY-TO field that references the ID of the
previous message in the thread. By replying to the digest your message
has no meaningful Subject, and even if you change the Subject field,
it still won't be
On 23/05/13 02:13, Jim Mooney wrote:
Please don't reply to digests. Each message has a Message-ID, and
replies have an IN-REPLY-TO field that references the ID of the
previous message in the thread. By replying to the digest your message
has no meaningful Subject, and even if you change the
I find it amusing when novice programmers believe their main job is
preventing programs from crashing. ... More experienced programmers realize
that correct code is great, code that crashes could use improvement, but
incorrect code that doesn't crash is a horrible nightmare.
Then am I right
On Wed, May 22, 2013 at 12:13 PM, Jim Mooney cybervigila...@gmail.com wrote:
Please don't reply to digests. Each message has a Message-ID, and
replies have an IN-REPLY-TO field that references the ID of the
previous message in the thread. By replying to the digest your message
has no
On Wed, May 22, 2013 at 9:45 AM, Steven D'Aprano st...@pearwood.info wrote:
On 22/05/13 23:31, boB Stepp wrote:
On Wed, May 22, 2013 at 7:50 AM, Steven D'Aprano st...@pearwood.info
wrote:
[...]
3) your job as a programmer is *not* to stop your program from raising an
error, but to make it
On 23/05/13 02:09, boB Stepp wrote:
I was not aware that hardware damage could be caused by poor
programming. I am curious; can you give some examples of how this
might occur?
Does your computer have a DVD drive? Or Blu-Ray? Is it region-locked? Some region-locked
drives let you change the
On Wed, May 22, 2013 at 9:50 AM, boB Stepp robertvst...@gmail.com wrote:
I guess I'll pick the first alternative. However, this brings to mind
my biggest gripe as a user of software, particularly here at work
where the programmer obviously has no medical background: cryptic
error messages
Does anybody know if there's a Python method that gives or stores the
complete list of ascii characters or unicode characters? The list of every
single character available would be perfect.
Thanks.
___
Tutor maillist - Tutor@python.org
To unsubscribe
On Wed, May 22, 2013 at 2:14 PM, Citizen Kant citizenk...@gmail.com wrote:
Does anybody know if there's a Python method that gives or stores the
complete list of ascii characters or unicode characters? The list of every
single character available would be perfect.
The unicodedata module
Subject: Re: [Tutor] try..except - what about that ton of **Error statements?
On 23/05/13 02:09, boB Stepp wrote:
I was not aware that hardware damage could be caused by poor
programming. I am curious; can you give some examples of how this
might occur?
There used to be a program
On Wed, May 22, 2013 at 2:14 PM, Citizen Kant citizenk...@gmail.com wrote:
Does anybody know if there's a Python method that gives or stores the
complete list of ascii characters or unicode characters? The list of every
single character available would be perfect.
The unicodedata module
The unicodedata module provides access to the Unicode database that Python
uses:
http://docs.python.org/2/library/unicodedata#unicodedata.unidata_version
That was really useful for another reason. After I checked and saw it
was in DLLs, I investigated the other Python DLLs - which had
I made a simple ear frequency-tester, but I don't want it to go on
forever, so I tried stopping it when I pressed a key, as below, but
that doesn't work. I did check out keyboard interrupts but they seem
unnecessarily complex just to stop a program. I'm not passing keys. Is
there something simple
On Wed, May 22, 2013 at 12:47 PM, Jim Mooney cybervigila...@gmail.comwrote:
I made a simple ear frequency-tester, but I don't want it to go on
forever, so I tried stopping it when I pressed a key, as below, but
that doesn't work. I did check out keyboard interrupts but they seem
On Wed, May 22, 2013 at 3:47 PM, Jim Mooney cybervigila...@gmail.comwrote:
I made a simple ear frequency-tester, but I don't want it to go on
forever, so I tried stopping it when I pressed a key, as below, but
that doesn't work. I did check out keyboard interrupts but they seem
unnecessarily
I've not used it myself, but I believe the KeyboadInterrupt is only
generated by one _specific_ keypress. You mentioned that you pressed a key
- did you try Control-C?
Actually, I did, using Win 7 - and I put exit() in place of pass. I
tried ctrl-c, ctrl-x, esc, and del. Windows doesn't seem
On 05/22/2013 03:03 PM, Albert-Jan Roskam wrote:
Subject: Re: [Tutor] try..except - what about that ton of **Error statements?
On 23/05/13 02:09, boB Stepp wrote:
I was not aware that hardware damage could be caused by poor
programming. I am curious; can you give some examples of how
On 22 May 2013 13:24, Jim Mooney cybervigila...@gmail.com wrote:
I've not used it myself, but I believe the KeyboadInterrupt is only
generated by one _specific_ keypress. You mentioned that you pressed a key
- did you try Control-C?
Actually, I did, using Win 7 - and I put exit() in place of
On Wed, May 22, 2013 at 1:30 PM, Jim Mooney cybervigila...@gmail.comwrote:
On 22 May 2013 13:24, Jim Mooney cybervigila...@gmail.com wrote:
I've not used it myself, but I believe the KeyboadInterrupt is only
generated by one _specific_ keypress. You mentioned that you pressed a
key
- did
On Wed, May 22, 2013 at 4:30 PM, Jim Mooney cybervigila...@gmail.com wrote:
Figured it out. Ctrl-C only works in the Windows Command window, not
in an editor.
Which IDE?
In IDLE, your code runs in the main thread of a subprocess (unless
IDLE is started with the -n option). A second thread
On 22 May 2013 15:05, eryksun eryk...@gmail.com wrote:
On Wed, May 22, 2013 at 4:30 PM, Jim Mooney cybervigila...@gmail.com wrote:
Figured it out. Ctrl-C only works in the Windows Command window, not
in an editor.
Which IDE?
Wing. But not being able to abort out of a Windows program is a
On 23/05/13 04:14, Citizen Kant wrote:
Does anybody know if there's a Python method that gives or stores the
complete list of ascii characters or unicode characters? The list of every
single character available would be perfect.
There are only 127 ASCII characters, so getting a list of them
On 05/22/2013 04:11 PM, Jerry Hill wrote:
On Wed, May 22, 2013 at 3:47 PM, Jim Mooney cybervigila...@gmail.comwrote:
I made a simple ear frequency-tester, but I don't want it to go on
forever, so I tried stopping it when I pressed a key, as below, but
that doesn't work. I did check out
What do you mean doesn't do anything ? It certainly terminates the loop,
which was the intent. Provided of course that something else isn't trapping
the Ctrl-C first.
It doesn't in Windows proper, using Wing 101. It does exit in the
Windows command console. For some reason I forgot ctrl-C is
On 23/05/13 02:09, boB Stepp wrote:
I would like to ask some general questions here. Problems can arise
from bugs in the operating system, bugs in the programming language(s)
being used, bugs in packages/modules being used, bugs in any third
party packages being used, etc. Also, whenever any
On 05/22/2013 09:46 PM, Jim Mooney wrote:
What do you mean doesn't do anything ? It certainly terminates the loop,
which was the intent. Provided of course that something else isn't trapping
the Ctrl-C first.
It doesn't in Windows proper, using Wing 101.
Then Wing is changing the behavior,
47 matches
Mail list logo