[Tutor] Re: Re: Advice needed on first project

Andrei project5 at redrival.net
Fri Apr 16 12:54:50 EDT 2004


Adam wrote on Thursday 15 April 2004 21:33:

> Andrei wrote:
<snip>
> I thought so - this is a very intuitive language to pick up (well, at
> least for me it is). This will be adopted.

I rather like it too :).

>> - don't use tabs. The preferred way of writing Python code is by using 4
>> spaces per indentation level. This is what you do in create_new_articles,
>> but you use tabs in menu. If you now try to copy-paste code from the one
>> to the other in order to avoid the mini-modules, you'll get some errors I
>> think.
<snip> 
> I think I already experienced some problems with the tabs already. I
> started off using jedit (please don't start a discussion about merits of
>   text editors!) and then gave pyalamode a go - it seemed to report
> errors with the indentation. I imagine that if I use one editor
> consistently, it will prevent this.

It's not a matter of which editor you prefer, because every decent
general-purpose editor I've seen allows you to specify the indentation
settings I mentioned above. It's possible that special-purpose Python
editors will lock you in 4 space-style, but that's a good thing. I don't
know what PyAlaMode uses for settings, but I'll bet a versatile editor like
Jedit allows you to configure it. I prefer SciTE for Python editing
nowadays, though I do use more special-purpose editors like Boa and Spe
when I want a class browser or a debugger.

>> - always assume your users are stupid - I do that even if I only code for
>> myself :). What happens if your user answers "n" or 'new' in the menu or
>> accidentally types a space before or after the 'n'? He's told the choice
>> is invalid. Case sensitive menus are not a very good idea. That's why it
>> makes sense to clean up the response a bit:
<snip>

> This kind of feature is coming and it seems very easy to implement, but
> I bet that it is quite difficult to do well (ie. taking into account all
>   eventualities of user input).

Of course you can't easily account for everything (like someone typing
'nyesyesyesYESYES!!' and getting recognized as no), but that's not the
point of the exercise :). The purpose is just to prevent common mistakes
not being handled (uppercase sensitivity in a menu is highly unintuitive
for example).

-- 
Yours,

Andrei

=====
Real contact info (decode with rot13):
cebwrpg5 at jnanqbb.ay. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq
gur yvfg, fb gurer'f ab arrq gb PP.




More information about the Tutor mailing list