[Python-ideas] Keyword/Symbol literals

Alexander Belopolsky alexander.belopolsky at gmail.com
Wed Jan 21 21:40:39 CET 2015


On Wed, Jan 21, 2015 at 3:07 PM, Chris Barker <chris.barker at noaa.gov> wrote:

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


I could, but having a dedicated syntax would make things nicer.

Here is what I have:

## Pass some python data to q
q.symbol = 'abc'
q.symbols = ['abc', 'def']
q.char = q('"a"')   # no python syntax
q.chars = b'abc'
q.vector_of_chars = [b'abc', b'def']
q.byte = q('0x01')  # no python syntax
..

here is what I would rather have

q.symbol = `abc
q.symbols = [`abc, `def]
q.char = q('"a"')   # no python syntax
q.chars = 'abc'
q.vector_of_chars = ['abc',  'def']
q.byte =  q('0x01')  # no python syntax
q.bytes = [b'xyz']  # or bytes([0x78, 0x79, 0x7a])
..
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150121/203b53c8/attachment.html>


More information about the Python-ideas mailing list