Re: [Python-Dev] One-line abstractmethod function?

2013-12-05 Thread Gregory Salvan
Hi, maybe a syntax like that can correspond: class MyObject(metaclass=ObjectSpec): ''' MyObject doc''' 'attr1 contains something' attr1 = None 'attr2 contains something' attr2 = str 'method1 do something' method1 = NotImplementedMethod('self', 'arg1', kwarg1=str) Meta

Re: [Python-Dev] One-line abstractmethod function?

2013-12-05 Thread Guido van Rossum
On Thu, Dec 5, 2013 at 6:31 PM, Ethan Furman wrote: >> On Thu, Dec 05, 2013 at 01:33:00PM -0800, Guido van Rossum wrote: >>> Actually if you want to support multiple inheritance of your ABC, your >>> abstract methods *must* be no-ops (or have some kind of default >>> behavior that can always be do

Re: [Python-Dev] One-line abstractmethod function?

2013-12-05 Thread Guido van Rossum
On Thu, Dec 5, 2013 at 6:08 PM, Allen Li wrote: > On Thu, Dec 05, 2013 at 01:33:00PM -0800, Guido van Rossum wrote: >> > The only two alternatives are doing nothing/pass/return >> > None or having actual code in the method. >> > >> > The former is only useful to silently ignore blind super() calli

Re: [Python-Dev] One-line abstractmethod function?

2013-12-05 Thread Ethan Furman
On 12/05/2013 06:08 PM, Allen Li wrote: On Thu, Dec 05, 2013 at 01:33:00PM -0800, Guido van Rossum wrote: Actually if you want to support multiple inheritance of your ABC, your abstract methods *must* be no-ops (or have some kind of default behavior that can always be done last). Done last or

Re: [Python-Dev] Python 3 is five years old

2013-12-05 Thread Stephen J. Turnbull
Tim Peters writes: > I'm doing all my own coding in 3 now - I like it. I just wish someone > had told me in 2008 ;-) I think it's a testament to the basic strength of the language that you haven't noticed that *nothing has changed* in Python 2 for several years. ;-) __

Re: [Python-Dev] One-line abstractmethod function?

2013-12-05 Thread Allen Li
On Thu, Dec 05, 2013 at 01:33:00PM -0800, Guido van Rossum wrote: > > The only two alternatives are doing nothing/pass/return > > None or having actual code in the method. > > > > The former is only useful to silently ignore blind super() calling, the > > latter you would define and decorate the me

Re: [Python-Dev] Python 3 is five years old

2013-12-05 Thread Tim Peters
[Brett] > On 2008-12-03, Python 3.0.0 was released by Barry. Dang - nobody ever tells me anything. Congratulations! It's about time 3.0.0 was released ;-) > ... > Thanks to those in the community who stuck by the dev team and had faith > we knew what we were doing and have continued to help eve

Re: [Python-Dev] Python-Dev Digest, Vol 125, Issue 5

2013-12-05 Thread Fil Mackay
Hi Antoine, > I've found that libffi does support this type, but sadly ctypes and cffi > do > > not. Adding to ctypes does not seem to be trivial, since the description > of > > an integer type is limited to a single character ("q" in the case of long > > long). "q" is considered to be a length of

Re: [Python-Dev] One-line abstractmethod function?

2013-12-05 Thread Ethan Furman
On 12/05/2013 10:20 AM, Allen Li wrote: 90% of the time, it ends up looking something like this: class Foo(metaclass=abc.ABCMeta): @abc.abstractmethod def f1(self): raise NotImplementedError @staticmethod @abc.abstractmethod def f2(arg1): raise NotIm

Re: [Python-Dev] One-line abstractmethod function?

2013-12-05 Thread Guido van Rossum
On Thu, Dec 5, 2013 at 1:12 PM, Allen Li wrote: > On Thu, Dec 05, 2013 at 10:24:11AM -0800, Guido van Rossum wrote: >> How would you get the docstrings in? It seems cramming that much on a >> single line doesn't help readability (even though I agree there is a >> fair amount of boilerplace). > > I

Re: [Python-Dev] test_bind_port and test_find_unused_port fail due to missing SO_REUSEPORT when building Python 3.3.2-r2 (from portage) on 3.7.10-gentoo-r1 kernel

2013-12-05 Thread Reuben Garrett
On Tue, Dec 3, 2013 at 9:44 AM, Guido van Rossum wrote: > Thanks for reporting this. With pleasure! I'm just glad to have reported a valid bug for once in my life :b > This really belongs in the Python issue tracker (bugs.python.org) -- can you submit a bug there? I've opened issue # 19901 [1]

Re: [Python-Dev] One-line abstractmethod function?

2013-12-05 Thread Ethan Furman
On 12/05/2013 12:39 PM, MRAB wrote: On 05/12/2013 19:22, Ethan Furman wrote: On 12/05/2013 10:56 AM, Alexander Belopolsky wrote: On Thu, Dec 5, 2013 at 1:24 PM, Guido van Rossum wrote: How would you get the docstrings in? [...] One way to reduce the amount of boilerplate code is to make abs

Re: [Python-Dev] One-line abstractmethod function?

2013-12-05 Thread Alexander Belopolsky
On Thu, Dec 5, 2013 at 3:06 PM, Brett Cannon wrote: > How will abstractmethod know its function has no body? >> > > Technically you could inspect the code object of the method. to figure out > if the body is empty. > One way if to check f.__code__.co_lnotab - it will be empty when f has no body.

Re: [Python-Dev] One-line abstractmethod function?

2013-12-05 Thread Allen Li
On Thu, Dec 05, 2013 at 10:24:11AM -0800, Guido van Rossum wrote: > How would you get the docstrings in? It seems cramming that much on a > single line doesn't help readability (even though I agree there is a > fair amount of boilerplace). I was basing my initial suggestion somewhat on collections

Re: [Python-Dev] One-line abstractmethod function?

2013-12-05 Thread MRAB
On 05/12/2013 19:22, Ethan Furman wrote: On 12/05/2013 10:56 AM, Alexander Belopolsky wrote: On Thu, Dec 5, 2013 at 1:24 PM, Guido van Rossum wrote: How would you get the docstrings in? [...] One way to reduce the amount of boilerplate code is to make abstractmethod to supply raise NotImplem

Re: [Python-Dev] One-line abstractmethod function?

2013-12-05 Thread Brett Cannon
On Thu, Dec 5, 2013 at 2:22 PM, Ethan Furman wrote: > On 12/05/2013 10:56 AM, Alexander Belopolsky wrote: > >> On Thu, Dec 5, 2013 at 1:24 PM, Guido van Rossum wrote: >> >>> >>> How would you get the docstrings in? [...] >>> >> >> One way to reduce the amount of boilerplate code is to make abstra

Re: [Python-Dev] One-line abstractmethod function?

2013-12-05 Thread Ethan Furman
On 12/05/2013 10:56 AM, Alexander Belopolsky wrote: On Thu, Dec 5, 2013 at 1:24 PM, Guido van Rossum wrote: How would you get the docstrings in? [...] One way to reduce the amount of boilerplate code is to make abstractmethod to supply raise NotImplementedError body when none is given. Then

Re: [Python-Dev] One-line abstractmethod function?

2013-12-05 Thread Alexander Belopolsky
On Thu, Dec 5, 2013 at 1:24 PM, Guido van Rossum wrote: > How would you get the docstrings in? It seems cramming that much on a > single line doesn't help readability (even though I agree there is a > fair amount of boilerplace). > One way to reduce the amount of boilerplate code is to make abst

Re: [Python-Dev] One-line abstractmethod function?

2013-12-05 Thread Guido van Rossum
How would you get the docstrings in? It seems cramming that much on a single line doesn't help readability (even though I agree there is a fair amount of boilerplace). On Thu, Dec 5, 2013 at 10:20 AM, Allen Li wrote: > Hello Python devs, > > As a regular Python user, I find the abc module useful

[Python-Dev] One-line abstractmethod function?

2013-12-05 Thread Allen Li
Hello Python devs, As a regular Python user, I find the abc module useful for making Python's duck typing more explicit. In particular, I ofen use it like a Java interface or C header, to provide methods to implement for a given "duck type". 90% of the time, it ends up looking something like thi

Re: [Python-Dev] Running the unit test as root/administrator

2013-12-05 Thread Martin v. Löwis
Am 05.12.13 16:31, schrieb Chris Angelico: >> Ah. I don't think we have one. If somebody would want to donate one, I >> suggest to run it in a VM, to reduce the (valid) security concerns that >> Guido has voiced. If a snapshot of the VM is made, it would be easy to >> restore in case a commit perfo

Re: [Python-Dev] Running the unit test as root/administrator

2013-12-05 Thread Vajrasky Kok
On Thu, Dec 5, 2013 at 11:06 PM, "Martin v. Löwis" wrote: > > Can you please phrase your question more explicit? What is it that > you want to be done before writing unit tests for the spwd module? I am asking buildbot of Linux/Unix/BSD with root account. Do we have it now? > > Anybody could run

Re: [Python-Dev] Running the unit test as root/administrator

2013-12-05 Thread Chris Angelico
On Fri, Dec 6, 2013 at 2:29 AM, "Martin v. Löwis" wrote: > Am 05.12.13 16:21, schrieb Vajrasky Kok: >> On Thu, Dec 5, 2013 at 11:06 PM, "Martin v. Löwis" >> wrote: >>> >>> Can you please phrase your question more explicit? What is it that >>> you want to be done before writing unit tests for the

Re: [Python-Dev] Running the unit test as root/administrator

2013-12-05 Thread Martin v. Löwis
Am 05.12.13 16:21, schrieb Vajrasky Kok: > On Thu, Dec 5, 2013 at 11:06 PM, "Martin v. Löwis" wrote: >> >> Can you please phrase your question more explicit? What is it that >> you want to be done before writing unit tests for the spwd module? > > I am asking buildbot of Linux/Unix/BSD with root

Re: [Python-Dev] Running the unit test as root/administrator

2013-12-05 Thread Martin v. Löwis
Am 05.12.13 02:04, schrieb Vajrasky Kok: > Cool. What about Linux/Unix/BSD with root account? If we have > something similar, I may plan to write unit test for spwd module. Can you please phrase your question more explicit? What is it that you want to be done before writing unit tests for the spwd

Re: [Python-Dev] 128 bit integer support

2013-12-05 Thread Meador Inge
On Wed, Dec 4, 2013 at 8:15 AM, Antoine Pitrou wrote: Aren't you talking about the struct module? In ctypes, it seems it > would be sufficient to add a "c_int128" type (and/or "c_uint128"). Even in ctypes these codes are used internally for the field descriptors. For ctypes "c_int128" seems rea