I think it could inherit from the Mapping abc?
class frozendict(Mapping):
def __new__(cls, *args, **kwargs):
d = dict(*args, **kwargs)
proxy = MappingProxyType(d)
instance = super().__new__(cls)
instance.__proxy = proxy
return instance
def
s a specific serialization format that explicitly rejects
> datetime objects in *all* the languages with JSON libraries. You can only
> use date objects in JSON if you control or understand both serialization
> and deserialization ends and have an agreed representation.
>
> On Fri, Nov 2, 201
Is there any reason why date, datetime, and UUID objects automatically
serialize to default strings using the csv module, but json.dumps throws an
error as a default? i.e.
import csv
import json
import io
from datetime import date
stream = io.StringIO()
writer = csv.writer(stream)
Hi, I just started to use the new dataclasses module. My initial use case
boils down to somewhere between a namedtuple and a class where I want a
record with a few methods.
Mainly, I am trying to build a specific record from various sources, and
then have the class handle validation and
Hi, I first want to thank everyone in the community for the contributions
over the years. I know the idea of a frozendict has been proposed before
and rejected. I have a use case for a frozendict implementation that to my
knowledge was not discussed during previous debates. My reasoning for a
t 10, 2018 at 6:24 PM Steven D'Aprano wrote:
> Hi Philiip, and welcome,
>
> On Wed, Oct 10, 2018 at 12:04:48PM -0500, Philip Martin wrote:
>
> > I generally have used MappingProxyType as a way to set default mapping
> > to a function or to set an empty mapping to a f
, etc.
On Wed, Oct 10, 2018 at 6:24 PM Steven D'Aprano wrote:
> Hi Philiip, and welcome,
>
> On Wed, Oct 10, 2018 at 12:04:48PM -0500, Philip Martin wrote:
>
> > I generally have used MappingProxyType as a way to set default mapping
> > to a function or to set an emp
for a frozendict to ultimately decide whether this is the case.
On Wed, Oct 10, 2018 at 9:01 PM Cameron Simpson wrote:
> On 10Oct2018 20:25, Philip Martin wrote:
> >Steven, that's a great idea, and I would be 100% up for your suggestion to
> >have types.MappingProxyType rename
from set gives precedence for a frozendict not
subclassing dict? The methods clear, pop, popitem, update and setdefault
would not be necessary.
On Wed, Oct 10, 2018 at 9:28 PM Chris Angelico wrote:
> On Thu, Oct 11, 2018 at 1:02 PM Cameron Simpson wrote:
> >
> > On 10Oct2018 20:25