Reading all buffered bytes without blocking

Oscar jornws0718 at xs4all.nl
Thu Mar 5 06:15:03 EST 2015


In article <f137c6cb-81ea-41bd-8387-2542a7fae5f9 at googlegroups.com>,
 <wxjmfauth at gmail.com> wrote:
>>>> buffer = ('a'*998 + '\u20ac').encode('utf-8')[:1000]
>>>> buffer.decode('utf-8')
>Traceback (most recent call last):
>  File "<eta last command>", line 1, in <module>
>UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 998-999: 
>unexpected end of data
>>>> 
>>>> # BOUM

hmm...

>>> import sys as jmr
>>> input = jmr.stdin.fileno()
>>> output = jmr.stdout.fileno()
>>> value = output / input
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero
>>> # BOUM

-- 
[J|O|R] <- .signature.gz



More information about the Python-list mailing list