Howdy all,
What well-defined data type exists with the following properties:
* Mapping, key → value.
* Each key is a sequence (e.g. `tuple`) of items such as text strings.
* Items in a key may be the sentinel `ANY` value, which will match any
value at that position.
* A key may specify that
On Thu, 16 Jul 2015 11:51 am, Ben Finney wrote:
> Howdy all,
>
> What well-defined data type exists with the following properties:
>
> * Mapping, key → value.
>
> * Each key is a sequence (e.g. `tuple`) of items such as text strings.
>
> * Items in a key may be the sentinel `ANY` value, which
On 7/15/2015 9:51 PM, Ben Finney wrote:
Howdy all,
What well-defined data type exists with the following properties:
* Mapping, key → value.
* Each key is a sequence (e.g. `tuple`) of items such as text strings.
* Items in a key may be the sentinel `ANY` value, which will match any
value a
Steven D'Aprano writes:
> Sounds like a regular expression. Remember that computer science
> theoretical regular expressions don't just match strings, they can
> apply to any sequence of primitive values.
Good insight, thank you.
> In your case, you only need two special tokens, match-one and
>
Terry Reedy writes:
> On 7/15/2015 9:51 PM, Ben Finney wrote:
> > What well-defined data type exists with the following properties:
> >
> > * Mapping, key → value.
> >
> > * Each key is a sequence (e.g. `tuple`) of items such as text strings.
> >
> > * Items in a key may be the sentinel `ANY` val
On Thu, Jul 16, 2015 at 3:55 PM, Ben Finney wrote:
> Thanks. The part which puzzle me though: How do we teach the mapping
> type about that matching behaviour?
I'm not sure you really need a mapping type per se. The benefit of
something like Python's dict is that it gives really fast lookups via
On 07/15/2015 10:53 PM, Ben Finney wrote:
Steven D'Aprano writes:
You can't use a dict for the mapping, not unless you're smarter than
me, due to the requirement to hash the keys.
Dang. It's the mapping that I really need to solve, I think. A mapping
that has a custom “does this candidate m
Chris Angelico writes:
> I'm not sure you really need a mapping type per se.
My reasons include (but I can probably think of more) testing membership
via the ‘key in mapping’ syntax.
> with the "match any" concept, there's actually a potential for
> ambiguities, which means you need a sequentia
Ethan Furman writes:
> On 07/15/2015 10:53 PM, Ben Finney wrote:
> > Are those the ‘__contains__’, ‘__getitem__’ methods? What actually
> > is the API of a mapping type, that would need to be customised for
> > this application?
>
> The problem is that potential key matches are found by hashes
F
On Thu, Jul 16, 2015 at 1:31 AM, Ben Finney wrote:
> Fine by me. What is the mapping API that needs to be implemented though?
Have a look at collections.MutableMapping.
--
Zach
--
https://mail.python.org/mailman/listinfo/python-list
Ben Finney :
> What well-defined data type exists with the following properties:
>
> * Mapping, key → value.
>
> * Each key is a sequence (e.g. `tuple`) of items such as text strings.
>
> * Items in a key may be the sentinel `ANY` value, which will match any
> value at that position.
>
> * A key
On 16/07/2015 07:37, Ben Finney wrote:
Ethan Furman writes:
On 07/15/2015 10:53 PM, Ben Finney wrote:
Are those the ‘__contains__’, ‘__getitem__’ methods? What actually
is the API of a mapping type, that would need to be customised for
this application?
The problem is that potential key mat
Zachary Ware writes:
> On Thu, Jul 16, 2015 at 1:31 AM, Ben Finney
> wrote:
> > Fine by me. What is the mapping API that needs to be implemented though?
>
> Have a look at collections.MutableMapping.
Thank you, that's great! I hadn't realised the ‘collections’ module had
such comprehensive cov
On 16/07/2015 08:09, Mark Lawrence wrote:
On 16/07/2015 07:37, Ben Finney wrote:
Ethan Furman writes:
On 07/15/2015 10:53 PM, Ben Finney wrote:
Are those the ‘__contains__’, ‘__getitem__’ methods? What actually
is the API of a mapping type, that would need to be customised for
this applicati
On 16/07/2015 08:11, Ben Finney wrote:
Zachary Ware writes:
On Thu, Jul 16, 2015 at 1:31 AM, Ben Finney wrote:
Fine by me. What is the mapping API that needs to be implemented though?
Have a look at collections.MutableMapping.
Thank you, that's great! I hadn't realised the ‘collections’
I'm ill, so I am not trusting my own reasoning further than I can
jump (not too far today) but I don't think you have a problem that
is well-suited to a mapping. But it seems like a perfect fit
for a tree, to me.
Laura
--
https://mail.python.org/mailman/listinfo/python-list
16 matches
Mail list logo