Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

If you think last Tuesday was a drag, wait till you see what happens tomorrow!


comp / comp.lang.python / Re: IDLE: clearing the screen

SubjectAuthor
* Re: IDLE: clearing the screenRob Cliffe
`* Re: IDLE: clearing the screenMichael F. Stemper
 `* Re: IDLE: clearing the screenStefan Ram
  `- Re: IDLE: clearing the screenMichael F. Stemper

1
Subject: Re: IDLE: clearing the screen
From: Rob Cliffe
Newsgroups: comp.lang.python
Date: Sat, 8 Jun 2024 19:18 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: rob.cliffe@btinternet.com (Rob Cliffe)
Newsgroups: comp.lang.python
Subject: Re: IDLE: clearing the screen
Date: Sat, 8 Jun 2024 20:18:16 +0100
Lines: 19
Message-ID: <mailman.100.1717874304.2909.python-list@python.org>
References: <66670225-276b-48cf-b271-6962daef903b@btinternet.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de Tax1IfRZA0zgU0ZR5SifAQn/UMtjXBmLOsdLmql5HjIg==
Cancel-Lock: sha1:tIP5xxx6hwohZO3QPD+aY2+Vm/s= sha256:l1qHCaLEP2vTsJGqN49haxXLHXzR5zqMThpzX+MoSvI=
Return-Path: <rob.cliffe@btinternet.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=btinternet.com header.i=@btinternet.com header.b=LFoCt7sC;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.036
X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'def': 0.04; 'blank': 0.09;
'idle': 0.09; 'ok,': 0.09; 'prints': 0.09; 'subject:IDLE': 0.09;
'import': 0.15; 'newline': 0.16; 'subject:screen': 0.16; 'to:addr
:python-list': 0.20; 'advanced': 0.22; 'skip:_ 10': 0.22; 'it,':
0.29; 'header:User-Agent:1': 0.30; '(this': 0.32;
'to:name:python': 0.32; 'received:192.168.1': 0.32; 'there': 0.33;
'printing': 0.34; 'class': 0.37; 'received:192.168': 0.37;
'prompt': 0.39; 'appears': 0.40; 'received:213': 0.40; 'wishes':
0.40; 'best': 0.61; 'skip:o 10': 0.61; 'here': 0.62; 'top': 0.65;
'adds': 0.69; 'returned': 0.81; 'rob': 0.84; 'screen,': 0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=btinternet.com;
s=btmx201904; t=1717874297;
bh=NgQ/IQqeLHdpY0Ggx5Q0BUIs2utiPNmiA2nP5Wmsekw=;
h=Message-ID:Date:MIME-Version:To:From:Subject;
b=LFoCt7sCyLJn9VNKIfljsw3r2PYkBvdJawUaGseMMvP05w/8QJ6jbbtZDOTMxZHm0L0i6P9BSg6tUI3Q3byvqb83LF5rFDK4zO2uFGd0N7YSE6Uic+MGYI5Ux2XViKZ6sqef59uFlFwihe1/xZt6AT+I3D0229w7VHtArnCsaPn9cPBaO0YE0Qcb1MR/y79M+INBnKLy7aUazNJLkazscWiQGHX+bpxwv4otqv/XtwFx0JfcPplQp7FrFFdUpcDV5GmppU2MeIWD6jHLR6uF56jvwL3cCHBw1K+ZkFRvFvxUae2qBh+KI1xQZqzgBFawvXM1tF/oT0s19+o/xyNoUw==
Authentication-Results: btinternet.com;
auth=pass (PLAIN) smtp.auth=rob.cliffe@btinternet.com;
bimi=skipped
X-SNCR-Rigid: 65A566C210438A1B
X-Originating-IP: [86.184.143.52]
X-OWM-Source-IP: 86.184.143.52
X-OWM-Env-Sender: rob.cliffe@btinternet.com
X-VadeSecure-score: verdict=clean score=0/300, class=clean
X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgedvledrfedtgedgjedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuueftkffvkffujffvgffngfevqffopdfqfgfvnecuuegrihhlohhuthemuceftddunecunecujfgurhepkfffgggfvffhufgtgfesthekredttddvjeenucfhrhhomheptfhosgcuvehlihhffhgvuceorhhosgdrtghlihhffhgvsegsthhinhhtvghrnhgvthdrtghomheqnecuggftrfgrthhtvghrnhepjeeigeffieevhfejudehhfejtefgueffvdfggefgvdetfeetudefveeugfehhfetnecukfhppeekiedrudekgedrudegfedrhedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehhvghloheplgduledvrdduieekrddurddvtdekngdpihhnvghtpeekiedrudekgedrudegfedrhedvpdhmrghilhhfrhhomheprhhosgdrtghlihhffhgvsegsthhinhhtvghrnhgvthdrtghomhdpnhgspghrtghpthhtohepuddprhgtphhtthhopehphihthhhonhdqlhhishhtsehphihthhhonhdrohhrghdprhgvvhfkrfephhhoshhtkeeiqddukeegqddugeefqdehvddrrhgrnhhgvgekiedqudekgedrsghttggvnhhtrhgrlhhplhhushdrtghomhdprghuthhhpghushgvrheprhhosgdrtghlihhffhgvsegsthhinhhtvghrnhgvthdrtghomhdpghgvohfkrfepifeupdfovfetjfhoshhtpehsrgdqphhrugdqrhhgohhuthdqtddtge
X-RazorGate-Vade-Verdict: clean 0
X-RazorGate-Vade-Classification: clean
X-SNCR-hdrdom: btinternet.com
User-Agent: Mozilla Thunderbird
Content-Language: en-GB
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <66670225-276b-48cf-b271-6962daef903b@btinternet.com>
View all headers

OK, here is the advanced version:
import os
class _cls(object):
    def __repr__(self):
        os.system('cls')
        return ''
cls = _cls()

Now when you type
cls
it clears the screen.  The only flaw is that there is a blank line at
the very top of the screen, and the ">>>" prompt appears on the SECOND
line.
(This blank line is because the IDLE prints the blank value returned by
"return ''" and adds a newline to it, as it does when printing the value
of any expression.)

Best wishes
Rob Cliffe

Subject: Re: IDLE: clearing the screen
From: Michael F. Stemper
Newsgroups: comp.lang.python
Organization: A noiseless patient Spider
Date: Mon, 10 Jun 2024 13:55 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: michael.stemper@gmail.com (Michael F. Stemper)
Newsgroups: comp.lang.python
Subject: Re: IDLE: clearing the screen
Date: Mon, 10 Jun 2024 08:55:20 -0500
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <v470k8$g26c$1@dont-email.me>
References: <66670225-276b-48cf-b271-6962daef903b@btinternet.com>
<mailman.100.1717874304.2909.python-list@python.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 10 Jun 2024 15:55:21 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="f1965353a8cd489d22a579ef51dc408a";
logging-data="526540"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Yn5iBorHm6Iu5rkNvFtouJQ1YLtsAF34="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:50IR9eJm7QSFPfCKLF1D224lRKE=
In-Reply-To: <mailman.100.1717874304.2909.python-list@python.org>
Content-Language: en-US
View all headers

On 08/06/2024 14.18, Rob Cliffe wrote:
> OK, here is the advanced version:
> import os
> class _cls(object):
>     def __repr__(self):
>         os.system('cls')
>         return ''
> cls = _cls()
>
> Now when you type
> cls
> it clears the screen.  The only flaw is that there is a blank line at the very top of the screen, and the ">>>" prompt appears on the SECOND line.
> (This blank line is because the IDLE prints the blank value returned by "return ''" and adds a newline to it, as it does when printing the value of any expression.)

Why have it return anything at all?

--
Michael F. Stemper
Indians scattered on dawn's highway bleeding;
Ghosts crowd the young child's fragile eggshell mind.

Subject: Re: IDLE: clearing the screen
From: Stefan Ram
Newsgroups: comp.lang.python
Organization: Stefan Ram
Date: Mon, 10 Jun 2024 14:32 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: Re: IDLE: clearing the screen
Date: 10 Jun 2024 14:32:41 GMT
Organization: Stefan Ram
Lines: 13
Expires: 1 Feb 2025 11:59:58 GMT
Message-ID: <repr-20240610153216@ram.dialup.fu-berlin.de>
References: <66670225-276b-48cf-b271-6962daef903b@btinternet.com> <mailman.100.1717874304.2909.python-list@python.org> <v470k8$g26c$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de zWdhc5sktqt4oHIqajHWJw5HII/xOnShxK8m2xWAPcrbTQ
Cancel-Lock: sha1:8vu5cz9l77sSrUD20EP0lrhhbVU= sha256:KEvO9Ks3Jx04fOECiw5x+PWVtNok8dLCvMat6j+VUGg=
X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
View all headers

"Michael F. Stemper" <michael.stemper@gmail.com> wrote or quoted:
>On 08/06/2024 14.18, Rob Cliffe wrote:
>> OK, here is the advanced version:
>> import os
>> class _cls(object):
>>     def __repr__(self):
>>         os.system('cls')
>>         return ''
>> cls = _cls()
....
>Why have it return anything at all?

Because __repr__ needs to return a str.

Subject: Re: IDLE: clearing the screen
From: Michael F. Stemper
Newsgroups: comp.lang.python
Organization: A noiseless patient Spider
Date: Mon, 10 Jun 2024 15:49 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: michael.stemper@gmail.com (Michael F. Stemper)
Newsgroups: comp.lang.python
Subject: Re: IDLE: clearing the screen
Date: Mon, 10 Jun 2024 10:49:42 -0500
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <v477am$h1qk$2@dont-email.me>
References: <66670225-276b-48cf-b271-6962daef903b@btinternet.com>
<mailman.100.1717874304.2909.python-list@python.org>
<v470k8$g26c$1@dont-email.me> <repr-20240610153216@ram.dialup.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 10 Jun 2024 17:49:43 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="f1965353a8cd489d22a579ef51dc408a";
logging-data="558932"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19tTC0bUIpGCi9RJ8v5AtWxoolXaR8TUr4="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:GfYEGV2T6hcDyYbgsRWrE5aWGsw=
Content-Language: en-US
In-Reply-To: <repr-20240610153216@ram.dialup.fu-berlin.de>
View all headers

On 10/06/2024 09.32, Stefan Ram wrote:
> "Michael F. Stemper" <michael.stemper@gmail.com> wrote or quoted:
>> On 08/06/2024 14.18, Rob Cliffe wrote:
>>> OK, here is the advanced version:
>>> import os
>>> class _cls(object):
>>>     def __repr__(self):
>>>         os.system('cls')
>>>         return ''
>>> cls = _cls()
> ...
>> Why have it return anything at all?
>
> Because __repr__ needs to return a str.

Got it. Thanks for clarifying.

--
Michael F. Stemper
87.3% of all statistics are made up by the person giving them.

1

rocksolid light 0.9.8
clearnet tor