On 3 Feb 2013 00:39, "Antoine Pitrou" <solipsis@pitrou.net> wrote:
>
> On Sun, 3 Feb 2013 00:28:55 +1000
> Nick Coghlan <ncoghlan@gmail.com> wrote:
> > FWIW, I could personally tolerate the introduction of s{} and fs{}
> > literals. We'd just declare the "s" prefix optional for non-empty sets to
> > match the current rules.
> >
> > Encouraging the use of ast.literal_eval() over the security nightmare that
> > is eval() would be more than enough justification for me. (As a syntax
> > change, the idea would still need a PEP, though)
>
> If it is enough of a justification, then why not literal support for
> more useful datatypes (decimal, datetime...) rather than frozenset?

The difference is that decimal and datetime already have safe "from string" conversion operations. The empty set and frozen sets do not.

That said, a decimal literal proposal would be a reasonable follow-up to the incorporation of cdecimal.

Datetime is a more difficult prospect, since there are good reasons strptime is as flexible as it is.

Regardless, I'm not saying a PEP to support all the builtin container types in ast.literal_eval would necessarily be accepted. I'm merely saying it is *worth writing*.

Cheers,
Nick.

>
> Regards
>
> Antoine.
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> http://mail.python.org/mailman/listinfo/python-ideas