From: Peng Yu on
I mean to get the man page for '[' like in the following code.

x=[1,2,3]


But help('[') doesn't seem to give the above usage.

###########
Mutable Sequence Types
**********************

List objects support additional operations that allow in-place
modification of the object. Other mutable sequence types (when added
to the language) should also support these operations. Strings and
tuples are immutable sequence types: such objects cannot be modified
once created. The following operations are defined on mutable sequence
types (where *x* is an arbitrary object):
....
##########

I then checked help('LISTLITERALS'), which gives some description that
is available from the language reference. So '[' in "x=[1,2,3]" is
considered as a language feature rather than a function or an
operator?

############
List displays
*************

A list display is a possibly empty series of expressions enclosed in
square brackets:

list_display ::= "[" [expression_list | list_comprehension] "]"
list_comprehension ::= expression list_for
list_for ::= "for" target_list "in" old_expression_list
[list_iter]
old_expression_list ::= old_expression [("," old_expression)+ [","]]
list_iter ::= list_for | list_if
list_if ::= "if" old_expression [list_iter]
......
###########
--
Regards,
Peng
From: Robert Kern on
On 7/16/10 12:01 PM, Peng Yu wrote:

> I then checked help('LISTLITERALS'), which gives some description that
> is available from the language reference. So '[' in "x=[1,2,3]" is
> considered as a language feature rather than a function or an
> operator?

Yes. It is part of the list literal syntax of the Python language.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

From: Terry Reedy on
On 7/16/2010 1:01 PM, Peng Yu wrote:
> I mean to get the man page for '[' like in the following code.
>
> x=[1,2,3]

You might find my Python symbol glossary useful.
https://code.google.com/p/xploro/downloads/detail?name=PySymbols.html

From: Peng Yu on
On Fri, Jul 16, 2010 at 5:42 PM, Terry Reedy <tjreedy(a)udel.edu> wrote:
> On 7/16/2010 1:01 PM, Peng Yu wrote:
>>
>> I mean to get the man page for '[' like in the following code.
>>
>> x=[1,2,3]
>
> You might find my Python symbol glossary useful.
> https://code.google.com/p/xploro/downloads/detail?name=PySymbols.html

This is for Python 3. Is there one for Python 2.x?

--
Regards,
Peng
From: MRAB on
Peng Yu wrote:
> On Fri, Jul 16, 2010 at 5:42 PM, Terry Reedy <tjreedy(a)udel.edu> wrote:
>> On 7/16/2010 1:01 PM, Peng Yu wrote:
>>> I mean to get the man page for '[' like in the following code.
>>>
>>> x=[1,2,3]
>> You might find my Python symbol glossary useful.
>> https://code.google.com/p/xploro/downloads/detail?name=PySymbols.html
>
> This is for Python 3. Is there one for Python 2.x?
>
Is anyone /still/ using Python 2.x? ;-)