Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: How well do you know Python? Date: Tue, 5 Jul 2016 14:02:36 +1000 Lines: 22 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de Lsz9zkLDCKugA8ZGzdERRgP8MbNtKuXH9Quw2gSVbDDg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.05; 'subject:How': 0.09; '__future__': 0.09; 'absent': 0.09; 'craft': 0.09; 'operator,': 0.09; 'valueerror': 0.09; 'python': 0.10; 'assume': 0.11; 'exception': 0.13; '2.7?': 0.16; '3.0,': 0.16; 'anyhow,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'reinstated': 0.16; 'string': 0.17; 'programmer': 0.18; 'to:name :python-list@python.org': 0.20; '3.x': 0.22; 'tried': 0.24; 'import': 0.24; 'discussion': 0.24; 'message-id:@mail.gmail.com': 0.27; 'operators': 0.29; 'rails': 0.29; 'stated.': 0.29; "i'd": 0.31; 'core': 0.32; 'class': 0.33; 'received:google.com': 0.35; 'but': 0.36; '(and': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'difference': 0.38; 'does': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'some': 0.40; 'questions': 0.40; 'future': 0.60; 'provide': 0.61; 'more': 0.63; 'different': 0.63; 'between': 0.65; 'chrisa': 0.84; 'subject:you': 0.85; 'subject:know': 0.91; 'tricky': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=wbxE3alNEdFQXcwQ2y/7QIApWSdNBTmkZik4a5Tsm/c=; b=XJB4nq1E46X0N30myMpulMZF4hPg+p15vuO4EKIkmMbyEqxs21S77n5p4wOcabiPQn QK7l8lMyM/RVjiietCt510znxGbAiqAw0WDEhPrfKt+SSTPC0HfUR4DtMmy0zpYVj9Yr w/6WosRmbDPa4EKWQHwzo3gmeJ3DYxAjjLGad+1BWtrqFV0Vm0kIwF4GpspGiZUo0sCC 2XAziCrm/IC5af7tjaqkWopu8NWE+g4vTAhFhGAuGLyuL71cQUNe7Hb2NUoMgXAjYT4f 5xTmCTLWuxB5DW2kQUhN3l36heYRfQayo6ihcNx0OBJNegy+t1iQrBCnq3v0CUxC+s8A eAoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=wbxE3alNEdFQXcwQ2y/7QIApWSdNBTmkZik4a5Tsm/c=; b=NaVclxYAPkVyqDDt2DAEvhHLxs/LvVGvqZ/GSTQPqiXOv8N016KkKnn11OtOfeGvov Pgt/qsye8nEkRob+66Fi37BCMNPfB70XdN0w0nhJJXeewJomR3mWvm50SU7keZvJDpey fRnEWN91VTepx4OhTYCvBgOoPqPoiCLdug4qt54cthSIvOHjADpXv6dGhdRJeytweR+V FLbxmVU3pFbCUa0Lbn/wPyi9zLv+neqlq4Arz6/BybR985NDny29Jdg1YP5afXud981c BE40KpQTVYTXEw/4K7znYbyfMccUmPqsOedlwi9lZJqLmGVKrNt66YjFV8GFfvNAjaVA tHyA== X-Gm-Message-State: ALyK8tKna1yeJE1dePR9Ktj6I/FlNc8Yh89Ap3oLCZyMTzN/zVzbKCCNNupIHGCIs9zXZlh43V5Q+jemJ7ycIg== X-Received: by 10.28.41.195 with SMTP id p186mr13890713wmp.41.1467691357224; Mon, 04 Jul 2016 21:02:37 -0700 (PDT) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: Xref: csiph.com comp.lang.python:111095 After some discussion with a Ruby on Rails programmer about where Ruby ends and where Rails begins (and it's definitely not where I'd have expected... Rails does a ton of monkey-patching, including of built-in types, to provide functionality that is strangely absent from the core language), I tried to come up with some somewhat-challenging Python questions. But to make them hard, I had to go a smidge more esoteric than the Ruby questions did.... Anyhow, see how you go. Assume Python 3.x unless stated. 1) Under what circumstances can str.upper() return a string of different length to its input? 2) What exception do you get when you craft an impossible class hierarchy? a. ValueError b. TypeError c. types.ClassInheritanceError d. SyntaxError 3) What does `from __future__ import braces` do? 4) Which operator, removed from Python 3.0, can be reinstated with a 'joke' future directive? 5) What is the difference between the `/` and `//` operators in Python 2.7? In Python 3.x? Got any other tricky questions to add? ChrisA