[Tutor] re clear screen

Gus Tabares gus.tabares@verizon.net
Mon Nov 11 18:03:02 2002


kevin parks wrote:

>> import os
>> os.system("cls")
>>
>> UNIX:
>> os.system("clear")
>>
>> So for portability:
>> if os.platform == some_platform:
>>     etc...
>> else: print '\n'*24
>
>
> Wow on M$ it's cls and on UNIX clear? How unbelievably unpythonesque. 
> It is the first thing i've ever seen in python that i could say was 
> truly stupid. Guido should get that time machine revved up and quickly 
> change one of them so that they are both the same. I guess that this 
> was done to keep python from being absolutely perfect. Sorta like 
> Greta Garbo's feet.
>
> -kp--
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
The cls and clear commands have nothing really to do with Python, just 
with the operating systems themselves. Different OS's, different 
commands. I'm not sure Guido has any say in the direction Win and Unix 
go, but python on the other hand:) But as it was already mentioned, if 
you planned on clearing the screen on a regular basis, you could make a 
module that would test which platform you were using so all you would 
have to do is:

module.clear()

...you all get the picture:) Just my two cents.