A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-November/010821.html below:

[Python-Dev] {}.first[key,value,item] and {}.pop (was Re: {}.getitem())

[Python-Dev] {}.first[key,value,item] and {}.pop (was Re: {}.getitem())Fred L. Drake, Jr. fdrake@acm.org
Thu, 30 Nov 2000 10:34:50 -0500 (EST)
Greg Wilson writes:
 > Should we then add dict.push(), which would add a key/value pair to the
 > dictionary?  I realize it's redundant (same effect as 'dict[x] = y'),

  We don't have [].push(), and I don't think the metaphor really works
well with dictionaries.  There's also an implied ordering relationship
between push() and pop(), and this doesn't hold for dictionaries
either.

 > but I think anyone who's gone through a CS course in data structures
 > and algorithms will expect push() where there's pop(), and it will allow
 > functions to be polymorphic over lists and dicts.

  There's only a limited amount on conceptual polymorphism between the
two; artificial extending that may lead to a lot of programmers using
the wrong structure for their application.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Digital Creations




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4