Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #9209
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <mhrivnak@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; '"if': 0.04; 'api.': 0.05; 'python:': 0.05; 'anticipate': 0.07; 'forcing': 0.07; 'override': 0.07; 'removes': 0.07; 'suggesting': 0.07; 'python': 0.08; 'ambiguity': 0.09; 'derived': 0.09; 'exception.': 0.09; 'referencing': 0.09; 'subclass': 0.09; 'throw': 0.09; 'syntax': 0.11; 'wrote:': 0.15; 'library': 0.15; '"private"': 0.16; '*always*': 0.16; 'cares': 0.16; 'clashes': 0.16; 'declaration': 0.16; 'declaring': 0.16; 'documented.': 0.16; 'equation.': 0.16; 'naive': 0.16; 'rantingrick': 0.16; 'syntactical': 0.16; '\xa0def': 0.16; '\xa0print': 0.16; 'argument': 0.16; 'class,': 0.16; 'cc:addr:python-list': 0.16; 'pm,': 0.16; 'def': 0.16; 'written': 0.17; "wouldn't": 0.17; 'suggest': 0.17; 'exists': 0.19; 'figure': 0.21; 'cc:2**0': 0.21; 'long,': 0.22; 'cc:no real name:2**0': 0.22; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'gregory': 0.23; 'modification': 0.23; 'received:209.85.215.46': 0.23; 'received:mail-ew0-f46.google.com': 0.23; "shouldn't": 0.23; 'somehow': 0.23; 'code': 0.24; 'library.': 0.25; 'sender:addr:gmail.com': 0.26; 'developing': 0.27; 'url:mailman': 0.27; 'sort': 0.28; 'language.': 0.28; 'effect': 0.28; 'message- id:@mail.gmail.com': 0.28; 'class.': 0.29; 'code,': 0.29; 'django': 0.29; 'cc:addr:python.org': 0.30; 'fact': 0.30; 'classes': 0.30; 'module': 0.30; '(just': 0.30; 'behaves': 0.30; 'ewing': 0.30; 'solved': 0.30; 'sun,': 0.30; 'class': 0.31; 'equivalent': 0.31; 'programmers': 0.31; 'url:listinfo': 0.32; 'michael': 0.32; 'does': 0.32; 'it.': 0.33; 'there': 0.34; 'however,': 0.34; 'someone': 0.34; 'quite': 0.34; "can't": 0.34; 'all.': 0.35; 'example,': 0.35; 'matter,': 0.35; "isn't": 0.35; 'probably': 0.35; 'skip:" 10': 0.36; 'idea': 0.36; 'explain': 0.36; 'error.': 0.36; 'url:python': 0.37; 'functions.': 0.37; 'specially': 0.37; 'unless': 0.37; 'open': 0.37; 'some': 0.37; 'but': 0.37; 'using': 0.37; 'another': 0.38; 'received:google.com': 0.38; 'received:209.85': 0.38; 'url:org': 0.38; 'subject:: ': 0.38; 'think': 0.38; 'problems': 0.38; 'put': 0.38; '8bit%:5': 0.38; 'easier': 0.39; 'should': 0.39; 'difficult': 0.39; 'ways': 0.39; 'got': 0.39; 'might': 0.39; 'received:209': 0.40; 'did': 0.40; 'where': 0.40; 'methods': 0.40; 'your': 0.60; 'matter': 0.61; 'human': 0.63; 'marked': 0.64; 'tag': 0.64; 'making': 0.66; 'subject:!': 0.67; 'special': 0.67; 'works,': 0.68; 'subject:are': 0.70; 'concerns': 0.80; 'adhere': 0.84; 'dilemma': 0.84; 'poorly': 0.84; 'readability': 0.84; 'readers.': 0.84; 'this...': 0.84; 'zen': 0.84; 'complexity': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=VNd2NTQ4DTk5J07lWFgEBGMRwsXMyD3bgYxC8U/Nmjc=; b=PkOeTz5Fn1ymkaqDj1o1AlsaWXsvVEkl4P1dSna1Ux6uPd4KfSUxZwgKa/MzE/kVnq vPap7PGYf5PBLXerOsk9R0I3reC73SnOhU3SQ4iNqRr/afK+9UGMzta+2azB9n7HkeqD tlvXFopYyNCaTI0vWMhupiHu9Vhh35/U9p2ug= |
| MIME-Version | 1.0 |
| Sender | mhrivnak@gmail.com |
| In-Reply-To | <d13c09ce-f44b-4cbe-bdd2-c997675e57da@t5g2000yqj.googlegroups.com> |
| References | <a26063b5-7f2a-4452-898a-6fbcbaa3ed9a@j23g2000yqc.googlegroups.com> <97dcpqFdndU1@mid.individual.net> <d13c09ce-f44b-4cbe-bdd2-c997675e57da@t5g2000yqj.googlegroups.com> |
| Date | Sun, 10 Jul 2011 20:31:49 -0400 |
| X-Google-Sender-Auth | KUH6TMJ-VtIRQvxsQ9uMy8lHeY4 |
| Subject | Re: Virtual functions are virtually invisible! |
| From | Michael Hrivnak <mhrivnak@hrivnak.org> |
| To | rantingrick <rantingrick@gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.870.1310344313.1164.python-list@python.org> (permalink) |
| Lines | 92 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1310344313 news.xs4all.nl 21759 [2001:888:2000:d::a6]:34572 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:9209 |
Show key headers only | View raw
It sounds to me like you need a better IDE, better documentation, and/or better code to work on and use. I don't understand why it's difficult to look at a derived class as see what methods are overridden. If you are working on the code, it is quite obvious what methods exist in the base class. If you're not willing to get an intimate understanding of how the base class works, you probably shouldn't be working on the subclass. If the base class is difficult to understand, it's probably poorly written and/or poorly documented. Neither of these problems should be solved by adding complexity to the language. Referencing the Zen of Python: "If the implementation is hard to explain, it's a bad idea." If you are just using a library but not developing it, why does it matter what methods are overridden? As long as class "Derived" behaves the way it is documented, who cares how it got that way or what is going on behind the scenes? If you need to read the code to figure out how it works, then it's just poorly documented. Django is a great example, because it is very well documented. Most users have little idea of what base classes are involved and what features are overridden, because it doesn't matter when you are just using the library. When you need to write your own subclass of a django class, then it might matter, and you should see my first paragraph. And in terms of "non-starters", any "Pythonista" who isn't willing to adhere to the style guide and document their code wouldn't work on my team for very long, if at all. There is just no excuse for that. Michael On Sun, Jul 10, 2011 at 1:15 PM, rantingrick <rantingrick@gmail.com> wrote: > On Jul 4, 3:43 am, Gregory Ewing <greg.ew...@canterbury.ac.nz> wrote: >> rantingrick wrote: >> > what concerns me is the fact that virtual methods in derived >> > classes just blend in to the crowd. >> > I think we really need some >> > sort of visual cue in the form of forced syntactical notation (just >> > like the special method underscores). >> >> If you're suggesting that it should be impossible to override >> a method unless it is specially marked somehow in the base >> class, I think that would be a bad idea. > > Sorry i did explain properly... No NOT marked in the BASE class but > marked in the DERIVED class! My concerns are from a readability > standpoint. Here's a naive example... > > class Top(object): > def __init__(self): > pass > def m1(self): > """overide""" > return True > def m2(self): > print 'm2' > > > def Derived(Top): > def __init__(self): > Top.__init__(self) > def <overide>m1(self): > return False > > My argument is this... > > """If class "Derived" exists in another module the reader has no > idea which methods where clobbered and which were not WITHOUT being > intimate with the entire code base.""" > > I suggest we solve this dilemma by forcing a syntax "tag" when > declaring clobbering virtual functions. And if someone forgets to > include the tag python would throw an exception. This has the effect > of making the code MUCH easier to follow by the human readers. And it > put NO constraints on the API. Also it has the added effect of warning > unsuspecting programmers of name clashes that would otherwise not > produce an error. > >> One of the principles behind the design of Eiffel is that >> classes should *always* be open to modification in any way >> by a subclass. The reason is that the author of a class >> library can't anticipate all the ways people might want to >> use it. Consequently Eiffel has no equivalent of C++'s >> "private" declaration -- everything is at most "protected". >> It also has no equivalent of Java's "final". > > Exactly! We should never put limits on what methods CAN be virtual. > However, we CAN enforce a syntax that removes ambiguity from the > equation. > -- > http://mail.python.org/mailman/listinfo/python-list >
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Virtual functions are virtually invisible! rantingrick <rantingrick@gmail.com> - 2011-07-03 15:55 -0700
Re: Virtual functions are virtually invisible! Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-07-04 20:43 +1200
Re: Virtual functions are virtually invisible! rantingrick <rantingrick@gmail.com> - 2011-07-10 10:15 -0700
Re: Virtual functions are virtually invisible! Chris Angelico <rosuav@gmail.com> - 2011-07-11 03:30 +1000
Re: Virtual functions are virtually invisible! Michael Hrivnak <mhrivnak@hrivnak.org> - 2011-07-10 20:31 -0400
Re: Virtual functions are virtually invisible! rantingrick <rantingrick@gmail.com> - 2011-07-10 19:35 -0700
Re: Virtual functions are virtually invisible! Michael Hrivnak <mhrivnak@hrivnak.org> - 2011-07-11 00:45 -0400
Re: Virtual functions are virtually invisible! rantingrick <rantingrick@gmail.com> - 2011-07-11 06:42 -0700
Re: Virtual functions are virtually invisible! Chris Angelico <rosuav@gmail.com> - 2011-07-12 00:41 +1000
Re: Virtual functions are virtually invisible! rantingrick <rantingrick@gmail.com> - 2011-07-11 14:46 -0700
Re: Virtual functions are virtually invisible! Chris Angelico <rosuav@gmail.com> - 2011-07-12 18:40 +1000
Re: Virtual functions are virtually invisible! alex23 <wuwei23@gmail.com> - 2011-07-12 22:48 -0700
Re: Virtual functions are virtually invisible! Fabio Zadrozny <fabiofz@gmail.com> - 2011-07-16 19:34 -0300
Re: Virtual functions are virtually invisible! rantingrick <rantingrick@gmail.com> - 2011-07-16 15:58 -0700
Re: Re: Virtual functions are virtually invisible! Dave Angel <d@davea.name> - 2011-07-16 21:45 -0400
csiph-web