[Python-ideas] Keyword/Symbol literals

Chris Barker chris.barker at noaa.gov
Wed Jan 21 21:07:14 CET 2015


On Wed, Jan 21, 2015 at 11:38 AM, Alexander Belopolsky <
alexander.belopolsky at gmail.com> wrote:

>
> On Wed, Jan 21, 2015 at 2:13 PM, Guido van Rossum <guido at python.org>
> wrote:
>
>> Lack of a use case?
>
>
> My use case comes from interoperability with other languages.  I maintain
> a package which provides an interface [1] between Python and the language
> [2] called Q.  Q has 3 scalar types to represent text data (char, byte and
> symbol) and the corresponding vector types.  When I pass Python strings to
> Q, I convert them to symbols because that is what users expect most of the
> time, but as a result, working with char vectors is unnatural.
>

couldn't you create a subclass of str that was exactly the same except that
it was defined as mapping to a Q symbol?

-Chris


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150121/a20ac36c/attachment.html>


More information about the Python-ideas mailing list