A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2001-November/018726.html below:

Switching on Multiple Values, Rev 1.2

[Python-Dev] re: PEP 275: Switching on Multiple Values, Rev 1.2Greg Ewing greg@cosc.canterbury.ac.nz
Tue, 27 Nov 2001 16:12:17 +1300 (NZDT)
Brian Slesinsky <bslesins@best.com>:

> But sometimes you need to work with base types or other people's
> classes without subclassing them

I think there are situations where it's legitimate to prefer a
case-statement approach even when dealing with your own classes.

I once wrote a compiler in HUGS (a Haskell dialect), and I found it
very convenient to be able to write a self-contained function which
took a parse tree node and did something for each possible subtype of
that node. It kept all the processing related to each phase of the
compiler together in one place.

Using a pure OO aproach, I would have had to scatter it all among
hundreds of one or two-line methods of many classes, and probably
would have gone insane before finishing the project.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg@cosc.canterbury.ac.nz	   +--------------------------------------+



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