Re: Bitstream -- Binary Data for Humans

2018-03-06 Thread Sébastien Boisgérault
Le mardi 6 mars 2018 00:29:25 UTC+1, Roel Schroeven a écrit : > Sébastien Boisgérault schreef op 5/03/2018 20:05: > > I have released bitstream, a Python library to manage binary data (at the > > byte or bit level), > > hopefully without the pain that this kind of thing usually entails :) > > >

Do not promote `None` as the first argument to `filter` in documentation.

2018-03-06 Thread Kirill Balunov
This thought occurred to me several times, but I could not decide to write. And since `filter` is a builtin, I think this change should be discussed here, before opening an issue on bug tracker. I propose to delete all references in the `filter` documentation that the first argument can be `None`,

Re: Bitstream -- Binary Data for Humans (Posting On Python-List Prohibited)

2018-03-06 Thread Sébastien Boisgérault
Hi Lawrence, Le mardi 6 mars 2018 01:20:36 UTC+1, Lawrence D’Oliveiro a écrit : > On Tuesday, March 6, 2018 at 8:06:00 AM UTC+13, Sébastien Boisgérault wrote: > > I have released bitstream, a Python library to manage binary data > > (at the byte or bit level), hopefully without the pain that this

Re: Ways to make a free variable local to a function?

2018-03-06 Thread Kirill Balunov
2018-03-05 17:34 GMT+03:00 Chris Angelico : > In theory, the CPython bytecode compiler (don't know about other > Python implementations) could just add these as constants. They'd then > be bound at either compile time or function definition time (by > default the former, I think, but the latter wo

Re: Bitstream -- Binary Data for Humans

2018-03-06 Thread Sébastien Boisgérault
Le mardi 6 mars 2018 09:26:50 UTC+1, Sébastien Boisgérault a écrit : > Le mardi 6 mars 2018 00:29:25 UTC+1, Roel Schroeven a écrit : > > Sébastien Boisgérault schreef op 5/03/2018 20:05: > > > I have released bitstream, a Python library to manage binary data (at the > > > byte or bit level), > >

Re: Ways to make a free variable local to a function?

2018-03-06 Thread Wolfgang Maier
On 03/05/2018 07:44 PM, Terry Reedy wrote: On 3/5/2018 9:34 AM, Chris Angelico wrote: On Tue, Mar 6, 2018 at 12:52 AM, Terry Reedy wrote: On 3/5/2018 7:12 AM, Kirill Balunov wrote: # 1. By passing through local variable's default values def func_local_1(numb, _int = int, _float = floa

Re: Bitstream -- Binary Data for Humans (Posting On Python-List Prohibited)

2018-03-06 Thread Sébastien Boisgérault
Le mardi 6 mars 2018 10:23:02 UTC+1, Lawrence D’Oliveiro a écrit : > On Tuesday, March 6, 2018 at 9:59:55 PM UTC+13, Sébastien Boisgérault wrote: > > > > Le mardi 6 mars 2018 01:20:36 UTC+1, Lawrence D’Oliveiro a écrit : > > > >> On Tuesday, March 6, 2018 at 8:06:00 AM UTC+13, Sébastien Boisgéraul

Re: Ways to make a free variable local to a function?

2018-03-06 Thread Kirill Balunov
2018-03-05 21:44 GMT+03:00 Terry Reedy : > Yes, what we really want for this sort of thing are unrebindable local > constants. A simple syntax change could do it. > > def func_local_1(numb; int = int, float = float, range = range): > > The binding after ';' belong in the header because they sho

Re: Ways to make a free variable local to a function?

2018-03-06 Thread Chris Angelico
On Tue, Mar 6, 2018 at 8:02 PM, Kirill Balunov wrote: > > > 2018-03-05 17:34 GMT+03:00 Chris Angelico : >> >> In theory, the CPython bytecode compiler (don't know about other >> Python implementations) could just add these as constants. They'd then >> be bound at either compile time or function de

Re: Bitstream -- Binary Data for Humans (Posting On Python-List Prohibited)

2018-03-06 Thread Terry Reedy
On 3/6/2018 3:58 AM, Sébastien Boisgérault wrote: Hi Lawrence, Le mardi 6 mars 2018 01:20:36 UTC+1, Lawrence D’Oliveiro a écrit : On Tuesday, March 6, 2018 at 8:06:00 AM UTC+13, Sébastien Boisgérault wrote: I have released bitstream, a Python library to manage binary data (at the byte or bit l

Re: Do not promote `None` as the first argument to `filter` in documentation.

2018-03-06 Thread Chris Angelico
On Tue, Mar 6, 2018 at 7:52 PM, Kirill Balunov wrote: > This thought occurred to me several times, but I could not decide to write. > And since `filter` is a builtin, I think this change should be discussed > here, before opening an issue on bug tracker. > > I propose to delete all references in t

Re: Bitstream -- Binary Data for Humans (Posting On Python-List Prohibited)

2018-03-06 Thread Sébastien Boisgérault
Le mardi 6 mars 2018 11:15:15 UTC+1, Terry Reedy a écrit : > On 3/6/2018 3:58 AM, Sébastien Boisgérault wrote: > > Hi Lawrence, > > > > Le mardi 6 mars 2018 01:20:36 UTC+1, Lawrence D’Oliveiro a écrit : > >> On Tuesday, March 6, 2018 at 8:06:00 AM UTC+13, Sébastien Boisgérault > >> wrote: > >>> I

Re: Do not promote `None` as the first argument to `filter` in documentation.

2018-03-06 Thread Steven D'Aprano
On Tue, 06 Mar 2018 11:52:22 +0300, Kirill Balunov wrote: > I propose to delete all references in the `filter` documentation that > the first argument can be `None`, with possible depreciation of `None` > as the the first argument - FutureWarning in Python 3.8+ and deleting > this option in Python

Re: Do not promote `None` as the first argument to `filter` in documentation.

2018-03-06 Thread Kirill Balunov
2018-03-06 14:17 GMT+03:00 Steven D'Aprano < [email protected]>: > On Tue, 06 Mar 2018 11:52:22 +0300, Kirill Balunov wrote: > > > I propose to delete all references in the `filter` documentation that > > the first argument can be `None`, with possible depreciation of `None` > >

Re: Do not promote `None` as the first argument to `filter` in documentation.

2018-03-06 Thread Kirill Balunov
2018-03-06 13:18 GMT+03:00 Chris Angelico : > The identity function is: > > filter(lambda x: x, range(10)) > > How is it consistent with truthiness? Exactly the same way the > underlying object is. There's no requirement for the predicate > function to return True or False - it's perfectly accepta

Re: Do not promote `None` as the first argument to `filter` in documentation.

2018-03-06 Thread Chris Green
Kirill Balunov wrote: > > As I wrote, __possible depreciation__, I also do not see the point of just It's 'deprecation', depreciation is something quite different. People replying have spelt it correctly so you might possibly have noticed I thought/hoped. ... and it does matter a bit because i

Re: Do not promote `None` as the first argument to `filter` in documentation.

2018-03-06 Thread Chris Angelico
On Wed, Mar 7, 2018 at 12:23 AM, Kirill Balunov wrote: > Filter is generally faster than list comprehension or generators. > > %timeit [*filter(lambda x: x % 3, range(1000))] > 100 µs ± 16.4 ns per loop (mean ± std. dev. of 7 runs, 1 loops each) > > f = lambda x: x % 3 > > %timeit [*(f(i) for

Re: Do not promote `None` as the first argument to `filter` in documentation.

2018-03-06 Thread Jason Friedman
On Tue, Mar 6, 2018 at 1:52 AM, Kirill Balunov wrote: > > I propose to delete all references in the `filter` documentation that the > first argument can be `None`, with possible depreciation of `None` as the > the first argument - FutureWarning in Python 3.8+ and deleting this option > in Python

Re: Do not promote `None` as the first argument to `filter` in documentation.

2018-03-06 Thread Kirill Balunov
2018-03-06 16:51 GMT+03:00 Chris Angelico : > On Wed, Mar 7, 2018 at 12:23 AM, Kirill Balunov > wrote: > > Filter is generally faster than list comprehension or generators. > > > > %timeit [*filter(lambda x: x % 3, range(1000))] > > 100 µs ± 16.4 ns per loop (mean ± std. dev. of 7 runs, 1 loo

Re: Do not promote `None` as the first argument to `filter` in documentation.

2018-03-06 Thread Kirill Balunov
2018-03-06 16:35 GMT+03:00 Chris Green : > It's 'deprecation', depreciation is something quite different. People > replying have spelt it correctly so you might possibly have noticed I > thought/hoped. > > ... and it does matter a bit because it's not just a mis-spelling, the > word you are using

Layers of abstraction, was Re: RFC: Proposal: Deterministic Object Destruction

2018-03-06 Thread Peter Otten
Chris Angelico wrote: > On Tue, Mar 6, 2018 at 10:04 AM, Steven D'Aprano > wrote: >> # Later. >> if __name__ = '__main__': >> # Enter the Kingdom of Nouns. > > Don't you need a NounKingdomEnterer to do that for you? No, for some extra flexibility there should be a NounKingdomEntererFactory

"except" and "subclasscheck" changed between CPython2 and 3

2018-03-06 Thread Youta TAKAOKA
Thank you, Steven. > There is a feature-request to support that (as Python 2.7 does): > > https://bugs.python.org/issue12029 > > but it is stalled. I passed over the ticket. Now, I know that this is a bug, but has not fixed yet. There are (or ware ?) problems about performance and integrity for

Re: Do not promote `None` as the first argument to `filter` in documentation.

2018-03-06 Thread Kirill Balunov
2018-03-06 16:58 GMT+03:00 Jason Friedman : > > as a ordinary Python user I'd be interested in improvements to the > documentation, including suggestions on real-world usage. > I'm just an ordinary user, just like you :) > Kirill, taking deprecation/removal off the table, what changes would you

Re: Do not promote `None` as the first argument to `filter` in documentation.

2018-03-06 Thread Chris Angelico
On Wed, Mar 7, 2018 at 1:48 AM, Kirill Balunov wrote: > Note: For some historical reasons as the first argument you can use None > instead of function, in this case the identity function is assumed. That > is, all elements of iterable that are false are removed which is equivalent > to (item for i

Re: Do not promote `None` as the first argument to `filter` in documentation.

2018-03-06 Thread Kirill Balunov
2018-03-06 17:55 GMT+03:00 Chris Angelico : > On Wed, Mar 7, 2018 at 1:48 AM, Kirill Balunov > wrote: > > Note: For some historical reasons as the first argument you can use None > > instead of function, in this case the identity function is assumed. That > > is, all elements of iterable that are

Re: Do not promote `None` as the first argument to `filter` in documentation.

2018-03-06 Thread Chris Angelico
On Wed, Mar 7, 2018 at 2:12 AM, Kirill Balunov wrote: > > > 2018-03-06 17:55 GMT+03:00 Chris Angelico : >> >> On Wed, Mar 7, 2018 at 1:48 AM, Kirill Balunov >> wrote: >> > Note: For some historical reasons as the first argument you can use None >> > instead of function, in this case the identity

Re: Do not promote `None` as the first argument to `filter` in documentation.

2018-03-06 Thread Kirill Balunov
2018-03-06 17:55 GMT+03:00 Chris Angelico : > If the first argument is None, the identity function is assumed. That > is, all elements of the iterable that are false are removed; it is > equivalent to (item for item in iterable if item). It is approximately > equivalent to (but faster than) filter

Re: Do not promote `None` as the first argument to `filter` in documentation.

2018-03-06 Thread Chris Angelico
On Wed, Mar 7, 2018 at 2:33 AM, Kirill Balunov wrote: > > > 2018-03-06 17:55 GMT+03:00 Chris Angelico : >> >> If the first argument is None, the identity function is assumed. That >> is, all elements of the iterable that are false are removed; it is >> equivalent to (item for item in iterable if i

Re: Do not promote `None` as the first argument to `filter` in documentation.

2018-03-06 Thread Peter Otten
Chris Angelico wrote: > On Wed, Mar 7, 2018 at 2:12 AM, Kirill Balunov > wrote: >> >> >> 2018-03-06 17:55 GMT+03:00 Chris Angelico : >>> >>> On Wed, Mar 7, 2018 at 1:48 AM, Kirill Balunov >>> wrote: >>> > Note: For some historical reasons as the first argument you can use >>> > None instead of f

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-06 Thread Ooomzay
On Monday, 5 March 2018 23:06:53 UTC, Steven D'Aprano wrote: > On Mon, 05 Mar 2018 09:22:33 -0800, Ooomzay wrote: > [...] > > If you would like to have a shot at coding this without RAII, but > > preserving the OO design, you will find that it is considerably > > simpler than the with/context man

Re: Bitstream -- Binary Data for Humans

2018-03-06 Thread Roel Schroeven
Sébastien Boisgérault schreef op 6/03/2018 10:23: I had a look at the AIS message format from your link(https://en.wikipedia.org/wiki/Automatic_identification_system#Message_format) and this seems to be a nice use case; all the data components seem to be nicely aligned on the byte boundary ... unt

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-06 Thread Chris Angelico
On Wed, Mar 7, 2018 at 9:09 AM, Ooomzay wrote: >> I'm not trying to dissuade you from using RAII in your own applications, >> if it works for you, great. > > Unfortunately, despite having conquered it, without a _guarantee_ of this > behaviour from the language, or at least one mainstream implemen

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-06 Thread Steven D'Aprano
On Tue, 06 Mar 2018 14:09:53 -0800, Ooomzay wrote: > Unfortunately, despite having conquered it, without a _guarantee_ of > this behaviour from the language, or at least one mainstream > implementation, I will not invest in python again. Oh well, so sad. See you later. -- Steve -- https://ma

Subprocess Startup Error

2018-03-06 Thread Jeremy Jamar St. Julien
Whenever I try to open the python shell it says IDLE’s subprocess didn’t make a connection. Everything worked fine yesterday and I haven’t done anything I think would cause this problem. Any way to fix this? I’ve tried repairing and redownloading -- https://mail.python.org/mailman/listinfo/pyth

Re: Subprocess Startup Error

2018-03-06 Thread Terry Reedy
On 3/6/2018 6:00 PM, Jeremy Jamar St. Julien wrote: Whenever I try to open the python shell it says IDLE’s subprocess didn’t make a connection. You must be referring to IDLE's GUI Shell, not Python's normal console text (TUI?) shell or REPL. IDLE normally runs its GUI in one process and you

LXML: can't register namespace

2018-03-06 Thread Andrew Z
Hello, with 3.6 and latest greatest lxml: from lxml import etree tree = etree.parse('Sample.xml') etree.register_namespace('','http://www.example.com') causes: Traceback (most recent call last): File "/home/az/Work/flask/tutorial_1/src/xml_oper.py", line 16, in etree.register_namespace('

Re: LXML: can't register namespace

2018-03-06 Thread Steven D'Aprano
On Tue, 06 Mar 2018 23:03:15 -0500, Andrew Z wrote: > Hello, > with 3.6 and latest greatest lxml: > > from lxml import etree > > tree = etree.parse('Sample.xml') > etree.register_namespace('','http://www.example.com') > it seems to not be happy with the empty tag . But i'm not sure why and > h

Re: Layers of abstraction, was Re: RFC: Proposal: Deterministic Object Destruction

2018-03-06 Thread Ooomzay
On Tuesday, 6 March 2018 14:12:38 UTC, Peter Otten wrote: > Chris Angelico wrote: > > > On Tue, Mar 6, 2018 at 10:04 AM, Steven D'Aprano > > wrote: > >> # Later. > >> if __name__ = '__main__': > >> # Enter the Kingdom of Nouns. > > > > Don't you need a NounKingdomEnterer to do that for you?

Re: Layers of abstraction, was Re: RFC: Proposal: Deterministic Object Destruction

2018-03-06 Thread Ooomzay
On Wednesday, 7 March 2018 06:43:10 UTC, Ooomzay wrote: > On Tuesday, 6 March 2018 14:12:38 UTC, Peter Otten wrote: > > Chris Angelico wrote: > > > > > On Tue, Mar 6, 2018 at 10:04 AM, Steven D'Aprano > > > wrote: > > >> # Later. > > >> if __name__ = '__main__': > > >> # Enter the Kingdom o