[Python-Dev] Python3 compiled listcomp can't see local var - bug or feature?

2018-06-05 Thread Rob Cliffe via Python-Dev

Is this a bug or a feature?
Consider the following program:

# TestProgram.py
def Test():
  # global x
    x = 1
    exec(compile('print([x+1,x+2])', 'MyTest', 'exec'))
    exec(compile('print([x+i for i in range(1,3)])', 'MyTest', 'exec'))
Test()

In Python 2.7.15 the output is

[2, 3]
[2, 3]

In Python 3.6.5 the output is
[2, 3]
Traceback (most recent call last):
  File "TestProgram.py", line 7, in 
    Test()
  File "TestProgram.py", line 6, in Test
    exec(compile('print([x+i for i in range(1,3)])', 'MyTest', 'exec'))
  File "MyTest", line 1, in 
  File "MyTest", line 1, in 
NameError: name 'x' is not defined

If the "global x" declaration is uncommented, this "fixes" the Python 
3.6.5 behaviour,

i.e. no error occurs and the output is the same as for Python 2.7.15.

*In other words, it looks as if in Python 3.6.5, the compiled list 
comprehension**

**can "see" a pre-existing global variable but not a local one.*

I have used dis to examine the code objects returned by compile()
(they are the same with or without the "global x"):

Python 2.7.15 first code object from 'print([x+1,x+2])':
  1   0 LOAD_NAME    0 (x)
  3 LOAD_CONST   0 (1)
  6 BINARY_ADD
  7 LOAD_NAME    0 (x)
 10 LOAD_CONST   1 (2)
 13 BINARY_ADD
 14 BUILD_LIST   2
 17 PRINT_ITEM
 18 PRINT_NEWLINE
 19 LOAD_CONST   2 (None)
 22 RETURN_VALUE
Python 2.7.15 second code object from 'print([x+i for i in range(1,3)])':
  1   0 BUILD_LIST   0
  3 LOAD_NAME    0 (range)
  6 LOAD_CONST   0 (1)
  9 LOAD_CONST   1 (3)
 12 CALL_FUNCTION    2
 15 GET_ITER
    >>   16 FOR_ITER    16 (to 35)
 19 STORE_NAME   1 (i)
 22 LOAD_NAME    2 (x)
 25 LOAD_NAME    1 (i)
 28 BINARY_ADD
 29 LIST_APPEND  2
 32 JUMP_ABSOLUTE   16
    >>   35 PRINT_ITEM
 36 PRINT_NEWLINE
 37 LOAD_CONST   2 (None)
 40 RETURN_VALUE
Python 3.6.5 first code object from 'print([x+1,x+2])':
  1   0 LOAD_NAME    0 (print)
  2 LOAD_NAME    1 (x)
  4 LOAD_CONST   0 (1)
  6 BINARY_ADD
  8 LOAD_NAME    1 (x)
 10 LOAD_CONST   1 (2)
 12 BINARY_ADD
 14 BUILD_LIST   2
 16 CALL_FUNCTION    1
 18 POP_TOP
 20 LOAD_CONST   2 (None)
 22 RETURN_VALUE
Python 3.6.5 second code object from 'print([x+i for i in range(1,3)])':
  1   0 LOAD_NAME    0 (print)
  2 LOAD_CONST   0 ( at 
0x029F79C0, file "MyTest", line 1>)

  4 LOAD_CONST   1 ('')
  6 MAKE_FUNCTION    0
  8 LOAD_NAME    1 (range)
 10 LOAD_CONST   2 (1)
 12 LOAD_CONST   3 (3)
 14 CALL_FUNCTION    2
 16 GET_ITER
 18 CALL_FUNCTION    1
 20 CALL_FUNCTION    1
 22 POP_TOP
 24 LOAD_CONST   4 (None)
 26 RETURN_VALUE

You will see that in Python 3.6.5 the dis output for the second code object
does not show the internals of the listcomp, and in particular whether,
and how, it refers to the variable 'x'.  I don't know how to investigate 
further.


Best wishes
Rob Cliffe

___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Microsoft to acquire GitHub for $7.5 b

2018-06-05 Thread Alex Walters



> -Original Message-
> From: Python-Dev  list=sdamon@python.org> On Behalf Of Ivan Pozdeev via Python-Dev
> Sent: Tuesday, June 5, 2018 10:01 PM
> To: python-dev@python.org
> Subject: Re: [Python-Dev] Microsoft to acquire GitHub for $7.5 b
> 
> On 05.06.2018 17:28, Martin Gainty wrote:
> who owns the Data hosted on Github?
> 
> Github Author?
> Microsoft?
> 
> Martin
> https://help.github.com/articles/github-terms-of-service/#d-user-
> generated-content :
> 
> "You own content you create, but you allow us certain rights to it, so
that we
> can display and share the content you post. You still have control over
your
> content, and responsibility for it, and the rights you grant us are
limited to
> those we need to provide the service. We have the right to remove content
> or close Accounts if we need to."
> 
> 
And this is not likely to change under Microsoft.  CodePlex had similar
language, as does BitBucket, GitLab, and pretty much any service that hosts
creative content that isn’t a social network (and even then, some of them do
too.)

> 
> 
> From: Python-Dev  bounces+mgainty=hotmail@python.org> on behalf of
> M.-A. Lemburg 
> Sent: Tuesday, June 5, 2018 7:54 AM
> To: Antoine Pitrou; python-dev@python.org
> Subject: Re: [Python-Dev] Microsoft to acquire GitHub for
> $7.5 billion
> 
> Something that may change is the way they treat Github
> accounts, after all, MS is very much a sales driven company.
> 
> But then there's always the possibility to move to Gitlab
> as alternative (hosted or run on PSF VMs), so I would
> worry too much.
> 
> Do note, however, that the value in Github is not so much
> with
> the products they have, but with the data. Their databases
> know more about IT developer than anyone else and given
> that Github is put under the AI umbrella in MS should tell
> us something :-)
> 
> 
> On 04.06.2018 19:02, Antoine Pitrou wrote:
> >
> > That's true, but Microsoft has a lot of stakes in the
> ecosystem.
> > For example, since it has its own CI service that it tries to
> promote
> > (VSTS), is it in Microsoft's best interest to polish and
> improve
> > integrations with other CI services?
> >
> > Regards
> >
> > Antoine.
> >
> >
> > On Mon, 4 Jun 2018 09:06:28 -0700
> > Guido van Rossum  wrote:
> >> On Mon, Jun 4, 2018 at 8:40 AM, Antoine Pitrou
>  wrote:
> >>
> >>>
> >>> On Mon, 4 Jun 2018 17:03:27 +0200
> >>> Victor Stinner  wrote:
> 
>  At this point, I have no opinion about the event :-) I just
> guess that
>  it should make GitHub more sustainable since Microsoft
> is a big
>  company with money and interest in GitHub. I'm also
> confident that
>  nothing will change soon. IMHO there is no need to
> worry about
>  anything.
> >>>
> >>> It does spell uncertainty on the long term.  While there is
> no need to
> >>> worry for now, I think it gives a different colour to the
> debate about
> >>> moving issues to Github.
> >>>
> >>
> >> I don't see how this *increases* the uncertainty. Surely if
> GitHub had
> >> remained independent there would have been be similar
> concerns about how it
> >> would make enough money to stay in business.
> >>
> >
> >
> __
> _
> > Python-Dev mailing list
> > Python-Dev@python.org
> > https://mail.python.org/mailman/listinfo/python-dev
> Python-
> Dev Info
> Page
> mail.pyth
> on.org
> Do not
> post
> general
> Python
> questions
> to this list.
> For help
> with
> Python
> please
> see the
> Python
> help
> page.. On
> this list
> the key
> Python
> developer
> s discuss
> the future
> of the
> language
> and its
> implemen
> tation.
> 
> 
> 
> > Unsubscribe:
> https://mail.python.org/mailman/options/python-
> dev/mal%40egenix.com
> >
> 
> --
> Marc-Andre Lemburg
> eGenix.com
> 
> Professional Python Services directly from the Experts (#1,
> Jun 05 2018)
> >>> Python Projects, Coaching and Consulting
> ...  http://www.egenix.com/
> >>> Python Database Interfaces
> ...   http://products.egenix.com/
> >>> Plone/Zope Database Interfaces
> ...   http://zope.egenix.com/
> __
> __
> 
> ::: We implement business ideas - efficiently in both time and
> costs :::
> 
>    eGenix.com Software, Skills and Services GmbH  Pastor-
> Loeh-Str.48
>     D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-
> Andre Lemburg
>    Registered at Amtsgericht Duesseldorf: HRB 46611
>    http://www.egenix.com/company/contact/
>   http://www.malemburg.com/
> 
> __
> _
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-
> dev/mgainty%40hotmail.com
> 
> 
> 
> __
> _
> Python-Dev mailing list
> Python-Dev@python.org
> 

Re: [Python-Dev] Unicode 11.0.0 released

2018-06-05 Thread Benjamin Peterson



On Tue, Jun 5, 2018, at 12:17, MRAB wrote:
> Unicode 11.0.0 has been released. Will Python 3.7 be updated to it, or 
> is it too late?

https://github.com/python/cpython/pull/7439 will update 3.8. Generally, we've 
considered updating the Unicode database to be a feature and not backported 
updates to bugfix branches. Thus, tradition would seem to exclude Unicode 
11.0.0 from landing so late in 3.7's release cycle. That said, the update is 
highly unlikely to break anything. It's up to Ned.
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Microsoft to acquire GitHub for $7.5 b

2018-06-05 Thread Ivan Pozdeev via Python-Dev

On 05.06.2018 17:28, Martin Gainty wrote:


who owns the Data hosted on Github?

Github Author?
Microsoft?


Martin
https://help.github.com/articles/github-terms-of-service/#d-user-generated-content 
:


"/You own content you create, but you allow us certain rights to it, so 
that we can display and share the content you post. You still have 
control over your content, and responsibility for it, and the rights you 
grant us are limited to those we need to provide the service. We have 
the right to remove content or close Accounts if we need to."/





*From:* Python-Dev  
on behalf of M.-A. Lemburg 

*Sent:* Tuesday, June 5, 2018 7:54 AM
*To:* Antoine Pitrou; python-dev@python.org
*Subject:* Re: [Python-Dev] Microsoft to acquire GitHub for $7.5 billion
Something that may change is the way they treat Github
accounts, after all, MS is very much a sales driven company.

But then there's always the possibility to move to Gitlab
as alternative (hosted or run on PSF VMs), so I would
worry too much.

Do note, however, that the value in Github is not so much with
the products they have, but with the data. Their databases
know more about IT developer than anyone else and given
that Github is put under the AI umbrella in MS should tell
us something :-)


On 04.06.2018 19:02, Antoine Pitrou wrote:
>
> That's true, but Microsoft has a lot of stakes in the ecosystem.
> For example, since it has its own CI service that it tries to promote
> (VSTS), is it in Microsoft's best interest to polish and improve
> integrations with other CI services?
>
> Regards
>
> Antoine.
>
>
> On Mon, 4 Jun 2018 09:06:28 -0700
> Guido van Rossum  wrote:
>> On Mon, Jun 4, 2018 at 8:40 AM, Antoine Pitrou 
 wrote:

>>
>>>
>>> On Mon, 4 Jun 2018 17:03:27 +0200
>>> Victor Stinner  wrote:

 At this point, I have no opinion about the event :-) I just guess 
that

 it should make GitHub more sustainable since Microsoft is a big
 company with money and interest in GitHub. I'm also confident that
 nothing will change soon. IMHO there is no need to worry about
 anything.
>>>
>>> It does spell uncertainty on the long term.  While there is no need to
>>> worry for now, I think it gives a different colour to the debate about
>>> moving issues to Github.
>>>
>>
>> I don't see how this *increases* the uncertainty. Surely if GitHub had
>> remained independent there would have been be similar concerns 
about how it

>> would make enough money to stay in business.
>>
>
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev 


Python-Dev Info Page 
mail.python.org
Do not post general Python questions to this list. For help with 
Python please see the Python help page.. On this list the key Python 
developers discuss the future of the language and its implementation.




> Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/mal%40egenix.com

>

--
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, Jun 05 2018)
>>> Python Projects, Coaching and Consulting ... 
http://www.egenix.com/ 
>>> Python Database Interfaces ... http://products.egenix.com/ 

>>> Plone/Zope Database Interfaces ... http://zope.egenix.com/ 




::: We implement business ideas - efficiently in both time and costs :::

   eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
http://www.egenix.com/company/contact/ 


http://www.malemburg.com/ 

___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/mgainty%40hotmail.com



___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/vano%40mail.mipt.ru


--
Regards,
Ivan

___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Microsoft to acquire GitHub for $7.5 b

2018-06-05 Thread Martin Gainty
who owns the Data hosted on Github?

Github Author?
Microsoft?


Martin
__





From: Python-Dev  on behalf 
of M.-A. Lemburg 
Sent: Tuesday, June 5, 2018 7:54 AM
To: Antoine Pitrou; python-dev@python.org
Subject: Re: [Python-Dev] Microsoft to acquire GitHub for $7.5 billion

Something that may change is the way they treat Github
accounts, after all, MS is very much a sales driven company.

But then there's always the possibility to move to Gitlab
as alternative (hosted or run on PSF VMs), so I would
worry too much.

Do note, however, that the value in Github is not so much with
the products they have, but with the data. Their databases
know more about IT developer than anyone else and given
that Github is put under the AI umbrella in MS should tell
us something :-)


On 04.06.2018 19:02, Antoine Pitrou wrote:
>
> That's true, but Microsoft has a lot of stakes in the ecosystem.
> For example, since it has its own CI service that it tries to promote
> (VSTS), is it in Microsoft's best interest to polish and improve
> integrations with other CI services?
>
> Regards
>
> Antoine.
>
>
> On Mon, 4 Jun 2018 09:06:28 -0700
> Guido van Rossum  wrote:
>> On Mon, Jun 4, 2018 at 8:40 AM, Antoine Pitrou  wrote:
>>
>>>
>>> On Mon, 4 Jun 2018 17:03:27 +0200
>>> Victor Stinner  wrote:

 At this point, I have no opinion about the event :-) I just guess that
 it should make GitHub more sustainable since Microsoft is a big
 company with money and interest in GitHub. I'm also confident that
 nothing will change soon. IMHO there is no need to worry about
 anything.
>>>
>>> It does spell uncertainty on the long term.  While there is no need to
>>> worry for now, I think it gives a different colour to the debate about
>>> moving issues to Github.
>>>
>>
>> I don't see how this *increases* the uncertainty. Surely if GitHub had
>> remained independent there would have been be similar concerns about how it
>> would make enough money to stay in business.
>>
>
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
Python-Dev Info Page
mail.python.org
Do not post general Python questions to this list. For help with Python please 
see the Python help page.. On this list the key Python developers discuss the 
future of the language and its implementation.



> Unsubscribe: 
> https://mail.python.org/mailman/options/python-dev/mal%40egenix.com
>

--
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, Jun 05 2018)
>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>> Python Database Interfaces ...   http://products.egenix.com/
>>> Plone/Zope Database Interfaces ...   http://zope.egenix.com/


::: We implement business ideas - efficiently in both time and costs :::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/
  http://www.malemburg.com/

___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/mgainty%40hotmail.com
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Unicode 11.0.0 released

2018-06-05 Thread MRAB
Unicode 11.0.0 has been released. Will Python 3.7 be updated to it, or 
is it too late?

___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Stable ABI

2018-06-05 Thread Brett Cannon
I know Kushal set up ABI testing for Fedora and has brought up taking the
work he did for that and bringing it over to CPython, but I also know he is
offline for personal reasons ATM and won't be able to to reply for a little
while.

On Mon, 4 Jun 2018 at 08:06 Eric Snow  wrote:

> I've pointed out in bpo-21142 the similar script I added last year to
> track C globals:
>
>   https://github.com/python/cpython/tree/master/Tools/c-globals
>
> -eric
>
> On Mon, Jun 4, 2018 at 1:17 AM, Ronald Oussoren 
> wrote:
> >
> >
> > On 4 Jun 2018, at 08:35, Ronald Oussoren  wrote:
> >
> >
> >
> > On 3 Jun 2018, at 17:04, Eric V. Smith  wrote:
> >
> > On 6/3/2018 10:55 AM, Christian Tismer wrote:
> >
> > On 03.06.18 13:18, Ronald Oussoren wrote:
> >
> >
> >
> > On 3 Jun 2018, at 12:03, Christian Tismer  wrote:
> >
> > ...
> >
> >
> > I have written a script that scans all relevant header files
> > and analyses all sections which are reachable in the limited API
> > context.
> > All macros that don't begin with an underscore which contain
> > a "->tp_" string are the locations which will break.
> >
> > I found exactly 7 locations where this is the case.
> >
> > My PR will contain the 7 fixes plus the analysis script
> > to go into tools. Preparind that in the evening.
> >
> >
> > Having tests would still be nice to detect changes to the stable ABI when
> > they are made.
> >
> > Writing those tests is quite some work though, especially if those at
> least
> > smoke test the limited ABI by compiling snippets the use all symbols that
> > should be exposed by the limited ABI. Writing those tests should be
> fairly
> > simple for someone that knows how to write C extensions, but is some
> work.
> >
> > Writing a tests that complain when the headers expose symbols that
> shouldn’t
> > be exposed is harder, due to the need to parse headers (either by hacking
> > something together using regular expressions, or by using tools like
> gccxml
> > or clang’s C API).
> >
> > What do you mean?
> > My script does that with all "tp_*" type fields.
> > What else would you want to check?
> >
> >
> > I think Ronald is saying we're trying to answer a few questions:
> >
> > 1. Did we accidentally drop anything from the stable ABI?
> >
> > 2. Did we add anything to the stable ABI that we didn't mean to?
> >
> > 3. (and one of mine): Does the stable ABI already contain things that we
> > don't expect it to?
> >
> >
> > That’s correct.  There have been instances of the second item over the
> year,
> > and not all of them have been caught before releases.  What doesn’t help
> for
> > all of these is that the stable ABI documentation says that every
> documented
> > symbol is part of the stable ABI unless there’s explicit documentation to
> > the contrary. This makes researching if functions are intended to be
> part of
> > the stable ABI harder.
> >
> > And also:
> >
> > 4. Does the stable ABI actually work?
> >
> > Christian’s script finds cases where exposed names don’t actually work
> when
> > you try to use them.
> >
> >
> > To reply to myself, the gist below is a very crude version of what I was
> > trying to suggest:
> >
> >
> https://gist.github.com/ronaldoussoren/fe4f80351a7ee72c245025df7b2ef1ed#file-gistfile1-txt
> >
> > The gist is far from usable, but shows some tests that check that
> symbols in
> > the stable ABI can be used, and tests that everything exported in the
> stable
> > ABI is actually tested.
> >
> > Again, the code in the gist is a crude hack and I have currently no
> plans to
> > turn this into something that could be added to the testsuite.
> >
> > Ronald
> >
> > ___
> > Python-Dev mailing list
> > Python-Dev@python.org
> > https://mail.python.org/mailman/listinfo/python-dev
> > Unsubscribe:
> >
> https://mail.python.org/mailman/options/python-dev/ericsnowcurrently%40gmail.com
> >
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/brett%40python.org
>
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Microsoft to acquire GitHub for $7.5 billion

2018-06-05 Thread Nick Coghlan
On 5 June 2018 at 23:10, Matěj Cepl  wrote:

> On 2018-06-04, 23:38 GMT, Steven D'Aprano wrote:
> > No, but Guido is right: neither is anyone else.
> >
> > In that regard, Microsoft is probably *more* likely to keep pumping
> > money into a failing business if it gives them a strategic advantage,
> > compared to other investors with no long-term strategy other than "get
> > aquired by Google/Microsoft/Oracle/Apple".
>
> Let me just to say here, that gitlab.com has export of
> repository together with all metadata. Just saying.
>

I was actually looking into this recently to see if the repository import
feature could be used to run a regularly updated repository mirror that
included all issues and PR comments in addition to the code, and noticed
that one of the things that GitLab really requires to create a high quality
export is for folks to have linked their GitLab instance accounts with
their GitHub ones - if you don't already have that account mapping in
place, then the import currently loses the ability to link users correctly
with their comments and commits (We have a partial mapping due to folks
adding their account names to bugs.python.org for CLA signing purposes, but
not in a form that GitLab could actually use, since they need the API
access authorisation).

That said, I personally don't think this changes much about our
relationship with GitHub, except for the fact that we're now dealing with a
large publicly traded multinational with relatively transparent financial
reports rather than a smallish privately held company that was only
financially accountable to the venture capitalists backing it. I'm more
confident in my ability to predict Microsoft's business incentives based on
the prevailing technology landscape than I am in my ability to predict the
actions of a VC firm like Andreesen Horowitz :)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Docstrings on builtins

2018-06-05 Thread Ivan Pozdeev via Python-Dev

On 05.06.2018 17:56, Chris Barker wrote:

OK,

looking a bit deeper:

In [69]: timedelta.__new__.__doc__
Out[69]: 'Create and return a new object.  See help(type) for accurate 
signature.'


In [70]: timedelta.__init__.__doc__
Out[70]: 'Initialize self.  See help(type(self)) for accurate signature.'

In [71]: timedelta.__doc__
Out[71]: 'Difference between two datetime values.'

So the none of the docstrings have the proper information. And:

help(timedelta) returns:

Help on class timedelta in module datetime:

class timedelta(builtins.object)
 |  Difference between two datetime values.
 |
 |  Methods defined here:
 |
 |  __abs__(self, /)
 |  abs(self)
 |
 |  __add__(self, value, /)
 |  Return self+value.


So no signature either.

I'm guessing this is because argument clinic has not been properly 
applied -- so Ihave a PR to work on.


but where does help() get its info anyway?

I always thought docstrings were supposed to be used for the basic, 
well, docs. And between the class and __new__ and __init__, somewhere 
in there you should learn how to initialize an instance, yes?



In [5]: print(str.__doc__)
str(object='') -> str
str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or
errors is specified <...>

As you can see, the start of the type's docstring contains constructor 
signature(s).


Timedelta's one should probably do the same.


-CHB





On Mon, Jun 4, 2018 at 6:21 PM, Matthias Bussonnier 
mailto:bussonniermatth...@gmail.com>> 
wrote:




On Mon, 4 Jun 2018 at 17:29, Ivan Pozdeev via Python-Dev
mailto:python-dev@python.org>> wrote:

On 05.06.2018 3:09, Matthias Bussonnier wrote:

This may even be a bug/feature of IPython,

I see that inspect.signature(timedelta) fails, so if
timedelta? says
Init signature: timedelta(self, /, *args, **kwargs)
Then this may be some IPython internal logic. The timedelta
class seem to use __new__ instead of __init__ (not sure why)


Because it's an immutable type.

Ah, yes, thanks.


and __new__ have a meaningful signature,
So maybe we should fallback on that during signature inspection.


According to

https://stackoverflow.com/questions/4374006/check-for-mutability-in-python


,
there are no reliable tests for mutability.

Sure, but we can test if the signature of __init__ is (self,/,
*args, **kwargs), and if it is,  it is useless we can attempt to
get the signature from __new__ and show that instead.  We do
similar things for docstrings, if __init__ have no docstring we
look at the class level docstring.
-- 
M



___
Python-Dev mailing list
Python-Dev@python.org 
https://mail.python.org/mailman/listinfo/python-dev

Unsubscribe:
https://mail.python.org/mailman/options/python-dev/chris.barker%40noaa.gov





--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

chris.bar...@noaa.gov 


--
Regards,
Ivan

___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Docstrings on builtins

2018-06-05 Thread Chris Barker via Python-Dev
OK,

looking a bit deeper:

In [69]: timedelta.__new__.__doc__
Out[69]: 'Create and return a new object.  See help(type) for accurate
signature.'

In [70]: timedelta.__init__.__doc__
Out[70]: 'Initialize self.  See help(type(self)) for accurate signature.'

In [71]: timedelta.__doc__
Out[71]: 'Difference between two datetime values.'

So the none of the docstrings have the proper information.  And:

help(timedelta) returns:

Help on class timedelta in module datetime:

class timedelta(builtins.object)
 |  Difference between two datetime values.
 |
 |  Methods defined here:
 |
 |  __abs__(self, /)
 |  abs(self)
 |
 |  __add__(self, value, /)
 |  Return self+value.


So no signature either.

I'm guessing this is because argument clinic has not been properly applied
-- so Ihave a PR to work on.

but where does help() get its info anyway?

I always thought docstrings were supposed to be used for the basic, well,
docs. And between the class and __new__ and __init__, somewhere in there
you should learn how to initialize an instance, yes?

-CHB





On Mon, Jun 4, 2018 at 6:21 PM, Matthias Bussonnier <
bussonniermatth...@gmail.com> wrote:

>
>
> On Mon, 4 Jun 2018 at 17:29, Ivan Pozdeev via Python-Dev <
> python-dev@python.org> wrote:
>
>> On 05.06.2018 3:09, Matthias Bussonnier wrote:
>>
>> This may even be a bug/feature of IPython,
>>
>> I see that inspect.signature(timedelta) fails, so if  timedelta? says
>> Init signature: timedelta(self, /, *args, **kwargs)
>> Then this may be some IPython internal logic. The timedelta class seem to
>> use __new__ instead of __init__ (not sure why)
>>
>> Because it's an immutable type.
>>
> Ah, yes, thanks.
>
>
>> and __new__ have a meaningful signature,
>> So maybe we should fallback on that during signature inspection.
>>
>> According to https://stackoverflow.com/questions/4374006/check-for-
>> mutability-in-python ,
>> there are no reliable tests for mutability.
>>
> Sure, but we can test if the signature of __init__ is (self,/, *args,
> **kwargs), and if it is,  it is useless we can attempt to get the signature
> from __new__ and show that instead.  We do similar things for docstrings,
> if __init__ have no docstring we look at the class level docstring.
> --
> M
>
>
>
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> chris.barker%40noaa.gov
>
>


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Microsoft to acquire GitHub for $7.5 billion

2018-06-05 Thread Miro Hrončok

On 5.6.2018 15:10, Matěj Cepl wrote:

On 2018-06-04, 23:38 GMT, Steven D'Aprano wrote:

No, but Guido is right: neither is anyone else.

In that regard, Microsoft is probably *more* likely to keep pumping
money into a failing business if it gives them a strategic advantage,
compared to other investors with no long-term strategy other than "get
aquired by Google/Microsoft/Oracle/Apple".


Let me just to say here, that gitlab.com has export of
repository together with all metadata. Just saying.


GitHub has: 
https://developer.github.com/changes/2018-05-24-user-migration-api/ but 
I'm not sure what exactly is there.


--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Microsoft to acquire GitHub for $7.5 billion

2018-06-05 Thread Matěj Cepl
On 2018-06-04, 23:38 GMT, Steven D'Aprano wrote:
> No, but Guido is right: neither is anyone else.
>
> In that regard, Microsoft is probably *more* likely to keep pumping 
> money into a failing business if it gives them a strategic advantage, 
> compared to other investors with no long-term strategy other than "get 
> aquired by Google/Microsoft/Oracle/Apple".

Let me just to say here, that gitlab.com has export of 
repository together with all metadata. Just saying.

Matěj
-- 
https://matej.ceplovi.cz/blog/, Jabber: mc...@ceplovi.cz
GPG Finger: 3C76 A027 CA45 AD70 98B5  BC1D 7920 5802 880B C9D8
 
Oh, to be young, and to feel love’s keen sting.
  -- Albus Dumbledore

___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Microsoft to acquire GitHub for $7.5 billion

2018-06-05 Thread M.-A. Lemburg
Something that may change is the way they treat Github
accounts, after all, MS is very much a sales driven company.

But then there's always the possibility to move to Gitlab
as alternative (hosted or run on PSF VMs), so I would
worry too much.

Do note, however, that the value in Github is not so much with
the products they have, but with the data. Their databases
know more about IT developer than anyone else and given
that Github is put under the AI umbrella in MS should tell
us something :-)


On 04.06.2018 19:02, Antoine Pitrou wrote:
> 
> That's true, but Microsoft has a lot of stakes in the ecosystem.
> For example, since it has its own CI service that it tries to promote
> (VSTS), is it in Microsoft's best interest to polish and improve
> integrations with other CI services?
> 
> Regards
> 
> Antoine.
> 
> 
> On Mon, 4 Jun 2018 09:06:28 -0700
> Guido van Rossum  wrote:
>> On Mon, Jun 4, 2018 at 8:40 AM, Antoine Pitrou  wrote:
>>
>>>
>>> On Mon, 4 Jun 2018 17:03:27 +0200
>>> Victor Stinner  wrote:  

 At this point, I have no opinion about the event :-) I just guess that
 it should make GitHub more sustainable since Microsoft is a big
 company with money and interest in GitHub. I'm also confident that
 nothing will change soon. IMHO there is no need to worry about
 anything.  
>>>
>>> It does spell uncertainty on the long term.  While there is no need to
>>> worry for now, I think it gives a different colour to the debate about
>>> moving issues to Github.
>>>  
>>
>> I don't see how this *increases* the uncertainty. Surely if GitHub had
>> remained independent there would have been be similar concerns about how it
>> would make enough money to stay in business.
>>
> 
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> https://mail.python.org/mailman/options/python-dev/mal%40egenix.com
> 

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, Jun 05 2018)
>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>> Python Database Interfaces ...   http://products.egenix.com/
>>> Plone/Zope Database Interfaces ...   http://zope.egenix.com/


::: We implement business ideas - efficiently in both time and costs :::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/
  http://www.malemburg.com/

___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Withdraw PEP 546? Backport ssl.MemoryBIO and ssl.SSLObject to Python 2.7

2018-06-05 Thread Victor Stinner
So sorry for Python 2.7, I just rejected my PEP 546, no ssl.MemoryBIO for you!
https://www.python.org/dev/peps/pep-0546/#rejection-notice

The workaround is to use PyOpenSSL on Python 2.7.

Victor

2018-05-30 16:28 GMT+02:00 Victor Stinner :
> Hi,
>
> tl; dr I will withdraw the PEP 546 in one week if noboy shows up to
> finish the implementation.
>
>
> Last year,I wrote the PEP 546 with Cory Benfield:
> "Backport ssl.MemoryBIO and ssl.SSLObject to Python 2.7"
> https://www.python.org/dev/peps/pep-0546/
>
> The plan was to get a Python 2.7 implementation of Cory's PEP 543:
> "A Unified TLS API for Python"
> https://www.python.org/dev/peps/pep-0543/
>
> Sadly, it seems like Cory is no longer available to work on the projec
> (PEP 543 is still a draft)t.
>
> The PEP 546 is implemented:
> https://github.com/python/cpython/pull/2133
>
> Well, I closed it, but you can still get it as a patch with:
> https://patch-diff.githubusercontent.com/raw/python/cpython/pull/2133.patch
>
> But tests fail on Travis CI whereas I'm unable to reproduce the issue
> on my laptop (on Fedora). The failure seems to depend on the version
> of OpenSSL. Christian Heimes has a "multissl" tool which automates
> tests on multiple OpenSSL versions, but I failed to find time to try
> this tool.
>
> Time flies and one year later, the PR of the PEP 546 is still not
> merged, tests are still failing.
>
> One month ago, when 2.7.15 has been released, Benjamin Peterson,
> Python 2.7 release manager, simply proposed:
> "The lack of movement for a year makes me wonder if PEP 546 should be
> moved to Withdrawn status."
>
> Since again, I failed to find time to look at the test_ssl failure, I
> plan to withdraw the PEP next week if nobody shows up :-( Sorry Python
> 2.7!
>
> Does anyone would benefit of MemoryBIO in Python 2.7? Twisted,
> asyncio, trio, urllib3, anyone else? If yes, who is volunteer to
> finish the MemoryBIO backport (and maintain it)?
>
> Victor
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com