Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!news2.euro.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'argument': 0.04; 'languages,': 0.04; 'subject:Python': 0.05; 'say,': 0.05; 'expressions': 0.07; 'function,': 0.07; 'true)': 0.07; 'variables.': 0.07; 'python': 0.09; '(instead': 0.09; 'ambiguity': 0.09; 'behavior,': 0.09; 'cc:addr:googlegroups.com': 0.09; 'decision.': 0.09; 'declarations': 0.09; 'differing': 0.09; 'exist.': 0.09; 'libraries.': 0.09; 'notation': 0.09; 'pointless': 0.09; 'cc:addr:python-list': 0.10; 'language,': 0.11; 'language': 0.14; 'java,': 0.15; 'languages.': 0.15; '"def"': 0.16; '"elif"': 0.16; '(meaning': 0.16; '*before*': 0.16; '*expression*': 0.16; 'bugs.': 0.16; 'cc:name:python list': 0.16; 'conditional': 0.16; 'cryptic': 0.16; 'doubly': 0.16; 'example)': 0.16; 'expend': 0.16; 'observations': 0.16; 'obsessed': 0.16; 'one)': 0.16; 'passed.': 0.16; 'places.': 0.16; 'suite.': 0.16; 'undesirable.': 0.16; 'wrote:': 0.17; 'alternate': 0.17; 'variables': 0.17; 'appropriate': 0.20; 'mostly': 0.20; 'parameters': 0.20; 'libraries': 0.22; 'work.': 0.23; "python's": 0.23; 'statement': 0.23; 'seems': 0.23; 'cc:no real name:2**0': 0.24; 'idea': 0.24; 'cc:2**1': 0.24; 'least': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'creating': 0.26; 'values': 0.26; 'continuing': 0.27; 'language.': 0.27; '(as': 0.27; 'c++': 0.27; 'have,': 0.27; 'important.': 0.27; 'is?': 0.27; 'message- id:@mail.gmail.com': 0.27; 'received:209.85.212': 0.28; 'existence': 0.29; 'statements': 0.29; 'way?': 0.29; 'this.': 0.29; "i'm": 0.29; 'that.': 0.30; 'keyword': 0.30; 'basic': 0.30; 'function': 0.30; 'good.': 0.32; 'not.': 0.32; 'getting': 0.33; 'says': 0.33; 'impression': 0.33; 'true.': 0.33; 'anyone': 0.33; 'everyone': 0.33; 'languages': 0.33; 'skip:d 20': 0.34; 'version': 0.34; 'received:google.com': 0.34; 'thanks': 0.34; 'whatever': 0.35; 'exist': 0.35; 'false': 0.35; 'otherwise.': 0.35; 'open': 0.35; 'sometimes': 0.35; 'continue': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'there': 0.35; 'add': 0.36; 'really': 0.36; 'created': 0.36; 'except': 0.36; 'but': 0.36; 'useful': 0.36; 'test': 0.36; 'should': 0.36; 'too': 0.36; 'does': 0.37; 'why': 0.37; 'passed': 0.37; 'rather': 0.37; 'received:209': 0.37; 'far': 0.37; 'well.': 0.37; 'subject:: ': 0.38; 'fact': 0.38; 'mean': 0.38; 'object': 0.38; 'some': 0.38; 'time,': 0.62; 'genuine': 0.62; 'between': 0.63; 'skip:n 10': 0.63; 'more': 0.63; 'here': 0.65; 'legal': 0.65; 'offer': 0.65; 'learned': 0.65; 'forward': 0.66; 'today': 0.67; 'benefit': 0.70; 'friendly': 0.71; 'money': 0.74; 'reviewed': 0.74; 'interest.': 0.78; '2013': 0.84; 'appreciating': 0.84; 'designed,': 0.84; 'oscar': 0.84; 'toy': 0.84; 'careful': 0.91; 'dare': 0.93; 'serious': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=i4Mv5qItVJOSXjIHJkIXqxn7+CHtR38zsV8CDCWUYRM=; b=Mlrd5QBiQTBvhCf2kqp5nBcTYav6r/JhaIyAm66Jy1GIK/Yz91o0ElgnoTl1nLYS7Z 21K6EVjGQFcr2iVGpYt/+X5M+knG82+7VfFk/N+uD5v8BeFOzLhPE7HogvtYJgpEaCvv +qdk4LuzKrzN8RfyfsZlQRTLwEFOmADoMd4eTFiiLWl7VoKDlE31VfgboWxjv4zazSkq noysW1KwqKTEavpZPO/qDjFpBTQ7qlTYyba3xQ9mi8tU92HQhyC44i1+mS/dHKEvgAi1 BJlhMapg98kQ/AVd9QeWgCvcLOF8VBkuTXKfB/dRkgb3WtSdVvFDwvBSsi9zuHz4POr2 +oGA== X-Received: by 10.58.144.133 with SMTP id sm5mr757425veb.23.1361570900528; Fri, 22 Feb 2013 14:08:20 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <928d2cf7-728b-4f35-b8c9-4c9b958507e5@googlegroups.com> References: <5127848B.1060004@gmail.com> <928d2cf7-728b-4f35-b8c9-4c9b958507e5@googlegroups.com> From: Oscar Benjamin Date: Fri, 22 Feb 2013 22:08:00 +0000 Subject: Re: Python Newbie To: piterrr.dolinski@gmail.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Python List , comp.lang.python@googlegroups.com 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: , Newsgroups: comp.lang.python Message-ID: Lines: 95 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1361570904 news.xs4all.nl 6903 [2001:888:2000:d::a6]:59254 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:39618 On 22 February 2013 21:37, wrote: > Thanks to everyone for all the posts, some friendly some not. I read all = of them with genuine interest. > > So I am continuing to learn Python, here are my new observations for your= consideration. > > There seems to be a "heated" argument about Python's apparently intention= al ambiguity in conditional statements. Specifically, the issue is, is it m= ore appropriate to write (as an example) > > if (some statement): # short form That should be some *expression* rather than some *statement*. Some languages allow all statements to be expressions but Python does not. > > rather than > > if (some statement =3D=3D true): # long form There is no heated argument about whether to do this. The long form is pointless except perhaps in a test suite. > > Some 50(?) years ago, C was designed so that everything other than 0 eval= uated to true and was false otherwise. Fast forward to recent memory, when = C# was designed, Microsoft claims they reviewed all the features of C, C++ = and Java, pulled the best features from each of these languages and designe= d a new language that would help minimize the potential for planting bugs. I'm sure that they, like most people designing/developing languages, did try to take the best features from other languages. Python does as well. > Say what you want about MS inventions, but my experience is that to requi= re the long form notation was a good decision. For me the fact that the sho= rt notation is legal in Python is a stepback in language design. Python inv= entors, when creating what is after all considered a contemporary language,= should have known better. Call me psychopath if you will (have seen this i= n one post), but I shall continue to use the aforementioned long form as I = always have, and no Python is going to change that. If you want to be really careful you can use (feel free to add more bracket= s): if (((condition =3D=3D True) =3D=3D True)): Then you can be doubly sure it's true. > > > Today I learned the hard way that all function parameters in Python are p= assed by reference (meaning whatever happens to them inside a function, new= values are always passed to caller). Not good. I got caught up on this. To= combat the mostly unwanted behavior, inside a function I have to reassign = variables intended to be local to new variables. A pain. Can anyone offer O= NE reason why Python was designed that way? New values are not passed. The same object is accessed in both places. Sometimes this is useful and sometimes it is undesirable. The important thing is to learn how to use the features of a language to do what you want (instead of moaning about them for differing from some other language). > > Out of curiosity, does anyone have any idea why function declarations are= preceded by the keyword "def" rather than something more intuitive like "f= unction" or at least "func", perhaps? > > Does anyone know what the benefit of writing the cryptic "elif" to mean "= else if" is? Curiously, the default statement in an if/else chain is preced= ed by "else" and not "el". > > Someone said I am too narrow-sited appreciating C# and not open to altern= ate approaches to language design. Well if that someone says "def" is bette= r than "function" and "elif" is better than "else if", then dare I say, you= are obsessed with Python! These things are just not that important. Every language has keywords that need to be learned. Would you prefer the C version "void f()"? > > So far I am getting the impression that Python is a toy language of some = kind (similar to Basic of the early 80's), not really suitable for serious = work. The only difference between these languages (admittedly, a serious on= e) is the existence of extensive libraries. Otherwise there would be no goo= d reason for Python to exist. Nevertheless, it does exist and I have to lea= rn it. As long as someone is paying for my time, that's OK with me. Those extensive libraries would not have been created for a toy language. Python had to have a reason to exist *before* people would expend that much time, money and energy on it. Oscar