Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #105868

Re: Suggestion: make sequence and map interfaces more similar

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Mark Lawrence <breamoreboy@yahoo.co.uk>
Newsgroups comp.lang.python
Subject Re: Suggestion: make sequence and map interfaces more similar
Date Sun, 27 Mar 2016 20:24:18 +0100
Lines 35
Message-ID <mailman.93.1459106717.28225.python-list@python.org> (permalink)
References <CABbU2U_DsSC=6d0HOwgGnzQZ0=r6U2sf_zOJP0U_w7_i0RrOKQ@mail.gmail.com> <CABbU2U-SEWhOR-D4P2tiwJ3OUnpjz2LBzzqjyo2+guzjwcwddw@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de Qt0EdY5KM2vd33WxbtJ6wwl/dac8k+jdYDQCran0YuGw==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'url:pypi': 0.03; 'from:addr:yahoo.co.uk': 0.05; 'incompatible': 0.07; 'method,': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'bug': 0.10; '"is': 0.16; 'containers': 0.16; 'contract.': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'subclassing': 0.16; 'subject:interfaces': 0.16; 'subject:make': 0.16; 'wrote:': 0.16; 'library,': 0.18; 'language': 0.19; 'lawrence': 0.22; 'suppose': 0.22; 'trying': 0.22; 'patch': 0.24; 'written': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'sequence': 0.27; 'interface': 0.29; 'code': 0.30; 'e.g.': 0.30; 'language.': 0.32; 'skills.': 0.32; 'useful': 0.33; 'class': 0.33; 'problem': 0.33; 'url:python': 0.33; 'licensed': 0.35; 'something': 0.35; 'but': 0.36; 'should': 0.36; 'url:org': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'turn': 0.37; 'received:org': 0.37; 'why': 0.39; 'to:addr:python.org': 0.40; 'mark': 0.40; 'your': 0.60; 'provide': 0.61; 'subject:more': 0.61; 'charset:windows-1252': 0.62; 'more': 0.63; 'our': 0.64; 'inherit': 0.66; 'python-list': 0.66; 'briefly,': 0.84; 'dict.': 0.84; 'pythonistas,': 0.84; 'on?': 0.91; 'dirty': 0.93
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host 195.147.217.247
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1
In-Reply-To <CABbU2U-SEWhOR-D4P2tiwJ3OUnpjz2LBzzqjyo2+guzjwcwddw@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:105868

Show key headers only | View raw


On 27/03/2016 19:01, Marco S. via Python-list wrote:
>
> Mark Lawrence wrote:
>
>> I cannot see this happening unless you provide a patch on the bug
>> tracker.  However I suspect you can get the same thing by subclassing
>> dict.  Why don't you try it and let us know how you get on?
>
> The problem with a vdict is that I should also create by zero a new
> interface (ABC), since MutableMapping have an incompatible contract.
> And to be much more useful I should code it inc C, and my C skills are
> not so magnificent. Furthermore I would try to create a new sequence
> interface that inherit from the vdict interface. More briefly, I need
> much free time. But I suppose I can start with something quick and
> dirty.
>

Why do you need a new interace if all you're trying to do is create a
vdict class that has "iter(d) == iter(d.values()), and should also
have a count() method, like sequence types"?

I don't understand why you think you need C skills.  E.g. 
SortedContainers https://pypi.python.org/pypi/sortedcontainers "is an 
Apache2 licensed containers library, written in pure-Python, and fast as 
C-extensions."

I think your quick and dirty might well turn into something useful for 
your application.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Suggestion: make sequence and map interfaces more similar Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-27 20:24 +0100

csiph-web