Re: [Python-Dev] Postponed annotations break inspection of dataclasses

2018-09-23 Thread David Hagen
On Sat, Sep 22, 2018 at 3:11 PM Guido van Rossum  wrote:
> Still, I wonder if there's a tweak possible of the globals and locals
used when exec()'ing the function definitions in dataclasses.py, so that
get_type_hints() gets the right globals for this use case.

On Sat, Sep 22, 2018 at 4:38 PM Yury Selivanov 
wrote:
> If it's possible to fix exec() to accept any Mapping (not just dicts),
> then we can create a proxy mapping for "Dataclass.__init__.__module__"
> module and everything would work as expected.

Another possible solution is that `__annotations__` are *permitted* to be
lambdas, but not created as such by default, and `get_type_hints` is aware
of this. Operations that are known to break type hints (such as when data
classes copy the type hints from the class body to the `__init__` method)
could covert the type hint from a string to a lambda before moving it. It
does not even have to be a lambda; an instance of some `TypeHint` class,
which stores the string and pointers to the original `globals` and `locals`
(or just the original object whose `globals` and `locals` are relevant),
but that's essentially what a lambda is anyway.
___
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


Re: [Python-Dev] Postponed annotations break inspection of dataclasses

2018-09-23 Thread David Hagen
On Sat, Sep 22, 2018 at 12:41 PM Guido van Rossum 
wrote:
> Probably a bugs.python.org issue is a better place to dive into the
details than python-dev.

Issue tracker issue created: https://bugs.python.org/issue34776
___
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] (no subject)

2018-09-23 Thread R Alshammrei
--

في 8 سبتمبر ، 2017 في تمام الساعة 12:30 بعد منتصف الليل ، سيقوم
Masayuki YAMAMOTO
< ma3yuki.8mamo10 at gmail.com
 > كتب:
> *مرحبا يا قوم،
* > > *I إرسال PEP 539 المسودة الثالثة للالنهاية. شكرا لجميع النصائح
* > *والمساعدة!
*
شكرا لك إريك وياماموتو سان لجميع عملك على هذا PEP!
تبدو التحديثات جيدة ، لذلك يسعدني أن أقول إن BDFL-Delegate ذلك
الاقتراح مقبول الآن :)
مع تحياتي،
نيك.
-
نيك كوغلان   ncoghlan في gmail.com
| بريسبان،
أستراليا

--


   - Previous message (by thread): [Python-Dev] PEP 539 v3: A C new API for
   Thread-Local Storage in CPython
   
   - الرسالة التالية (بواسطة مؤشر الترابط): [Python-Dev] PEP 539 v3: واجهة
   برمجة تطبيقات C جديدة للتخزين المحلي الخيطي في CPython
   
   - *تم فرز الرسائل حسب: *[date]
   

   [thread]
   

   [subject]
   

   [author]
   


--
مزيد من المعلومات حول القائمة البريدية لـ Python-Dev

___
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


Re: [Python-Dev] Official citation for Python

2018-09-23 Thread Jacqueline Kazil
I wanted to send an update.
At the NumFocus Summit, I found out about...
This: https://www.force11.org/group/software-citation-working-group
& this: https://github.com/adrn/CitationPEP

I am going to work on a citation approach based off of those two sources
and come back with a more developed proposal.

-Jackie

On Mon, Sep 17, 2018 at 1:12 PM MRAB  wrote:

> On 2018-09-17 05:05, Jeremy Hylton wrote:
> >
> > I wanted to start with an easy answer that is surely unsatisfying:
> >
> http://blog.apastyle.org/apastyle/2015/01/how-to-cite-software-in-apa-style.html
> >
> > APA style is pretty popular, and it says that standard software doesn't
> > need to be specified. Standard software includes "Microsoft Word, Java,
> > and Adobe Photoshop." So I'd say Python fits well in that category, and
> > doesn't need to be cited.
> >
> > I said you wouldn't be satisfied...
> >
> It goes on to say """Note: We don’t keep a comprehensive list of what
> programs are “standard.” You make the call.""".
>
> [snip]
> ___
> Python-Dev mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/jackiekazil%40gmail.com
>


-- 
Jacqueline Kazil | @jackiekazil
___
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


Re: [Python-Dev] Postponed annotations break inspection of dataclasses

2018-09-23 Thread Raymond Hettinger



> On Sep 22, 2018, at 1:38 PM, Yury Selivanov  wrote:
> 
> On Sat, Sep 22, 2018 at 3:11 PM Guido van Rossum  wrote:
> [..]
>> Still, I wonder if there's a tweak possible of the globals and locals used 
>> when exec()'ing the function definitions in dataclasses.py, so that 
>> get_type_hints() gets the right globals for this use case.
>> 
>> It's really tough to be at the intersection of three PEPs...
> 
> If it's possible to fix exec() to accept any Mapping (not just dicts),
> then we can create a proxy mapping for "Dataclass.__init__.__module__"
> module and everything would work as expected

FWIW, the locals() dict for exec() already accepts any mapping (not just dicts):

>>> class M:
def __getitem__(self, key):
return key.upper()
def __setitem__(self, key, value):
print(f'{key!r}: {value!r}')

>>> exec('a=b', globals(), M())
'a': 'B'


Raymond
___
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