[Ml-yokadi] IO handler (was :Re: import fix (die utils.py die die))

Aurélien Gâteau aurelien.gateau
Lun 9 Fév 22:46:29 CET 2009


Sébastien Renard wrote:
> Le lundi 26 janvier 2009, Aurélien Gâteau a écrit :
>> (Sorry for the late answer)
>>
>> It looks good, thanks! I think it can go in master. My only nitpick
>> would be to avoid naming the output stream yio, for two reasons:
>> - It's only about output, not input
> 
> It could be also about input... But yes for now it's only about stdout and 
> stderr.

It's an output stream, it can't be about input, or am I missing something?

>> - tui.py is generic enough to be useful outside Yokadi, so I'd prefer to
>> avoid Yokadi references in it.
> 
> Right.  We have some other (yokadi exception for instance). 

Indeed. This should be easy to fix, though, it is only used in editText().

>> What about just naming it stdout? Usage would be tui.stdout, which is
>> quite similar to sys.stdout.
> 
> I rename yio to io and make direct access to stdout and stderr. So tui.stdout 
> and tui.stderr are directly accessible.

I don't see the need for the IOHandler class. Can't we just write this?

stdout = IOStream(sys.stdout)
stderr = IOStream(sys.stderr)

Another question: why are IOError exceptions trapped in IOStream.write? 
can't we let them propagate?

Aurélien


Plus d'informations sur la liste de diffusion Ml-yokadi