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


Groups > comp.lang.python > #98708

Re: Why does 'as' not recognized?

From John Gordon <gordon@panix.com>
Newsgroups comp.lang.python
Subject Re: Why does 'as' not recognized?
Date 2015-11-12 17:24 +0000
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <n22i0g$nlg$1@reader1.panix.com> (permalink)
References <8ddbc8fd-ebdb-4cd2-8e3b-b0e1f5142e76@googlegroups.com>

Show all headers | View raw


In <8ddbc8fd-ebdb-4cd2-8e3b-b0e1f5142e76@googlegroups.com> fl <rxjwg98@gmail.com> writes:

> >>> cats = ['Tom', 'Snappy', 'Kitty', 'Jessie', 'Chester']
> >>> 
> >>> type(cats)
> <type 'list'>
> >>> cats[2]
> 'Kitty'
> >>> as=cats[2]
> SyntaxError: invalid syntax
> >>> as=cats
> SyntaxError: invalid syntax
> >>> as
> SyntaxError: invalid syntax

'as' is a python language keyword, and cannot be used for variable names.

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon@panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"

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


Thread

Why does 'as' not recognized? fl <rxjwg98@gmail.com> - 2015-11-12 09:20 -0800
  Re: Why does 'as' not recognized? John Gordon <gordon@panix.com> - 2015-11-12 17:24 +0000

csiph-web