Re: [Python-Dev] Unbound methods (was: Sorting)

2017-04-06 Thread Oleg Broytman
Hi!

On Thu, Apr 06, 2017 at 12:24:47PM +1000, Steven D'Aprano  
wrote:
> On Thu, Apr 06, 2017 at 02:30:06AM +0200, Oleg Broytman wrote:
> 
> > I spent few days hunting
> > for a subtle bug caused by absent of unbound methods.
> >Painful. :-(
> 
> I'm curious about this. What do you mean? Python 3 has unbound methods, 
> they're just the original, unwrapped function:
> 
> py> class K:
> ... def method(self, arg):
> ... pass
> ...
> py> K.method
> 

   I know.

> The only(?) functional difference between unbound methods in Python 2 
> versus 3 is that in Python 2 they automatically do a type-check that 
> `self` is an instance of the class.

   The check was involved, yes. The bug I was hunting manifested itself
in PY3 with exceptions hinting that instead of `self` I've passed
`self.__class__`. In PY2 everything worked fine.
   I found the problem in dynamically created methods. Someone
implemented them this way:

if PY2:
def createMethod(func, cls):
return types.MethodType(func, None, cls)
else:
def createMethod(func, cls):
return types.MethodType(func, None)

   Hard to spot at the first glance what was the problem. Finally I grok
the problem and fixed the implementation for PY3 to

def createMethod(func, cls):
return func

> -- 
> Steve

Oleg.
-- 
 Oleg Broytmanhttp://phdru.name/[email protected]
   Programmers don't die, they just GOSUB without RETURN.
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Wider Call For Participation for the 2017 Python Language Summit

2017-04-06 Thread Larry Hastings


The 2017 Python Language Summit is coming!

The Python Language Summit is an annual day-long meeting of CPython core 
developers.  It’s a highly technical meeting, designed to explore and 
resolve existing discussions regarding the Python programming language, 
the development of its reference implementation CPython, and the impact 
of the language’s evolution on the existing alternative 
implementations.  It’s a once-a-year opportunity for Python’s core 
development team to get together in a room and work things out.


The meeting is kept small on purpose, as we think that maximizes its 
productivity and effectiveness.  Nearly all attendees are CPython core 
developers, but we do accept presentations from anyone in the greater 
Python community who has something interesting to say to the core 
developers.  And that could be you!


In order to be eligible, you must be able to attend the Summit in 
person.  The Summit will be held May 17 2017, all day, in the same 
convention center where PyCon itself is held.  You have to get there 
yourself; we literally have no discretionary budget to help people 
attend the Summit.  However, you don’t have to buy a ticket to PyCon in 
order to attend the summit--it’s a completely separate event, and it’s free!


But mere eligibility is not enough.  The presentations are carefully 
hand-picked by the Language Summit organizers, and must be exceedingly 
relevant and of high quality in order to be considered.  The Summit only 
comes once a year, and we the organizers want to keep it interesting and 
maximally productive for the developers who are kind enough to attend.  
To be brutally honest, we expect most proposals from non-core-developers 
will be turned down--again, sorry.


PyCon is large, diverse, welcoming, and vibrant, and there are lots of 
great avenues (e.g. lightning talks, BoFs, open spaces, etc.) for 
discussing Python-related topics.  If your proposed talk isn't accepted 
for the Language Summit, we highly encourage you to explore these other 
options.



Here are the criteria you should keep in mind if you submit a presentation:

 * Is this a question about the *design* of Python?  Or, to a lesser
   extent, the implementation of CPython or one of the alternative
   implementations?  The Summit is about Python itself--we don’t
   discuss other projects.
 * Is this a *technical* debate?  The Python universe is large and
   diverse, but the Summit is explicitly a highly technical meeting,
   and a deeper technical context on the part of participants is essential.
 * Is this topic going to spark conversation?  A good rule of thumb:
   your presentation should raise questions, not provide answers.  If
   your topic could be adequately covered in a blog post, it’s probably
   not interactive enough.
 * Is this already an ongoing discussion in the Python development
   community?  As a rule the Language Summit is not a venue for new
   business--it’s for working through existing technical debates.
 * Is this topic going to be interesting to a lot of people? While it
   doesn’t have to be universally interesting, it can’t be too narrow
   either.  As a rule, most people in the room should be interested.
 * Is this a topic that’s still considered "open" by the core
   developers?  There’s no point in proposing a talk saying "you should
   abandon Python 3 and go back to 2", or even "you should make a
   Python 2.8".  From the perspective of the core developers, these are
   resolved, closed issues.


Examples of interesting topics:

 * Python’s new async syntax is flawed, here’s why
 * The design of CPython’s extension API makes it difficult to do what
   we want it to do
 * My patch for CPython makes it ten times faster for common workloads
 * I’m engaged in a lively and long-lived discussion on python-dev and
   I want to bring it up with the core devs in person, so that a
   resolution can be found


Examples of irrelevant / uninteresting / ineligible topics:

 * A useful Python library you want people to know about
 * A new language feature you want to propose
 * There’s a bug in CPython you want to raise awareness about
 * The Python community needs to...


The process for submitting a talk proposal is exactly the same as for 
core developers: fill out the Google form with your contact information, 
your affiliation, and a summary of your proposal. The form is reachable 
via the Language Summit page under the PyCon events menu:


   https://us.pycon.org/2017/events/language-summit/

Since this wider call for proposals comes so late in the process, we’re 
extending the deadline for submissions.  The deadline is now Thursday, 
April 20th, 2017, two weeks from today.  If your submission is accepted, 
we will notify you by May 1st.


Finally, even if you don’t get to attend, stay tuned to Linux Weekly 
News (LWN) in the days and weeks following the Language Summit.  Jake 
Edge from LWN has done a fantastic job of reporting on the Language 
Summit the previous t