pop method question
- From: Nicholas Parsons <parsons.nicholas1@xxxxxxxxx>
- Date: Sat, 3 Mar 2007 15:36:08 -0500
Howdy Folks,
I was just playing around in IDLE at the interactive prompt and typed in dir({}) for the fun of it. I was quite surprised to see a pop method defined there. I mean is that a misnomer or what? From the literature, pop is supposed to be an operation defined for a stack data structure. A stack is defined to be an "ordered" list data structure. Dictionaries in Python have no order but are sequences. Now, does anyone know why the python core has this pop method implemented for a dictionary type?
I realize that in this context it is used for removing a specific key from the current dictionary object. But why call it pop and not something more intuitive like remove or delete?
Thanks for the clarification in advance :).
--Nick
.
- Follow-Ups:
- Re: pop method question
- From: Raymond Hettinger
- Re: pop method question
- From: Paul Rubin
- Re: pop method question
- From: Stefan Scholl
- Re: pop method question
- Prev by Date: Re: classes and functions
- Next by Date: Re: pop method question
- Previous by thread: How to set docstrings for extensions supporting PyNumberMethods?
- Next by thread: Re: pop method question
- Index(es):
Relevant Pages
|
|