Re: Is '[' a function or an operator or an language feature?

2010-07-18 Thread Thomas Jollans
On 07/17/2010 04:59 AM, pyt...@bdurham.com wrote:
 Tim,
 
 2.x?! You were lucky. We lived for three months with Python 1.x in a septic 
 tank. We used to have to get up at six in the morning, write our 1.x code 
 using ed, eat a crust of stale bread, go to work down in machine language, 
 fourteen hours a day, 
 week-in week-out, for sixpence a week, and when we got home our Dad
 would thrash us to sleep wi' his belt...
 
 Luxury. Our computers only had 256 bytes[1] of RAM and We had to enter
 our code, in the dark, using loose binary toggle switches with poor
 connections. We used to have to get out of the lake at three o'clock in
 the morning, clean the lake, eat a handful of hot gravel, go to work at
 the mill every day for tuppence a month, come home, and Dad would beat
 us around the head and neck with a broken bottle, if we were LUCKY! 

 [1] http://incolor.inebraska.com/bill_r/elf/html/elf-1-33.htm

In slightly related news, I just stumbled upon this:

http://catb.org/esr/jargon/html/story-of-mel.html

Now of course, he had it tough.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-18 Thread python
Thomas,

 In slightly related news, I just stumbled upon this:
 http://catb.org/esr/jargon/html/story-of-mel.html
 
 Now of course, he had it tough.

Tough???

Well we had it tough. Our computers[1][2] had 0 bytes of RAM and 0 bytes
of ROM. We had to hand wire our logic and physically push data through
logic gates without the benefit of transistors. We used to have to get
up out of the shoebox at twelve o'clock at night, and LICK the road
clean with our tongues. We had half a handful of freezing cold gravel,
worked twenty-four hours a day at the mill for fourpence every six
years, and when we got home, our Dad would slice us in two with a bread
knife.

Malcolm 

[1] http://totallytrygve.com/computer.php?item=188picture=0 

[2] I learned about computers through one of these kits. When I first
stumbled across assembly language (6502), my first thought was, wow,
this is so much easier than what I've been doing!


snipped
 2.x?! You were lucky. We lived for three months with Python 1.x in a septic 
 tank. We used to have to get up at six in the morning, write our 1.x code 
 using ed, eat a crust of stale bread, go to work down in machine language, 
 fourteen hours a day, 
 week-in week-out, for sixpence a week, and when we got home our Dad
 would thrash us to sleep wi' his belt...
 
 Luxury. Our computers only had 256 bytes[1] of RAM and We had to enter
 our code, in the dark, using loose binary toggle switches with poor
 connections. We used to have to get out of the lake at three o'clock in
 the morning, clean the lake, eat a handful of hot gravel, go to work at
 the mill every day for tuppence a month, come home, and Dad would beat
 us around the head and neck with a broken bottle, if we were LUCKY! 

 [1] http://incolor.inebraska.com/bill_r/elf/html/elf-1-33.htm

In slightly related news, I just stumbled upon this:

http://catb.org/esr/jargon/html/story-of-mel.html

Now of course, he had it tough.
/snipped
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-17 Thread Steven D'Aprano
On Fri, 16 Jul 2010 21:23:09 -0500, Tim Chase wrote:

 Is anyone /still/ using Python 2.x? ;-)
 
 2.x?!  You were lucky. We lived for three months with Python 1.x in a
 septic tank. We used to have to get up at six in the morning, write our
 1.x code using ed,

You got to use ed? Oh, we *dreamed* of using an editor! We had to edit 
the sectors on disk directly with a magnetised needle. A rusty, blunt 
needle.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-17 Thread geremy condra
On Sat, Jul 17, 2010 at 1:03 AM, Steven D'Aprano
st...@remove-this-cybersource.com.au wrote:
 On Fri, 16 Jul 2010 21:23:09 -0500, Tim Chase wrote:

 Is anyone /still/ using Python 2.x? ;-)

 2.x?!  You were lucky. We lived for three months with Python 1.x in a
 septic tank. We used to have to get up at six in the morning, write our
 1.x code using ed,

 You got to use ed? Oh, we *dreamed* of using an editor! We had to edit
 the sectors on disk directly with a magnetised needle. A rusty, blunt
 needle.

Real programmers use butterflies.

http://xkcd.com/378/

Geremy Condra
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-17 Thread Mark Lawrence

On 17/07/2010 03:59, pyt...@bdurham.com wrote:

Tim,


2.x?! You were lucky. We lived for three months with Python 1.x in a septic 
tank. We used to have to get up at six in the morning, write our 1.x code using 
ed, eat a crust of stale bread, go to work down in machine language, fourteen 
hours a day,

week-in week-out, for sixpence a week, and when we got home our Dad
would thrash us to sleep wi' his belt...

Luxury. Our computers only had 256 bytes[1] of RAM and We had to enter
our code, in the dark, using loose binary toggle switches with poor
connections. We used to have to get out of the lake at three o'clock in
the morning, clean the lake, eat a handful of hot gravel, go to work at
the mill every day for tuppence a month, come home, and Dad would beat
us around the head and neck with a broken bottle, if we were LUCKY!

Cheers,
Malcolm

[1] http://incolor.inebraska.com/bill_r/elf/html/elf-1-33.htm


I'm just envisaging a Paper Tape Repairman sketch.

Kindest regards.

Mark Lawrence.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-17 Thread Thomas Jollans
On 07/17/2010 10:03 AM, Steven D'Aprano wrote:
 On Fri, 16 Jul 2010 21:23:09 -0500, Tim Chase wrote:
 
 Is anyone /still/ using Python 2.x? ;-)

 2.x?!  You were lucky. We lived for three months with Python 1.x in a
 septic tank. We used to have to get up at six in the morning, write our
 1.x code using ed,
 
 You got to use ed? Oh, we *dreamed* of using an editor! We had to edit 
 the sectors on disk directly with a magnetised needle. A rusty, blunt 
 needle.
 

You try and tell the young people of today that, and they won't believe
you.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-17 Thread Paul McGuire
On Jul 16, 12:01 pm, Peng Yu pengyu...@gmail.com wrote:
 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

Also look for __getitem__ and __setitem__, these methods defined on
your own container classes will allow you to write myobject['x'] and
have your own custom lookup code get run.

-- Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-17 Thread Gary Herron

On 07/17/2010 01:03 AM, Steven D'Aprano wrote:

On Fri, 16 Jul 2010 21:23:09 -0500, Tim Chase wrote:

   

Is anyone /still/ using Python 2.x? ;-)
   

2.x?!  You were lucky. We lived for three months with Python 1.x in a
septic tank. We used to have to get up at six in the morning, write our
1.x code using ed,
 

You got to use ed? Oh, we *dreamed* of using an editor! We had to edit
the sectors on disk directly with a magnetised needle. A rusty, blunt
needle.
   


Along those lines, there's this -- one of my favorite comics:

http://xkcd.com/378/

and unrelated to the thread but still about python:

http://xkcd.com/353/

Gary Herron


--
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-17 Thread Thomas Jollans
On 07/17/2010 06:38 PM, Gary Herron wrote:
 On 07/17/2010 01:03 AM, Steven D'Aprano wrote:
 On Fri, 16 Jul 2010 21:23:09 -0500, Tim Chase wrote:

   
 Is anyone /still/ using Python 2.x? ;-)

 http://xkcd.com/353/

There we have the most important difference between Python 2 and 3: in
the latter, import antigravity actually works.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-17 Thread Emile van Sebille

On 7/17/2010 9:38 AM Gary Herron said...

and unrelated to the thread but still about python:

http://xkcd.com/353/


ActivePython 2.6.1.1 (ActiveState Software Inc.) based on
Python 2.6.1 (r261:67515, Dec  5 2008, 13:58:38) [MSC v.1500 32 bit 
(Intel)] on win32

Type help, copyright, credits or license for more information.
 import antigravity
Nothing happens.


Emile

--
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-17 Thread Emile van Sebille

On 7/16/2010 7:08 PM MRAB said...

Peng Yu wrote:

On Fri, Jul 16, 2010 at 5:42 PM, Terry Reedy tjre...@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? ;-)


Is anyone /actually/ using Python 3.x ;-)

Emile

--
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-17 Thread Benjamin Kaplan
On Sat, Jul 17, 2010 at 10:27 AM, Emile van Sebille em...@fenx.com wrote:

 On 7/17/2010 9:38 AM Gary Herron said...

  and unrelated to the thread but still about python:

 http://xkcd.com/353/


 ActivePython 2.6.1.1 (ActiveState Software Inc.) based on
 Python 2.6.1 (r261:67515, Dec  5 2008, 13:58:38) [MSC v.1500 32 bit
 (Intel)] on win32
 Type help, copyright, credits or license for more information.
  import antigravity
 Nothing happens.
 

 Emile


Try it in Python 3.



 --
 http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-17 Thread Emile van Sebille

On 7/17/2010 10:57 AM Benjamin Kaplan said...

Try it in Python 3.



Cool. :)

Although I wouldn't have been surprised had my monitor levitated.  :)

Emile



--
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-16 Thread Robert Kern

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

--
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-16 Thread Terry Reedy

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

--
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-16 Thread Peng Yu
On Fri, Jul 16, 2010 at 5:42 PM, Terry Reedy tjre...@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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-16 Thread MRAB

Peng Yu wrote:

On Fri, Jul 16, 2010 at 5:42 PM, Terry Reedy tjre...@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? ;-)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-16 Thread Tim Chase

On 07/16/2010 09:08 PM, MRAB wrote:

Peng Yu wrote:

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? ;-)


2.x?!  You were lucky. We lived for three months with Python 1.x 
in a septic tank. We used to have to get up at six in the 
morning, write our 1.x code using ed, eat a crust of stale bread, 
go to work down in machine language, fourteen hours a day, 
week-in week-out, for sixpence a week, and when we got home our 
Dad would thrash us to sleep wi' his belt...


-tkc




--
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-16 Thread python
Tim,

 2.x?! You were lucky. We lived for three months with Python 1.x in a septic 
 tank. We used to have to get up at six in the morning, write our 1.x code 
 using ed, eat a crust of stale bread, go to work down in machine language, 
 fourteen hours a day, 
week-in week-out, for sixpence a week, and when we got home our Dad
would thrash us to sleep wi' his belt...

Luxury. Our computers only had 256 bytes[1] of RAM and We had to enter
our code, in the dark, using loose binary toggle switches with poor
connections. We used to have to get out of the lake at three o'clock in
the morning, clean the lake, eat a handful of hot gravel, go to work at
the mill every day for tuppence a month, come home, and Dad would beat
us around the head and neck with a broken bottle, if we were LUCKY!

Cheers,
Malcolm

[1] http://incolor.inebraska.com/bill_r/elf/html/elf-1-33.htm
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is '[' a function or an operator or an language feature?

2010-07-16 Thread Terry Reedy

On 7/16/2010 9:42 PM, Peng Yu wrote:

On Fri, Jul 16, 2010 at 5:42 PM, Terry Reedytjre...@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?


They are close to 100% the same. I intentionally worded the entries so 
one could look in the manuals for details.



--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list