On 08/03/17 00:18, Steven D'Aprano wrote:
I thought about that and rejected it as an unnecessary complication.
Hetrogeneous and unknown might as well be the same state: either way,
you cannot use the homogeneous-type optimization.
Knowing it's definitely one of two positive states and not knowi
On Tue, Mar 07, 2017 at 09:10:00PM +, Elliot Gorokhovsky wrote:
> I think the bigger problem, though, is that most list use does *not*
> involve sorting,
There are other uses for a type hint apart from sorting. There may be
optimized versions of other functions (sum, math.fsum, ...) and lis
On Tue, Mar 07, 2017 at 08:46:45PM +, Erik wrote:
> I don't think anyone has mentioned this yet, but FWIW I think the 'type
> hint' may need to be tri-state: heterogeneous (NULL), homogeneous (the
> pointer to the type structure) and also "unknown" (a sentinel value -
> the address of a sta
On Tue, Mar 7, 2017 at 4:53 PM David Mertz wrote:
>
>
> In [22]: class Eq(int):
> def __eq__(self, other):
> return True
>:
> In [23]: four, five, six = Eq(4), Eq(5), Eq(6)
> In [24]: lst = [four, five, six]
> In [25]: lst.count(Eq(7))
> Out[25]: 3
>
>
> How would this work (o
On Tue, Mar 7, 2017 at 6:27 PM, Erik wrote:
> Good point about list.extend(). I don't think __type_hint__ could help
>> with .__contains__() or .count() or .remove(). E.g.:
>>
>> In [7]: lst = [1.0, 2.0, 1+0j, F(1,1)]
>> In [8]: from fractions import Fraction as F
>> In [9]: lst = [
Hi David,
On 07/03/17 22:39, David Mertz wrote:
On Tue, Mar 7, 2017 at 4:36 PM, Erik mailto:pyt...@lucidity.plus.com>> wrote:
* Several other methods ('contains', 'remove', 'count', 'index')
also use PyObject_RichCompareBool(). They could also presumably
benefit from the same optimi
On Tue, Mar 7, 2017 at 4:36 PM, Erik wrote:
> * listextend() - this should do the right thing with the type hint when
>> extending one list with another.
>>
>
> * Several other methods ('contains', 'remove', 'count', 'index') also use
> PyObject_RichCompareBool(). They could also presumably benef
Hi Elliot,
On 07/03/17 21:10, Elliot Gorokhovsky wrote:
On Tue, Mar 7, 2017 at 1:47 PM Erik mailto:pyt...@lucidity.plus.com>> wrote:
I'd prefer the sort optimization to be based on what my list contains
NOW, not on what it may have contained some time in the past, so I'm not
a fan
On Tue, Mar 7, 2017 at 1:47 PM Erik wrote:
>
> I'd prefer the sort optimization to be based on what my list contains
> NOW, not on what it may have contained some time in the past, so I'm not
> a fan of the "once heterogeneous, always considered heterogeneous"
> behaviour if it's cheap enough to
On 07/03/17 20:46, Erik wrote:
(unless it
was acceptable that once heterogeneous, a list is always considered
heterogeneous - i.e., delete always sets the hint to NULL).
Rubbish. I meant that delete would not touch the hint at all.
E.
___
Python-idea
On 06/03/17 03:08, David Mertz wrote:
On Sun, Mar 5, 2017 at 6:45 PM, Steven D'Aprano mailto:st...@pearwood.info>> wrote:
Here is a radical thought... why don't lists track their common type
themselves? There's only a few methods which can add items:
I had exactly the same thought. Li
Thank you for guiding me, Mike. We see us on CLT this weekend :-)
Regards,
Thomas Güttler
Am 06.03.2017 um 12:01 schrieb Mike Müller:
Am 06.03.17 um 11:12 schrieb Thomas Güttler:
yes, you are right. It's better to leave Python3 clean (without "basestring").
I see two ways now.
six
Ever looked up cffi? You won't be disappointed.
--
Ryan (ライアン)
Yoko Shimomura > ryo (supercell/EGOIST) > Hiroyuki Sawano >> everyone else
http://refi64.com
On Mar 7, 2017 3:43 AM, "George Fischhof" wrote:
> Hi Guys,
>
> right now I had to call functions from a dll, and I started using ctypes.
>
I have in the past written a small utility to use compact signatures like:
i i -> i
to indicate a function taking two ints and returning an int.
See for example:
https://github.com/stephanh42/armasm
Op 7 mrt. 2017 10:43 a.m. schreef "George Fischhof" :
> Hi Guys,
>
> right now I had to call f
Hi Guys,
right now I had to call functions from a dll, and I started using ctypes.
I found this library too
https://pypi.python.org/pypi/pywrap/0.1.0
which says (qutation):
Replace this:
prototype = ctypes.WINFUNCTYPE(wintypes.HANDLE, wintypes.UINT,
wintypes.HANDLE)paramflags = (1, "uFormat"
15 matches
Mail list logo