[Python-ideas] Re: python interpreter docker builder

2020-04-07 Thread M.-A. Lemburg
Hi Antonio, you may want to have a look at the Alpine images for Python and this optimized variant: https://github.com/jfloff/alpine-python They also come with dev tools installed. Still, they are overall rather clunky to ship around. On the plus side, you can layer images in docker, so that app

[Python-ideas] Re: python interpreter docker builder

2020-04-07 Thread João Santos
On Tuesday, 7 April 2020 10:52:36 CEST M.-A. Lemburg wrote: > Hi Antonio, > > you may want to have a look at the Alpine images for Python > and this optimized variant: > > https://github.com/jfloff/alpine-python > > They also come with dev tools installed. Still, they are overall > rather clunky

[Python-ideas] Re: Improvement: __json__

2020-04-07 Thread Tin Tvrtković
As the author of one of these third-party libraries, I feel like I can contribute to this discussion. It can indeed be done very elegantly with type annotations, and it should for sure be left to the ecosystem. The only things we need from core Python are good tools for dealing with run-time type

[Python-ideas] Re: Improvement: __json__

2020-04-07 Thread Wes Turner
Would you generate a schema from the type annotations so that other languages can use the data? JSON is really not the most efficient data representation for round-tripping to and from Python. A binary format (or pickle without arbitrary code execution) would solve for Python object > file > Pytho

[Python-ideas] Re: Improvement: __json__

2020-04-07 Thread Christopher Barker
On Mon, Apr 6, 2020 at 9:17 PM Greg Ewing wrote: > > > Something similar could be done in Python using type annotations. > sure can -- I've done this wrapping dataclasses -- each object in the hierarchy knows how to serialize/deserialize itself from JSON -- so there JSON can be totally standard.

[Python-ideas] Re: Improvement: __json__

2020-04-07 Thread Christopher Barker
On Tue, Apr 7, 2020 at 11:17 AM Wes Turner wrote: > Would you generate a schema from the type annotations so that other > languages can use the data? > I haven't done this yet, but it would be pretty cool. > So, IMHO type annotations are not insufficient and thus redundant and not elegant. you

[Python-ideas] Re: Improvement: __json__

2020-04-07 Thread Andrew Barnert via Python-ideas
On Apr 7, 2020, at 15:31, Christopher Barker wrote: >  >> On Tue, Apr 7, 2020 at 11:17 AM Wes Turner wrote: > >> Would you generate a schema from the type annotations so that other >> languages can use the data? > > I haven't done this yet, but it would be pretty cool. This seems like one of

[Python-ideas] "except BaseException with f as result"

2020-04-07 Thread Soni L.
the fact that exception handlers aren't reusable and composable is really bothering me so I would like to propose something to make them reusable and composable. for example, if I have this mess:     def get_property_values(self, prop):     try:     factory = self.get_supported_pro

[Python-ideas] Re: Improvement: __json__

2020-04-07 Thread Wes Turner
*That* should read as "are not sufficient". Stuffing all of those into annotations is going to be cumbersome; resulting in there being multiple schema definitions to keep synchronized and validate data according to. I think generating some amalgamation of JSONLD @context & SHACL and JSON schema w

[Python-ideas] Re: "except BaseException with f as result"

2020-04-07 Thread Soni L.
On 2020-04-07 10:12 p.m., Soni L. wrote: the fact that exception handlers aren't reusable and composable is really bothering me so I would like to propose something to make them reusable and composable. for example, if I have this mess:     def get_property_values(self, prop):     try:

[Python-ideas] Re: "except BaseException with f as result"

2020-04-07 Thread Greg Ewing
On 8/04/20 1:14 pm, Soni L. wrote:     def get_property_values(self, prop):     try:     factory = self.get_supported_properties()[prop]     except KeyError with keyerror_handler;     iterator = factory(self._obj)     try:     first = next(iterator)   

[Python-ideas] "except BaseException with f as result"

2020-04-07 Thread Stephen J. Turnbull
Soni L. writes: > the fact that exception handlers aren't reusable and composable is > really bothering me so I would like to propose something to make them > reusable and composable. > > for example, if I have this mess: Looks nice and flat and orderly to me; the semantics are messy, so

[Python-ideas] "except BaseException with f as result"

2020-04-07 Thread Stephen J. Turnbull
BTW, although obviously I don't like the idea much, I think except BaseException as result with f: reads better than the original suggestion: except BaseException with f as result: in the event this idea gets some takeup. Steve ___ Python-id

[Python-ideas] Re: "except BaseException with f as result"

2020-04-07 Thread Andrew Barnert via Python-ideas
On Apr 7, 2020, at 22:58, Stephen J. Turnbull wrote: > > BTW, although obviously I don't like the idea much, I think > >except BaseException as result with f: > > reads better than the original suggestion: > >except BaseException with f as result: > > in the event this idea gets som