On Tue, May 21, 2013 at 11:25 PM, Bod Soutar wrote:
> On 22 May 2013 07: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 IOErro
> 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 comman
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 w
Hello,
On Wed, May 22, 2013 at 5:49 PM, Stuart Tozer 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...
>
>
> apple_d.jpg
>
>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 maxspl
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 wrote:
> >
>
> >forobjectinobjects:sorted(set(object.split('_',1)[0]))cmds.menuItem(label
> =object,parent ="objectMenu")
>
>
On Wed, May 22, 2013 at 6:02 AM, 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" le
On Wed, May 22, 2013 at 12:26 AM, Jim Mooney 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
> comprehensive, apparently.)
Hi,
On 22 May 2013 05:26, Jim Mooney 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 about nose is
to make les
On 22 May 2013 05:26, Jim Mooney 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 functions
need to be ident
On 22/05/13 15:46, Jim Mooney wrote:
I'm looking at Try..Except
Try:
Except SomethingError as err:
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 it best to just leave Something
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 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 if you ca
On Wed, May 22, 2013 at 8:07 AM, Steven D'Aprano 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 programmers reali
On 22/05/13 23:31, boB Stepp wrote:
On Wed, May 22, 2013 at 7:50 AM, Steven D'Aprano 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 shoul
On 22/05/13 23:37, boB Stepp wrote:
On Wed, May 22, 2013 at 8:07 AM, Steven D'Aprano 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
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 wrote:
> On 22/05/13 23:37, boB Stepp wrote:
>>
>> On Wed, May 22, 2013 at 8:07 AM, Steven D'Aprano
>> wrote:
>>>
[...]
>>
>> Being a novice programmer, I am inter
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 fa
> 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 t
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 Subje
>> "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
On Wed, May 22, 2013 at 12:13 PM, 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 ev
On Wed, May 22, 2013 at 9:45 AM, Steven D'Aprano wrote:
> On 22/05/13 23:31, boB Stepp wrote:
>>
>> On Wed, May 22, 2013 at 7:50 AM, Steven D'Aprano
>> wrote:
[...]
>>> 3) your job as a programmer is *not* to stop your program from raising an
>>> error, but to make it behave correctly -- someti
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 re
On Wed, May 22, 2013 at 9:50 AM, boB Stepp 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 that might be meaningf
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 o
On Wed, May 22, 2013 at 2:14 PM, 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.
The unicodedata module provides access to the Un
> 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 p
On Wed, May 22, 2013 at 2:14 PM, 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.
The unicodedata module provides access to the Un
> 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
her
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 wrote:
> 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 sto
On Wed, May 22, 2013 at 3:47 PM, Jim Mooney wrote:
> 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
> 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 see
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 th
On 22 May 2013 13:24, Jim Mooney 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 pass. I
> tried
On Wed, May 22, 2013 at 1:30 PM, Jim Mooney wrote:
> On 22 May 2013 13:24, Jim Mooney 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,
On Wed, May 22, 2013 at 4:30 PM, Jim Mooney 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 ("SockThread") is
started
On 22 May 2013 15:05, eryksun wrote:
> On Wed, May 22, 2013 at 4:30 PM, Jim Mooney 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
feature. You don't want to lose sev
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 is
On 05/22/2013 04:11 PM, Jerry Hill wrote:
On Wed, May 22, 2013 at 3:47 PM, Jim Mooney wrote:
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 se
> 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-
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 one
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
On Wed, May 22, 2013 at 8:56 PM, Jim Mooney wrote:
> On 22 May 2013 15:05, eryksun wrote:
>> On Wed, May 22, 2013 at 4:30 PM, Jim Mooney 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 ou
46 matches
Mail list logo