How best to handle SystemError in ctypes callback

2022-01-05 Thread Jarrod G
With the following code: import ctypes > import readline > from ctypes.util import find_library > > rl = ctypes.cdll.LoadLibrary(find_library('readline')) > > rl_redisplay = rl.rl_redisplay > rl_redisplay.restype = None > rl_redisplay.argtypes = None > > rl_redisplay_function = ctypes.c_void_p.in_

Re: Why operations between dict views return a set and not a frozenset?

2022-01-05 Thread Chris Angelico
On Thu, Jan 6, 2022 at 8:01 AM Marco Sulla wrote: > > On Wed, 5 Jan 2022 at 14:16, Chris Angelico wrote: > > That's an entirely invisible optimization, but it's more than just > > "frozenset is faster than set". It's that a frozenset or tuple can be > > stored as a function's constants, which is

Re: Why operations between dict views return a set and not a frozenset?

2022-01-05 Thread Marco Sulla
On Wed, 5 Jan 2022 at 14:16, Chris Angelico wrote: > That's an entirely invisible optimization, but it's more than just > "frozenset is faster than set". It's that a frozenset or tuple can be > stored as a function's constants, which is a massive difference. Can you explain this? > In fact, the

Re: Shapely Polygon creating empty polygon

2022-01-05 Thread Israel Brewster
Found it! Apparently, it’s an import order issue. This works: >>> from shapely.geometry import Polygon >>> from osgeo import osr >>> bounds = [-164.29635821669632, 54.64251856269729, -163.7631779798799, >>> 54.845450778742546] >>> print(Polygon.from_bounds(*bounds)) POLYGON ((-164.2963582166963 5

AttributeError: 'NoneType' object has no attribute 'get'

2022-01-05 Thread NArshad
How to correct what is written below: Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\Dani Brothers\Anaconda3\lib\tkinter\__init__.py", line 1705, in __call__ return self.func(*args) File "D:/Python/Book Bank/New folder/PyCharm/Final/Excel.py", line 57, in

Re: recover pickled data: pickle data was truncated

2022-01-05 Thread iMath
Thanks for all your kind help, wish you a promising year! -- https://mail.python.org/mailman/listinfo/python-list

Pip not working

2022-01-05 Thread Malick Lickta Keita
Hello I’ve installed the latest version of python but pip is not working Sent from my iPhone -- https://mail.python.org/mailman/listinfo/python-list

Re: Why operations between dict views return a set and not a frozenset?

2022-01-05 Thread Antoon Pardon
Op 4/01/2022 om 19:27 schreef Marco Sulla: $ python Python 3.10.0 (heads/3.10-dirty:f6e8b80d20, Nov 18 2021, 19:16:18) [GCC 10.1.1 20200718] on linux Type "help", "copyright", "credits" or "license" for more information. a = {1:2} c = {1:2, 3:4} c.keys() - a.keys() {3} Why not frozenset({3}

Re: Why operations between dict views return a set and not a frozenset?

2022-01-05 Thread Chris Angelico
On Thu, Jan 6, 2022 at 12:05 AM Marco Sulla wrote: > > On Wed, 5 Jan 2022 at 00:54, Chris Angelico wrote: > > That's because a tuple is the correct data type when returning two > > distinct items. It's not a list that has two elements in it; it's a > > tuple of (key, value). Immutability is irrel

Re: Why operations between dict views return a set and not a frozenset?

2022-01-05 Thread Marco Sulla
On Wed, 5 Jan 2022 at 00:54, Chris Angelico wrote: > That's because a tuple is the correct data type when returning two > distinct items. It's not a list that has two elements in it; it's a > tuple of (key, value). Immutability is irrelevant. Immutability is irrelevant, speed no. A tuple is faste