Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #43046

Re: How to do a Lispy-esque read?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <bsk16@case.edu>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'received:209.85.223': 0.03; 'received:209.85.223.198': 0.07; 'suppose': 0.07; 'string': 0.09; '[1,': 0.09; 'subject:How': 0.10; 'python': 0.11; 'ignore': 0.16; 'wrote:': 0.18; 'input': 0.22; 'to:name:python- list@python.org': 0.22; 'mon,': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'object.': 0.31; 'url:python': 0.33; 'comment': 0.34; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'url:listinfo': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'should': 0.36; 'example,': 0.37; 'turn': 0.37; 'received:209': 0.37; 'to:addr:python-list': 0.38; 'obtain': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'how': 0.40; 'read': 0.60; 'subject:read': 0.84; '2013': 0.98
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-received:in-reply-to:references:date :message-id:subject:from:to:content-type:x-gm-message-state; bh=ZaBzGLc2AdPK2iALe+6atnhbBVMf0g2dZrKxvNscjho=; b=eISywf/YuCEtuVGKlSahDE3kh1vfupfb2wY/LWdVtmBzhCPtZ6TxbDw6F/m6BjCdKO TO3pIa5XKL3puonglo27Xpdgj77mtU8gGFJWdya0lUofO/THb34Do3tREeljJep1UZlh SuaDoA3K0zCLFhShAU6OWu/qSBURWtOeAElsKHMqxcZxc5a9X0aKILpGzD1gU7PVnVXT eEu/k4TWmXJcQEjbOgtgx/3VizQwlddFRYUoNuJKrUZwmGveVywJmWkx0jmj8i8SRTPs L3xtCC0qjaTKFap6rhgMgvD/LOdhCAlCDBiSInOb3WdEP28yDDQf94kC61tC5w8jrWee Rndg==
X-Received by 10.182.204.5 with SMTP id ku5mr14620010obc.22.1365409975719; Mon, 08 Apr 2013 01:32:55 -0700 (PDT)
MIME-Version 1.0
X-Received by 10.182.204.5 with SMTP id ku5mr14620005obc.22.1365409975545; Mon, 08 Apr 2013 01:32:55 -0700 (PDT)
In-Reply-To <4ff75708-f8e4-4ec9-8a4b-e71eb1dc2892@googlegroups.com>
References <4ff75708-f8e4-4ec9-8a4b-e71eb1dc2892@googlegroups.com>
Date Mon, 8 Apr 2013 01:32:55 -0700
Subject Re: How to do a Lispy-esque read?
From Benjamin Kaplan <benjamin.kaplan@case.edu>
To "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-Gm-Message-State ALoCoQkEMiJ1mIoWVeAIOfY7Non/sb/OPfa76bmredmhG8M4xkl14SGFNCqeUjfRRXnDvuPoAv/LzS8qLhB90kX3Wp8jTEtR9bwH+UgrPg7iq1VzKTnC1zeCm0h54RRKT4EdgGLYF774e1hDYZmnb0/PXcpY8KZZjQ==
X-Junkmail-Whitelist YES (by domain whitelist at mpv1.tis.cwru.edu)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.272.1365410360.3114.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1365410360 news.xs4all.nl 6949 [2001:888:2000:d::a6]:42323
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:43046

Show key headers only | View raw


There is no "read in a stream until it's a valid literal" function as
far as I know, but ast.literal_eval will turn your string into an
object.

On Mon, Apr 8, 2013 at 12:45 AM,  <zeta.convex@gmail.com> wrote:
> Suppose I want to read an object from some stream. How do I do it?
>
> For example, if the input stream contained the text:
> [1, # python should ignore this comment
> 2]
>
> and I do a "read" on it, I should obtain the result
> [1, 2]
> --
> http://mail.python.org/mailman/listinfo/python-list

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to do a Lispy-esque read? zeta.convex@gmail.com - 2013-04-08 00:45 -0700
  Re: How to do a Lispy-esque read? Barrett Lewis <musikal.fusion@gmail.com> - 2013-04-08 01:17 -0700
  Re: How to do a Lispy-esque read? Benjamin Kaplan <benjamin.kaplan@case.edu> - 2013-04-08 01:32 -0700
  Re: How to do a Lispy-esque read? Arnaud Delobelle <arnodel@gmail.com> - 2013-04-08 18:46 +0100

csiph-web