homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients pitrou, serhiy.storchaka, skrah, teoliphant
Date 2013年09月13日.20:52:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1379105549.83.0.888503022363.issue19014@psf.upfronthosting.co.za>
In-reply-to
Content
This is one of most annoying things in Python to me. When you want accept any bytes-like object in you bytes-processing function you need special case empty input.
def foo(data):
 data = memoryview(data)
 if data:
 data = data.cast('B')
 else:
 data = b''
You can't use just memoryview(data).cast('B') because it doesn't work for empty data.
>>> memoryview(b'').cast('b')
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
TypeError: memoryview: cannot cast view with zeros in shape or strides
It would be very nice to allow cast() for empty views.
History
Date User Action Args
2013年09月13日 20:52:29serhiy.storchakasetrecipients: + serhiy.storchaka, teoliphant, pitrou, skrah
2013年09月13日 20:52:29serhiy.storchakasetmessageid: <1379105549.83.0.888503022363.issue19014@psf.upfronthosting.co.za>
2013年09月13日 20:52:29serhiy.storchakalinkissue19014 messages
2013年09月13日 20:52:29serhiy.storchakacreate

AltStyle によって変換されたページ (->オリジナル) /