switch

Ethan Furman ethan at stoneleaf.us
Thu Dec 10 12:52:41 EST 2009


Asun Friere wrote:
> On Dec 10, 2:00 pm, Carl Banks <pavlovevide... at gmail.com> wrote:
> 
>>On Dec 9, 5:02 pm, Asun Friere <afri... at yahoo.co.uk> wrote:
>>
>>
>>>On Dec 9, 7:08 pm, Carl Banks <pavlovevide... at gmail.com> wrote:
>>
>>>>What if the object is a string you just read from a file?
>>
>>>>How do you dispatch using polymorphism in that case?
>>
>>>This would be a pertinent question, were I advocating that _all_
>>>switch statements should, or even can, be replaced with "dispatch
>>>using polymorphism."
>>
>>Then why did you claim that a decent OO should never have a switch
>>statement then?
>>You argued that a decent language OO should never
>>have a switch statement because polymorphic dispatch is the right way
>>to handle it in OO languages, which implies that polymorphism can and
>>should take the place of any switch statement.
> 
> That is a misreading.  I wrote... [snip]

You wrote, and I quote, "For which reason python has no 'case'
statement and why *no decent OO language should* ." [emphasis added]

Just to be clear.

~Ethan~



More information about the Python-list mailing list