Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Michael Foord: State of the Pythons (Keynote)

Michael Foord: State of the Pythons (Keynote)

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Michael Foord:
State of the Pythons
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
@ Kiwi PyCon 2013 - Saturday, 07 Sep 2013 - Keynote
http://nz.pycon.org/

**YouTube**

http://www.youtube.com/watch?v=IWB_pQacuw4

New Zealand Python User Group

September 07, 2013
Tweet

More Decks by New Zealand Python User Group

Other Decks in Programming

Transcript

  1. Python and Pythons Michael Foord [email protected] www.voidspace.org.uk @voidspace

  2. One Python many snakes

  3. How to become a Python core developer (and why you

    probably don't want to) Why you might want to become a core developer: • Fame • Fortune • Sweet speaking gigs in New Zealand
  4. Seriously though • Contributing to a major open source project

    is good on your CV • It's a great experience to be involved in collaborative world-wide development • You get to give back to Python • You get to help make the future • People use your code - you're building something people use
  5. But The flames, the flames it hurts! At least we're

    not as bad as Linux
  6. The deluge Discussion on the enum module ran to thousands

    of emails
  7. The Implementations • CPython • IronPython • Jython • PyPy

    • and lesser known relatives...
  8. Who cares? open(some_file, 'w').write('foo') initial = '' for fragment in

    some_horribly_large_data_set: initial += fragment
  9. Sea Python

  10. CPython • The reference implementation • Statistically almost certainly what

    you use • Python 2.7 most widely used version • Python 3.4 alpha 1 is now out • Python 3 is a nicer language than Python 2 and it keeps getting better
  11. In Action

  12. IronPython • Still on Python 2.7 • Python 2.7.4 release

    due shortly • Some partial Python 3 compatibility • No GIL!
  13. Yay Java

  14. Jython • Jython 2.7 is at beta • also a

    small team hindering development • After 2.7 comes Python 3 support • No GIL!
  15. PyPy • The most exciting Python implementation • Arm support

    (including Raspberry Pi) • Python 3 now in beta! • Software transactional memory! • Numpypy! • Has a GIL
  16. Python 3(.4)

  17. The PEPs • PEP 435: the "enum" module • PEP

    442: improved semantics for object finalization • PEP 443: single-dispatch generic functions • PEP 445: Configurable memory allocators • PEP 446: Make newly created file descriptors non-inheritable • PEP 447: add type.__locallookup__ • PEP 448: additional unpacking generalizations
  18. It's Complicated • PEP 446: Make newly created file descriptors

    non-inheritable. • PEP 447: add type.__locallookup__ (dynamic behaviour for metaclasses) • PEP 442: improved semantics for object finalization
  19. Not a big deal but nice anyway • PEP 443:

    single-dispatch generic functions • PEP 445: Configurable memory allocators
  20. PEP 435: Enums >>> from enum import Enum >>> class

    Color(Enum): ... red = 1 ... green = 2 ... blue = 3 >>> Animal = Enum('Animal', 'ant bee cat dog')
  21. PEP 448: additional unpacking >>> print(*[1], *[2], 3) 1 2

    3 >>> *range(4), 4 (0, 1, 2, 3, 4) # Flattening generator expression g = (*x for x in iterables)
  22. Subtests class NumbersTest(unittest.TestCase): def test_even(self): for i in range(0, 6):

    with self.subTest(i=i): self.assertEqual(i % 2, 0) ====================================================================== FAIL: test_even (__main__.NumbersTest) (i=1) ---------------------------------------------------------------------- Traceback (most recent call last): File "subtests.py", line 32, in test_even self.assertEqual(i % 2, 0) AssertionError: 1 != 0
  23. Still to come • PEP 436: The Argument Clinic DSL

    • PEP 450: Adding A Statistics Module To The Standard Library • PEP 451: A ModuleSpec Type for the Import System • PEP 452: API for Cryptographic Hash Functions v2 • PEP 453: Explicit bootstrapping of pip in Python • Tulip?
  24. Stuff that's already here • Python 2.8 - PEP 404

  25. Interesting optimisations • New GIL • Flexible string representation (PEP

    393) • Key sharing dictionary (PEP 412) • yield from (PEP 380) • A C implementation of decimal
  26. Major frickin changes • Death to .pyc files (sort of)

    • Death to __init__.py files (sort of) • virtualenv built-in to Python (sort of) • All exceptions changed! (sort of) • Python launcher for Windows (PEP 397)
  27. New modules • faulthandler • unittest.mock • ipaddress • lzma

  28. Minor details • contextlib.ExitStack • types.SimpleNamespace • list.copy() • __qualname__

  29. ExitStack with ExitStack() as stack: for resource in resources: stack.enter_context(resource)

  30. SimpleNamespace >>> from types import SimpleNamespace >>> thing = SimpleNamespace(first=1,

    second=2) >>> thing.first 1 >>> thing.second 2
  31. __qualname__ >>> class Foo(object): ... def bar(self): pass ... >>>

    Foo.bar.__qualname__ 'Foo.bar' >>> Foo.bar.__module__ '__main__'
  32. Packaging changes • disutils2 is dead • setuptools / distribute

    merge back • CDN for PyPI replacing mirrors • wheels! (binary installer format) • PEP 426: metadata for packages • bundling get-pip
  33. Other stuff • Diversity! • PSF changes • Proliferation of

    PyCons • Openstack!
  34. So where next? Major changes in computing that Python hasn't

    really adapted to: • mobile • multiple processors • async
  35. Sponsor my parachute jump!! • www.justgiving.com/michaelfoord