[issue35247] test.test_socket.RDSTest.testPeek hangs indefinitely

2020-09-20 Thread Jáchym Barvínek

Jáchym Barvínek  added the comment:

I am experiencing the same issue when trying to build the ArchLinux python 
package. Not sure how to reproduce, but I can provide specific details of my 
system if requested.

--
nosy: +Jáchym Barvínek

___
Python tracker 
<https://bugs.python.org/issue35247>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30196] Add __matmul__ to collections.Counter

2017-04-28 Thread Jáchym Barvínek

New submission from Jáchym Barvínek:

The class collections.Counter should semantically contain only numbers, so it 
makes sense to define dot product od Counters, something like this:

def __matmul__(self, other):
  return sum(self[x] * other[x] for x in self.keys() | other.keys())

I find this useful ocassionaly.

--
components: Library (Lib)
messages: 292522
nosy: Jáchym Barvínek
priority: normal
severity: normal
status: open
title: Add __matmul__ to collections.Counter
type: enhancement
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30196>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28529] 0 ** 0 should raise ArithmeticError

2016-10-25 Thread Jáchym Barvínek

Jáchym Barvínek added the comment:

Sorry, It should be 0.0 ** 0 == 0 ** 0.0 == 0.0 ** 0.0 == 1.0 of course.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28529>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28529] 0 ** 0 should raise ArithmeticError

2016-10-25 Thread Jáchym Barvínek

New submission from Jáchym Barvínek:

0 ** 0 is mathematically undefined and equivalent to 0/0. 0/0 correctly raises 
ZeroDivisionError, but 0 ** 0 == 1. Also 0.0 ** 0 == 0 ** 0.0 == 0.0 ** 0.0 == 
0.0. Similarly for math.pow.

--
components: Interpreter Core
messages: 279410
nosy: Jáchym Barvínek
priority: normal
severity: normal
status: open
title: 0 ** 0 should raise ArithmeticError
versions: Python 3.5

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28529>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27858] Add identity function to functools

2016-08-25 Thread Jáchym Barvínek

Jáchym Barvínek added the comment:

Java offers an identity function:
https://docs.oracle.com/javase/8/docs/api/java/util/function/Function.html

2016-08-25 14:10 GMT+02:00 Steven D'Aprano <rep...@bugs.python.org>:

>
> Steven D'Aprano added the comment:
>
> Just in case anyone else thinks this is a good idea, here's a patch.
>
> --
> keywords: +patch
> Added file: https://bugs.python.org/file44218/identity.patch
>
> ___
> Python tracker <rep...@bugs.python.org>
> <https://bugs.python.org/issue27858>
> ___
>

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue27858>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27858] Add identity function to functools

2016-08-25 Thread Jáchym Barvínek

New submission from Jáchym Barvínek:

An identity function is sometimes useful in functional-style programming as a 
dummy or default value.

For example, we can sometimes see a pattern like this (e.g. in 
itertools.groupby):

def f(params, key=None):
  if key is None:
key = lambda x: x
  ...


However, if we had a canonical itentity function:

def identity(x):
  return x

we could instead write:

def f(params, key=identity):
  ...

and the intended use of the function f and it's functioning would be more 
obvious simply from it's signature, while also saving a little code. 

As zen of Python says: Explicit is better than implicit.

Of course, we can now write:

def f(params, key=lambda x: x):
  ...

but the reason why is not used is probably that it feels a bit awkward to more 
people than just me.

--
components: Library (Lib)
messages: 273643
nosy: Jáchym Barvínek
priority: normal
severity: normal
status: open
title: Add identity function to functools
type: enhancement
versions: Python 3.6

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue27858>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com