Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'override': 0.07; 'python': 0.09; 'commonly': 0.09; 'friday,': 0.09; 'terry': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'gui': 0.11; 'thread': 0.11; 'library': 0.15; 'feedback.': 0.15; 'agree.': 0.16; 'fits': 0.16; 'list)': 0.16; 'overriding': 0.16; 'overwriting': 0.16; 'personally,': 0.16; 'reedy': 0.16; 'subject:type': 0.16; 'users.': 0.16; 'wrote:': 0.17; 'variables': 0.17; 'jan': 0.18; 'code.': 0.20; 'variable': 0.20; 'suggested': 0.20; 'trying': 0.21; 'url:com)': 0.22; 'defined': 0.22; 'cc:2**0': 0.23; 'errors': 0.23; 'mention': 0.23; 'thus': 0.24; 'cc:no real name:2**0': 0.24; 'non': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'common': 0.26; 'thanks!': 0.26; '(see': 0.27; 'am,': 0.27; 'language.': 0.27; 'experiences': 0.27; 'functions.': 0.27; 'list:': 0.27; 'possible,': 0.27; 'reply.': 0.28; 'comparison': 0.29; 'context,': 0.29; 'domain.': 0.29; "i'm": 0.29; "skip:' 10": 0.30; 'fri,': 0.30; 'function': 0.30; 'aside': 0.32; 'automation': 0.33; 'function.': 0.33; 'hopefully': 0.33; 'problem': 0.33; 'hi,': 0.33; 'that,': 0.34; 'received:google.com': 0.34; 'thanks': 0.34; 'list': 0.35; 'built-in': 0.35; 'nov': 0.35; 'especially': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'michael': 0.36; 'but': 0.36; "didn't": 0.36; 'thank': 0.36; 'bad': 0.37; 'why': 0.37; 'quite': 0.37; 'received:209': 0.37; 'well.': 0.37; 'subject:: ': 0.38; 'fact': 0.38; 'several': 0.39; 'called': 0.39; 'list,': 0.39; 'subject:-': 0.40; 'think': 0.40; 'your': 0.60; 'most': 0.61; 'evaluate': 0.62; 'leaving': 0.62; 'close': 0.63; 'ever': 0.63; 'more': 0.63; 'our': 0.65; 'reply': 0.66; 'url:bit': 0.66; 'url:ly': 0.66; 'obvious': 0.71; 'goals': 0.78; 'domain,': 0.84; 'fitting': 0.84; 'horrible': 0.84; 'joel': 0.91; 'mistake': 0.91; 'novice': 0.91; 'received:209.85.213.184': 0.91; 'relate': 0.91 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=path:newsgroups:date:in-reply-to:complaints-to:injection-info :nntp-posting-host:references:user-agent:x-google-web-client :x-google-ip:mime-version:message-id:subject:from:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=XcsScmjVQOKFBHnqr/8WSfGhO/PgpgMFDzV23UrWvR8=; b=dFfK2oyf5zYVlfwwuDBaVdswc3ceIlB1uz4n8c1WmyLyQoWMKLhIHde6gKPxUKVbso 5Ms5QiLXpJUpmeockD7qqfXdGgKEJzthOzrHRtyj+GefxU3EvCgj0hc2vmJZk1DbNIi2 2/UZjfU5P/0dPwQvyOMnZYcNHaIsTXizZNMCvt3JRjOy+uzTTUx6RHRpkLQC4kR0v/kw ttY2cs9Z0PDXHIFlvBQHs0f9TpZ1cE3Cxf28S198+UR/k2D5kaWEpLgiedeNVwCyFV/k xhxr+Zu+GYGgN6UyLg1RjXJvtcjhMlwAsY7SaSzU+c0SglWHf8OISXCAks+Bxomunn20 QBHA== Newsgroups: comp.lang.python Date: Fri, 23 Nov 2012 10:41:10 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=80.109.122.186; posting-account=oknH1QoAAABqzbD_5ziFTvLQsqNk2LbU References: User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 80.109.122.186 MIME-Version: 1.0 Subject: Re: Is it bad style to override the built-in function `type`? From: Michael Herrmann To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQk2qgyMNLmEpdnWQwdjNw/io4qy8Af+XZEgmZiFQw0/RlzNCNS62iU0h7iMzSAdDCD8AvQ4 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 80 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1353696074 news.xs4all.nl 6874 [2001:888:2000:d::a6]:38720 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:33860 Thank you for your feedback. I sent the following reply to Joel but it didn= 't make it through to the mailing list:=20 Hi Joel, thanks for your reply. I can see why you think it's a bad idea. The reason = why we want to call it `type` is that this is precisely the word that is mo= st commonly used in our context, GUI automation. There are alternative name= s (see http://bit.ly/10aOy4H for a huge list) , but leaving aside the fact = that Python has an overwriteable meaning for `type`, none fits quite as wel= l. One of the main goals of our tool/API is to be as close to everyday Engl= ish as possible, and thus hopefully to be intuitive also for novice users. = For this reason it is very tempting for us to use `type`. Several people in= the original thread http://bit.ly/10aOy4H have suggested `type` because it= best fits our problem domain, and have said that they don't mind it overri= ding a built-in function. I know it's a common beginner's mistake to incautiously override built-in f= unctions. However, we put in a lot of research and have come to the conclus= ion that, if Python had not already defined it, `type` would be the best na= me. We are now trying to evaluate how bad the disadvantages you mention are= in comparison to the advantage to having a name that is more intuitive to = use in the problem domain. Can you somehow relate to my explanations, or are your experiences with ove= rwriting built-in variables so bad that you would advise to never ever do i= t? Thanks! Michael On Friday, November 23, 2012 7:36:20 PM UTC+1, Terry Reedy wrote: > On 11/23/2012 11:22 AM, Joel Goldstick wrote: >=20 > > >=20 > > >=20 > > >=20 > > On Fri, Nov 23, 2012 at 11:12 AM, Michael Herrmann >=20 > > >=20 > > wrote: >=20 > > >=20 > > Hi, >=20 > > >=20 > > do you think it's bad style to override the built-in function >=20 > > `type`? I'm co-developing a GUI automation library called Automa >=20 > > (http://www.getautoma.com) and 'type' would be a very fitting name >=20 > > for a function that generates artificial key strokes. >=20 > > >=20 > > Personally, I think this is a horrible idea. On this list and the tuto= r >=20 > > list, people often use variable names that are already defined in the >=20 > > language. It leads to non obvious errors -- especially when revisting >=20 > > old code. Why not call the thing 'key_stroke'? >=20 >=20 >=20 > I agree. >=20 >=20 >=20 > --=20 >=20 > Terry Jan Reedy