Follow

Cribbed from a tweet by Raymond Hettinger: quiz – what does this do?

with open(False) as f:
s = f.read()

@rixx without peeking in the source, I'd guess reading a line from stdin?

@rixx Thats interesting.
open(False) reads stdin. So:

open(False)

Will wait endless on keyboard inputs.

>>> X = open(False).read(10)
Hallo Welt
>>> X
'Hallo Welt'

This store only the 10 first characters from keyboard input in X.

Thanks !

@rixx Produces an error because the indentation is missing?

@quantum That seems to be a client issue on your part, because the status does have indentation: chaos.social/api/v1/statuses/1

@rixx Oh. Good to know about that!
Then it reads a line from stdin.

Sign in to participate in the conversation
chaos.social

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!