On Wed, Dec 26, 2018 at 7:12 AM Steven D'Aprano wrote:
> On Tue, Dec 25, 2018 at 01:28:02AM +0200, Andrew Svetlov wrote:
>
> > The proposal can generate cryptic messages like
> > `a bytes-like object is required, not 'NoneType'`
>
> How will it generate such a message? That's not obvious to me.
>
On Tue, Dec 25, 2018 at 01:28:02AM +0200, Andrew Svetlov wrote:
> The proposal can generate cryptic messages like
> `a bytes-like object is required, not 'NoneType'`
How will it generate such a message? That's not obvious to me.
The message doesn't seem cryptic to me. It seems perfectly clear: a
On 12/25/18, Steven D'Aprano wrote:
> On Tue, Dec 25, 2018 at 04:51:18PM -0600, eryk sun wrote:
>>
>> Alternatively, we can memory-map the file via mmap. An important
>> difference is that the mmap buffer interface is low-level (e.g. no
>> file pointer and the offset has to be page aligned), so we
On 24Dec2018 10:19, James Edwards wrote:
Here's a snippet of semi-production code we use:
def read_and_unpack(handle, fmt):
size = struct.calcsize(fmt)
data = handle.read(size)
if len(data) < size: return None
return struct.unpack(fmt, data)
which was originally
On Tue, Dec 25, 2018 at 04:51:18PM -0600, eryk sun wrote:
> On 12/24/18, Drew Warwick wrote:
> > The struct unpack API is inconvenient to use with files. I must do:
> >
> > struct.unpack(fmt, file.read(struct.calcsize(fmt))
>
> Alternatively, we can memory-map the file via mmap. An important
> di
On 12/24/18, Drew Warwick wrote:
> The struct unpack API is inconvenient to use with files. I must do:
>
> struct.unpack(fmt, file.read(struct.calcsize(fmt))
Alternatively, we can memory-map the file via mmap. An important
difference is that the mmap buffer interface is low-level (e.g. no
file po
It's very important that f(z=5) Raises an exception if z is not an argument.
For your case, I'd do a wrapper, instead lf calling f(z=5) you can call
UniversalCall(f, x=1, y=2, z=5) if you want to specify it on the caller
side.
Or else, you can create a decorator :
@universal_callable
def f(x, y)