Re: How to create a binary tree hierarchy given a list of elements as its leaves

2024-01-28 Thread MRAB via Python-list
On 2024-01-28 18:16, marc nicole via Python-list wrote: So I am trying to build a binary tree hierarchy given numerical elements serving for its leaves (last level of the tree to build). From the leaves I want to randomly create a name for the higher level of the hierarchy and assign it to the

How to create a binary tree hierarchy given a list of elements as its leaves

2024-01-28 Thread marc nicole via Python-list
So I am trying to build a binary tree hierarchy given numerical elements serving for its leaves (last level of the tree to build). From the leaves I want to randomly create a name for the higher level of the hierarchy and assign it to the children elements. For example: if the elements inputted

Re: Reading binary data with the CSV module

2020-11-30 Thread MRAB
On 2020-11-30 03:59, Jason Friedman wrote: csv.DictReader appears to be happy with a list of strings representing the lines. Try this: contents = source_file.content() for row in csv.DictReader(contents.decode('utf-8').splitlines()): print(row) Works great, thank you! Question ... wil

Re: Reading binary data with the CSV module

2020-11-29 Thread Jason Friedman
> > csv.DictReader appears to be happy with a list of strings representing > the lines. > > Try this: > > contents = source_file.content() > > for row in csv.DictReader(contents.decode('utf-8').splitlines()): > print(row) > Works great, thank you! Question ... will this form potentially use l

Re: Reading binary data with the CSV module

2020-11-29 Thread MRAB
On 2020-11-30 01:31, Jason Friedman wrote: Using the Box API: print(source_file.content()) returns b'First Name,Last Name,Email Address,Company,Position,Connected On\nPeter,van (and more data, not pasted here) Trying to read it via: with io.TextIOWrapper(source_file.content(), encoding=

Reading binary data with the CSV module

2020-11-29 Thread Jason Friedman
Using the Box API: print(source_file.content()) returns b'First Name,Last Name,Email Address,Company,Position,Connected On\nPeter,van (and more data, not pasted here) Trying to read it via: with io.TextIOWrapper(source_file.content(), encoding='utf-8') as text_file: reader = csv.DictRead

Re: Binary Sort on Python List __xor__

2020-06-01 Thread Rhodri James
On 31/05/2020 18:01, Evan Schalton wrote: I think you're arguing both sides of the argument -- numpy arrays do have a lot of similar, related operations (because numpy uses them internally -- since they're more efficient) which means they're not fringe. I'm advocating that the built-in list clas

Re: Binary Sort on Python List __xor__

2020-05-31 Thread Terry Reedy
On 5/31/2020 12:24 PM, Evan Schalton wrote: I'm less strictly interested in the & operator explicitly working with a bit int, but think it'd be great if the was a built-in filter something like: [1,2,3,4] & [0,0,1,1] => [3,4] OR [1,2,3,4] & [False, False, True, True] = [3,4] Leaving numpy

Re: Binary Sort on Python List __xor__

2020-05-31 Thread Evan Schalton
I think you're arguing both sides of the argument -- numpy arrays do have a lot of similar, related operations (because numpy uses them internally -- since they're more efficient) which means they're not fringe. I'm advocating that the built-in list class add the efficient, convenience methods

Re: Binary Sort on Python List __xor__

2020-05-31 Thread Peter Otten
Evan Schalton wrote: > Peter, > > This isn't a ram consideration as much it's a logical consideration. There > are a lot of ways to handle this, I REALLY don't want to use a package > here. Bit masking is incredibly useful for permutations/combinatoric > algorithms. I can create my own class wrap

Re: Binary Sort on Python List __xor__

2020-05-31 Thread Evan Schalton
Peter, This isn't a ram consideration as much it's a logical consideration. There are a lot of ways to handle this, I REALLY don't want to use a package here. Bit masking is incredibly useful for permutations/combinatoric algorithms. I can create my own class wrapper or functions, and optimize,

Re: Binary Sort on Python List __xor__

2020-05-31 Thread Peter Otten
evan.schal...@gmail.com wrote: > I frequently use binary as bool placeholders and find myself filtering > lists based on those bools, this seems to have a similar semantic meaning > as the bit wise ^ or __xor__ operator and could add syntactic sugar to the > base list class. &

Re: Binary Sort on Python List __xor__

2020-05-30 Thread Evan Schalton
@MRAB, Yes -- good point, it should be the __and__ operator. do I need a new class? No, but based on this use case and other formatting techniques adding a filter method to the list class that takes in either bit mask or bool list would streamline a lot of code and not change any existing func

Re: Binary Sort on Python List __xor__

2020-05-30 Thread MRAB
On 2020-05-30 23:52, evan.schal...@gmail.com wrote: I frequently use binary as bool placeholders and find myself filtering lists based on those bools, this seems to have a similar semantic meaning as the bit wise ^ or __xor__ operator and could add syntactic sugar to the base list class. Use

Binary Sort on Python List __xor__

2020-05-30 Thread evan . schalton
I frequently use binary as bool placeholders and find myself filtering lists based on those bools, this seems to have a similar semantic meaning as the bit wise ^ or __xor__ operator and could add syntactic sugar to the base list class. Use Case: Controlling a stepper at half-step has the

Re: IP address to binary conversion

2020-05-09 Thread al . alexiev
Hi Alan, Yes, agreed that any '!I' or '!L' combination will work on different type of platforms in a consistent manner, when applied in both directions. I was referring to Alex Martelli's output, where the conversion back to IP seems to be reversed, even with '!L', which means that he's already

Re: IP address to binary conversion

2020-05-08 Thread Alan Bawden
al.alex...@gmail.com writes: > Just for the records and to have a fully working bidirectional solution: > > >>> ip > '10.44.32.0' > >>> struct.unpack('L', socket.inet_aton(ip))[0] > 2108426 > >>> socket.inet_ntoa(struct.pack(' '10.44.32.0' > >>> > > Good luck ;-) This will not work as expected

Re: IP address to binary conversion

2020-05-08 Thread al . alexiev
Just for the records and to have a fully working bidirectional solution: >>> ip '10.44.32.0' >>> struct.unpack('L', socket.inet_aton(ip))[0] 2108426 >>> socket.inet_ntoa(struct.pack('>> Good luck ;-) -- https://mail.python.org/mailman/listinfo/python-list

Inconsistent binary link creation when creating virtual environment with venv module

2019-11-21 Thread Coirier, Emmanuel
ython3.6 / python3.7 / python3.8) to create the environment like this example : python3.7 -m venv venv37 The environment is created with 3 links to the python binary : lrwxrwxrwx 1 root root9 21 nov. 17:29 python -> python3.7 lrwxrwxrwx 1 root root9 21 nov. 17:29 python3 -> python

Re: Where can I find libtiff binary for 64-bit windows - for use in conjunction with Python package libtiff

2019-09-06 Thread Dobedani
Thanks for the answer. That site provides wheels for installing the Python libtiff package - great if "pip install libtiff" does not work out well. Besides that package, you'll need to have a 64-bits DLL on your system for it to work. That's the DLL I'm looking for. -- https://mail.python.org/

Re: Where can I find libtiff binary for 64-bit windows - for use in conjunction with Python package libtiff

2019-09-06 Thread MRAB
win32.sourceforge.net/packages/tiff.htm (version 3.8.2) and I'm running my code with success. I would like to run my Python code also with a 64-bit version of Python, so I need a 64-bit of the above-mentioned binary / DLL. My problem is that I can't find any reliable site where it's av

Where can I find libtiff binary for 64-bit windows - for use in conjunction with Python package libtiff

2019-09-06 Thread Dobedani
3.8.2) and I'm running my code with success. I would like to run my Python code also with a 64-bit version of Python, so I need a 64-bit of the above-mentioned binary / DLL. My problem is that I can't find any reliable site where it's available for download. Okay, I have come

Re: base = 1024 if (gnu or binary) else 1000

2019-08-05 Thread MRAB
On 2019-08-05 16:01, Hongyi Zhao wrote: Hi, I read the source code of of `humanize/filesize.py' and find the 24 line writing as follows: base = 1024 if (gnu or binary) else 1000 It seems this is not the standard usage of if ... else Is this a variant of lambda or some others? Coul

Re: base = 1024 if (gnu or binary) else 1000

2019-08-05 Thread Rhodri James
On 05/08/2019 16:01, Hongyi Zhao wrote: Hi, I read the source code of of `humanize/filesize.py' and find the 24 line writing as follows: base = 1024 if (gnu or binary) else 1000 It seems this is not the standard usage of if ... else It's a perfectly standard conditional *

base = 1024 if (gnu or binary) else 1000

2019-08-05 Thread Hongyi Zhao
Hi, I read the source code of of `humanize/filesize.py' and find the 24 line writing as follows: base = 1024 if (gnu or binary) else 1000 It seems this is not the standard usage of if ... else Is this a variant of lambda or some others? Could you please give me some more

Re: need help understanding: converting text to binary

2019-04-23 Thread Eli the Bearded
t;> multibyte one, b'\x9A' doesn't mean anything on its own. That's why I >> want to treat it as binary. > If you don't know the encoding then you don't know you're looking at a > hex digit. OTOH, if the binary data contain ASCII data then you d

Re: need help understanding: converting text to binary

2019-04-23 Thread Gregory Ewing
Cameron Simpson wrote: If you don't know the encoding then you don't know you're looking at a hex digit. OTOH, if the binary data contain ASCII data then you do know the encoding: it is ASCII. Not necessarily, it could be a superset of ASCII such as latin-1 or utf-8. You do ne

Re: need help understanding: converting text to binary

2019-04-23 Thread Cameron Simpson
On 23Apr2019 20:35, Eli the Bearded <*@eli.users.panix.com> wrote: In comp.lang.python, Chris Angelico wrote: Is there a more python-esque way to convert what should be plain ascii What does "plain ASCII" actually mean, though? ASCII encoded binary data. ASCII is code poin

Re: need help understanding: converting text to binary

2019-04-23 Thread Eli the Bearded
In comp.lang.python, Paul Rubin wrote: > Eli the Bearded <*@eli.users.panix.com> writes: >> # decode a single hex digit >> def hord(c): ... > >def hord(c): return int(c, 16) That's a good method, thanks. > > # decode quoted printable, specifically the MIME-encoded words > > # variant which

Re: need help understanding: converting text to binary

2019-04-23 Thread Eli the Bearded
encoding in email headers. I turned to a library for the base64 part and translated C code I once wrote for the quoted-printable part. I was struck by how complicated it seems to be to generate binary blobs in python, which makes me think I'm not getting something. >> Is there a more pyt

Re: need help understanding: converting text to binary

2019-04-22 Thread MRAB
On 2019-04-23 01:54, Eli the Bearded wrote: Here's some code I wrote today: [snip] # decode a single hex digit def hord(c): c = ord(c) if c >= ord(b'a'): return c - ord(b'a') + 10 elif c >= ord(b'A'): There's a bug here: return c - ord(b'a') + 10 It shou

Re: need help understanding: converting text to binary

2019-04-22 Thread Chris Angelico
/lib/python3.5/quopri.py on my system. (Why am I not > using quopri? Well, (a) I want to learn, (b) it decodes to a file > not a variable, (c) I want different error handling.) The bytes constructor will take a sequence of integers and return a byte string with those values. For instance, b

need help understanding: converting text to binary

2019-04-22 Thread Eli the Bearded
yes' But the bytes() thing is really confusing me. Most of this is translated from C code I wrote some time ago. I'm new to python and did spend some time reading: https://docs.python.org/3/library/stdtypes.html#bytes-objects Why does "bytes((integertype,))" work? I'll free

Re: Library for parsing binary structures

2019-03-30 Thread Cameron Simpson
On 30Mar2019 10:29, Paul Moore wrote: On Fri, 29 Mar 2019 at 23:21, Cameron Simpson wrote: On 27Mar2019 18:41, Paul Moore wrote: >I'm looking for a library that lets me parse binary data structures. >The stdlib struct module is fine for simple structures, but when it &g

Re: Library for parsing binary structures

2019-03-30 Thread Paul Moore
On Fri, 29 Mar 2019 at 23:21, Cameron Simpson wrote: > > On 27Mar2019 18:41, Paul Moore wrote: > >I'm looking for a library that lets me parse binary data structures. > >The stdlib struct module is fine for simple structures, but when it > >gets to more complicated

Re: Library for parsing binary structures

2019-03-29 Thread Cameron Simpson
On 30Mar2019 09:44, Cameron Simpson wrote: On 27Mar2019 18:41, Paul Moore wrote: I'm looking for a library that lets me parse binary data structures. The stdlib struct module is fine for simple structures, but when it gets to more complicated cases, you end up doing a lot of the work by

Re: Library for parsing binary structures

2019-03-29 Thread Cameron Simpson
On 27Mar2019 18:41, Paul Moore wrote: I'm looking for a library that lets me parse binary data structures. The stdlib struct module is fine for simple structures, but when it gets to more complicated cases, you end up doing a lot of the work by hand (which isn't that hard, and is

Re: Library for parsing binary structures

2019-03-29 Thread Peter J. Holzer
On 2019-03-29 16:34:35 +, Paul Moore wrote: > On Fri, 29 Mar 2019 at 16:16, Peter J. Holzer wrote: > > > Obviously you need some way to describe the specific binary format you > > want to parse - in other words, a grammar. The library could then use > > the gr

Re: Library for parsing binary structures

2019-03-29 Thread Paul Moore
On Fri, 29 Mar 2019 at 16:16, Peter J. Holzer wrote: > Obviously you need some way to describe the specific binary format you > want to parse - in other words, a grammar. The library could then use > the grammar to parse the input - either by interpreting it directly, or > by genera

Re: Library for parsing binary structures

2019-03-29 Thread Dan Sommers
On 3/29/19 12:13 PM, Peter J. Holzer wrote: Obviously you need some way to describe the specific binary format you want to parse - in other words, a grammar. The library could then use the grammar to parse the input - either by interpreting it directly, or by generating (Python) code from it

Re: Library for parsing binary structures

2019-03-29 Thread Peter J. Holzer
On 2019-03-28 11:07:22 +0100, dieter wrote: > Paul Moore writes: > > My real interest is in whether any libraries exist to do this sort > > of thing (there are plenty of parser libraries for text, pyparsing > > being the obvious one, but far fewer for binary structures).

Re: Library for parsing binary structures

2019-03-28 Thread dieter
Paul Moore writes: > On Thu, 28 Mar 2019 at 08:15, dieter wrote: > ... > My real interest is in whether any > libraries exist to do this sort of thing (there are plenty of parser > libraries for text, pyparsing being the obvious one, but far fewer for > binary structures)

Re: Library for parsing binary structures

2019-03-28 Thread Paul Moore
very similar to how I'd approach that. My real interest is in whether any libraries exist to do this sort of thing (there are plenty of parser libraries for text, pyparsing being the obvious one, but far fewer for binary structures). Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Library for parsing binary structures

2019-03-28 Thread dieter
Paul Moore writes: > I'm looking for a library that lets me parse binary data structures. > The stdlib struct module is fine for simple structures, but when it > gets to more complicated cases, you end up doing a lot of the work by > hand (which isn't that hard, and is gene

Library for parsing binary structures

2019-03-27 Thread Paul Moore
I'm looking for a library that lets me parse binary data structures. The stdlib struct module is fine for simple structures, but when it gets to more complicated cases, you end up doing a lot of the work by hand (which isn't that hard, and is generally perfectly viable, but I'

(yet another) PEP idea to tackle binary wheels problem efficiently

2019-02-18 Thread Alexander Revin
work on Alpine or any musl-based distro; 2. Second – how amd64 is different from x86_64? 3. Third's platform tag is just a nightmare. More of that, if you open the last one and inspect one of the libraries, you'll find that: $ file _libs/algos.cpython-36m-darwin.so _libs/algos.cpy

Re: (yet another) PEP idea to tackle binary wheels problem efficiently

2019-02-18 Thread Alexander Revin
.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl > > I see issues with each of them: > 1. First one won't work on Alpine or any musl-based distro; > 2. Second – how amd64 is different from x86_64? > 3. Third's platform tag is just a nightmare. > > More of th

Re: Compression of random binary data

2018-04-12 Thread Ned Batchelder
On 4/11/18 9:29 PM, cuddlycave...@gmail.com wrote: I’m replying to your post on January 28th Nice carefully chosen non random numbers Steven D'Aprano. Was just doing what you asked, but you don’t remember 😂😂😂 Best practice is to include a quote of the thing you are replying to.  It makes it m

Re: Compression of random binary data

2018-04-11 Thread cuddlycaveman
I’m replying to your post on January 28th Nice carefully chosen non random numbers Steven D'Aprano. Was just doing what you asked, but you don’t remember 😂😂😂 -- https://mail.python.org/mailman/listinfo/python-list

Re: Compression of random binary data

2018-04-11 Thread Steven D'Aprano
On Tue, 10 Apr 2018 23:36:27 -0700, cuddlycaveman wrote: [snip a number of carefully chosen, non-random numbers shown in binary] > Don’t know if that helps Helps what? With no context, we don't know who you are replying to, what they asked, or why you think this is helpful. Accordi

Re: Compression of random binary data

2018-04-10 Thread cuddlycaveman
387420479 00110011 00111000 00110111 00110100 00110010 0011 00110100 00110111 00111001 72 bits Equal to (9^9)-10 00101000 00111001 0100 00111001 00101001 00101101 00110001 0011 64 bits 387420499 00110011 00111000 00110111 00110100 00110010 0011 00110100 00111001 00111001 72 bits

Re: Bitstream -- Binary Data for Humans

2018-03-06 Thread Roel Schroeven
... until you see that the payload uses ASCII6(*), which I didn't know about. Thanks again for the info! ASCII6 is only the first layer where your Bitstream could be useful. It's the easy part :). The main work comes after that: decoding ASCII6 results in binary data which we need to d

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

2018-03-06 Thread Sébastien Boisgérault
astien 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 kind > >>> of thing usually entails :) > >> > >>> byte_ind

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

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: 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 >

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

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

Re: Bitstream -- Binary Data for Humans

2018-03-05 Thread Roel Schroeven
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 :) If you have struggled with this topic in the past, please take a look at

Re: Bitstream -- Binary Data for Humans

2018-03-05 Thread sum abiut
Thanks On 6/03/2018 7:13 AM, "Sébastien Boisgérault" < sebastien.boisgera...@gmail.com> wrote: Hi everyone, 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 :) If yo

Bitstream -- Binary Data for Humans

2018-03-05 Thread Sébastien Boisgérault
Hi everyone, 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 :) If you have struggled with this topic in the past, please take a look at the documentation (http

Re: Compression of random binary data

2018-01-28 Thread Peter Pearson
On Sat, 27 Jan 2018 21:26:06 -0800 (PST), pendrysamm...@gmail.com wrote: > If it is then show him this > > 387,420,489 >= > 00110011 00111000 00110111 00101100 00110100 00110010 0011 0 ... To save the casual reader a moment of disorientation, the above binary string is

Re: Compression of random binary data (Posting On Python-List Prohibited)

2018-01-28 Thread Grant Edwards
On 2018-01-28, pendrysamm...@gmail.com wrote: > I have it in my head, just need someone to write the program for me, > I know nothing about data compression or binary data other than 1s > and 0s and that you can not take 2 number without a possible value > more or less than the

Re: Compression of random binary data

2018-01-28 Thread Steven D'Aprano
On Sat, 27 Jan 2018 21:50:24 -0800, pendrysammuel wrote: > 387,420,489 is a number with only 2 repeating binary sequences Okay. Now try these two numbers: 387420479 387420499 -- Steve -- https://mail.python.org/mailman/listinfo/python-list

Re: Compression of random binary data

2018-01-28 Thread Steven D'Aprano
On Sat, 27 Jan 2018 22:14:46 -0800, pendrysammuel wrote: > I have it in my head, just need someone to write the program for me, Sure, my rate is $150 an hour. > I > know nothing about data compression or binary data other than 1s and 0s > and that you can not take 2 number withou

Re: Compression of random binary data (Posting On Python-List Prohibited)

2018-01-27 Thread pendrysammuel
Lawrence D’Oliveiro In other words yes, I just need to be sober first. -- https://mail.python.org/mailman/listinfo/python-list

Re: Compression of random binary data (Posting On Python-List Prohibited)

2018-01-27 Thread pendrysammuel
I have it in my head, just need someone to write the program for me, I know nothing about data compression or binary data other than 1s and 0s and that you can not take 2 number without a possible value more or less than them selves and compress them, I have been working for 1 1/2 years on a

Re: Compression of random binary data

2018-01-27 Thread pendrysammuel
387,420,489 is a number with only 2 repeating binary sequences In binary 387,420,489 is expressed as 00110011 00111000 00110111 00101100 00110100 00110010 0011 00101100 00110100 00111000 00111001 387,420,489 can be simplified to 9*9 or nine to the power of nine In binary 9*9 is represented

Re: Compression of random binary data

2018-01-27 Thread Chris Angelico
On Sun, Jan 28, 2018 at 4:26 PM, wrote: > If it is then show him this > > 387,420,489 > = > 00110011 00111000 00110111 00101100 00110100 00110010 0011 00101100 > 00110100 00111000 00111001 > > 9^9 = ⬇️ (^ = to the power of) > = 387,420,489 > > But > > 9^9 > = > 00111001 0100 00111001 I

Compression of random binary data

2018-01-27 Thread pendrysammuel
If it is then show him this 387,420,489 = 00110011 00111000 00110111 00101100 00110100 00110010 0011 00101100 00110100 00111000 00111001 9^9 = ⬇️ (^ = to the power of) = 387,420,489 But 9^9 = 00111001 0100 00111001 -- https://mail.python.org/mailman/listinfo/python-list

Re: binary decision diagrams

2017-12-20 Thread Devin Jeanpierre
On Mon, Dec 18, 2017 at 5:00 AM, Wild, Marcel, Dr wrote: > Hello everybody: > I really don't know anything about Python (I'm using Mathematica) but with > the help of others learned that > > g=expr2bdd(f) > > makes the BDD (=binary decision diagram) g of a Bool

binary decision diagrams (BDD)

2017-12-20 Thread Wild, Marcel, Dr
agram of g (i.e. the usual binary tree) ? The integrity and confidentiality of this email is governed by these terms / Die integriteit en vertroulikheid van hierdie e-pos word deur die volgende bepalings gere?l. http://www.sun.ac.za/emaildisclaimer -- https://mail.python.org/mailman/listinfo/python-list

binary decision diagrams

2017-12-20 Thread Wild, Marcel, Dr
Hello everybody: I really don't know anything about Python (I'm using Mathematica) but with the help of others learned that g=expr2bdd(f) makes the BDD (=binary decision diagram) g of a Boolean function f. But what is the easiest (fool-proof) way to print out a diagram of g

Re: how to compare and check if two binary(h5) files numerically have the same contents

2017-11-21 Thread Cameron Simpson
On 21Nov2017 02:04, Heli wrote: I am trying to compare the contents of two binary files. I use python 3.6 filecomp comparing same name files inside two directories. results_dummy=filecmp.cmpfiles(dir1, dir2, common, shallow=True) The above line works for *.bin file I have in both directories

how to compare and check if two binary(h5) files numerically have the same contents

2017-11-21 Thread Heli
Dear all, I am trying to compare the contents of two binary files. I use python 3.6 filecomp comparing same name files inside two directories. results_dummy=filecmp.cmpfiles(dir1, dir2, common, shallow=True) The above line works for *.bin file I have in both directories, but it does not work

Re: right list for SIGABRT python binary question ?

2017-11-04 Thread Karsten Hilbert
On Fri, Nov 03, 2017 at 07:31:56AM +0100, dieter wrote: > > I have posted backtraces taken from the address being > > watched. Does that help any at all ? > > Only in the case that the error is "local", i.e. detected > (quite) immediately. > > You might be in this case as you have observed that

Re: right list for SIGABRT python binary question ?

2017-11-02 Thread dieter
Karsten Hilbert writes: > ... > I have posted backtraces taken from the address being > watched. Does that help any at all ? Only in the case that the error is "local", i.e. detected (quite) immediately. You might be in this case as you have observed that the address is stable after library prel

Re: right list for SIGABRT python binary question ?

2017-11-02 Thread Karsten Hilbert
On Wed, Nov 01, 2017 at 04:28:02PM +, Grant Edwards wrote: > >>I understand. Thank you for the explanation. This may seem > >>like a dumb question: the actual address that gets corrupted > >>varies from run to run (it may be the same "place" in the > > > > Since the process virtual memory

Re: right list for SIGABRT python binary question ?

2017-11-02 Thread dieter
Karsten Hilbert writes: >> >> It points to a memory corruption. >> >> The i386/x64 architecture supports memory access breakpoints >> and GDB, too, has support for this. You know the address which >> gets corrupted. Thus, the following apporach could have a chance >> to succeed: >> >>Put a "

Re: right list for SIGABRT python binary question ?

2017-11-01 Thread Grant Edwards
On 2017-11-01, Dennis Lee Bieber wrote: > On Wed, 1 Nov 2017 10:27:54 +0100, Karsten Hilbert > declaimed the following: > > >> >>I understand. Thank you for the explanation. This may seem >>like a dumb question: the actual address that gets corrupted >>varies from run to run (it may be the same "p

Re: right list for SIGABRT python binary question ?

2017-11-01 Thread Karsten Hilbert
On Wed, Nov 01, 2017 at 11:58:53AM -0400, Dennis Lee Bieber wrote: > >I understand. Thank you for the explanation. This may seem > >like a dumb question: the actual address that gets corrupted > >varies from run to run (it may be the same "place" in the > > Since the process virtual memory

Re: right list for SIGABRT python binary question ?

2017-11-01 Thread Karsten Hilbert
On Wed, Nov 01, 2017 at 12:40:56PM +0100, Karsten Hilbert wrote: > Interestingly, on subsequent runs, it seems to hit the same > address, 0x6aab7c, belonging to the same symbol, _Py_ZeroStruct. > > This is what happens: > > (gdb) watch *0x6aab7c > Hardware watchpoint 1: *0x6aab7c >

Re: right list for SIGABRT python binary question ?

2017-11-01 Thread Karsten Hilbert
> my assumption would be that something clobbers 0x6aab7c, > which seems to be in (?) _Py_ZeroStruct in this run. I'll > re-run a few times to make sure the corruption "reliably" > hits _Py_ZeroStruct. > > If so, I'll set a memory write breakpoint on _Py_ZeroStruct. Interestingly, on subsequent r

Re: right list for SIGABRT python binary question ?

2017-11-01 Thread Karsten Hilbert
On Wed, Nov 01, 2017 at 11:14:08AM +0100, Karsten Hilbert wrote: > Or rather: I need to find out which "place" a given address > refers to, check whether the changing addresses always belong > to the same "place" between runs and _then_ map a "place" to > its address and breakpoint that address on

Re: right list for SIGABRT python binary question ?

2017-11-01 Thread Karsten Hilbert
On Wed, Nov 01, 2017 at 10:27:54AM +0100, Karsten Hilbert wrote: > > >> It points to a memory corruption. > > > > The i386/x64 architecture supports memory access breakpoints > > and GDB, too, has support for this. You know the address which > > gets corrupted. Thus, the following apporach could

Re: right list for SIGABRT python binary question ?

2017-11-01 Thread Karsten Hilbert
On Wed, Nov 01, 2017 at 09:21:46AM +0100, dieter wrote: > >> It points to a memory corruption. > > The i386/x64 architecture supports memory access breakpoints > and GDB, too, has support for this. You know the address which > gets corrupted. Thus, the following apporach could have a chance > to

Re: right list for SIGABRT python binary question ?

2017-11-01 Thread dieter
Karsten Hilbert writes: > On Sat, Oct 21, 2017 at 09:31:54AM +0200, dieter wrote: >> It points to a memory corruption. > While running valgrind and friends is beyond my capabilitis I > have run the problem through gdb to at least obtain a stack > trace to see what gives: The i386/x64 architectur

Re: right list for SIGABRT python binary question ?

2017-10-30 Thread Karsten Hilbert
On Mon, Oct 30, 2017 at 02:02:25PM +0100, M.-A. Lemburg wrote: > PS: Please CC me on replies as I don't regularly read c.l.p anymore. Sure. > >> Could you check whether you have similar import errors with > >> other modules that have C extensions ? E.g. lxml. > >> > >> What you're seeing appears

Re: right list for SIGABRT python binary question ?

2017-10-30 Thread M.-A. Lemburg
n 25.10.2017 11:51, Karsten Hilbert wrote: > On Tue, Oct 24, 2017 at 08:47:58PM +0200, M.-A. Lemburg wrote: > This error suggests that you have 32- and 64-bit versions of Python and mxDateTime mixed in your installation. Py_InitModule4 is only available in the 32-bit build of >

Re: Compression of random binary data

2017-10-29 Thread Ben Bacarisse
Gregory Ewing writes: > Ben Bacarisse wrote: >> But that has to be about the process that gives rise to the data, not >> the data themselves. > >> If I say: "here is some random data..." you can't tell if it is or is >> not from a random source. I can, as a parlour trick, compress and >> recover

Re: Compression of random binary data

2017-10-29 Thread Steve D'Aprano
On Sun, 29 Oct 2017 01:56 pm, Stefan Ram wrote: > If the entropy of an individual message is not defined, > than it is still available to be defined. I define it > to be log2(1/p), where p is the probability of this > message. I also choose a unit for it, which I call "bit". That is exact

Re: Compression of random binary data

2017-10-29 Thread Steve D'Aprano
On Sun, 29 Oct 2017 06:03 pm, Chris Angelico wrote: > On Sun, Oct 29, 2017 at 6:00 PM, Ian Kelly wrote: >> On Oct 28, 2017 5:53 PM, "Chris Angelico" wrote: >>> One bit. It might send the message, or it might NOT send the message. >> >> Not sending the message is equivalent to having a second pos

Re: Compression of random binary data

2017-10-29 Thread Steve D'Aprano
On Sun, 29 Oct 2017 02:31 pm, Gregory Ewing wrote: > Steve D'Aprano wrote: >> I don't think that's right. The entropy of a single message is a >> well-defined quantity, formally called the self-information. >> >> https://en.wikipedia.org/wiki/Self-information > > True, but it still depends on kn

Re: Compression of random binary data

2017-10-29 Thread Gregory Ewing
Chris Angelico wrote: One bit. It might send the message, or it might NOT send the message. The entropy formula assumes that you are definitely going to send one of the possible messages. If not sending a message is a possibility, then you need to include an empty message in the set of messages

Re: Compression of random binary data

2017-10-29 Thread Chris Angelico
On Sun, Oct 29, 2017 at 6:00 PM, Ian Kelly wrote: > On Oct 28, 2017 5:53 PM, "Chris Angelico" wrote: >> One bit. It might send the message, or it might NOT send the message. > > Not sending the message is equivalent to having a second possible message. Okay, now we're getting seriously existenti

Re: Compression of random binary data

2017-10-29 Thread Ian Kelly
On Oct 28, 2017 5:53 PM, "Chris Angelico" wrote: > One bit. It might send the message, or it might NOT send the message. Not sending the message is equivalent to having a second possible message. -- https://mail.python.org/mailman/listinfo/python-list

Re: Compression of random binary data

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 2:08 PM, Gregory Ewing wrote: > Stefan Ram wrote: >> >> Well, then one can ask about the entropy of a data source >> that only is emitting this message. > > > You can, but it's still the *source* that has the entropy, > not the message. > > (And the answer in that case

Re: Compression of random binary data

2017-10-28 Thread Gregory Ewing
Steve D'Aprano wrote: I don't think that's right. The entropy of a single message is a well-defined quantity, formally called the self-information. https://en.wikipedia.org/wiki/Self-information True, but it still depends on knowing (or assuming) the probability of getting that particular me

Re: Compression of random binary data

2017-10-28 Thread Gregory Ewing
Stefan Ram wrote: Well, then one can ask about the entropy of a data source that only is emitting this message. You can, but it's still the *source* that has the entropy, not the message. (And the answer in that case is that the entropy is zero. If there's only one possible message you can

Re: Compression of random binary data

2017-10-28 Thread Chris Angelico
On Sun, Oct 29, 2017 at 1:32 PM, Chris Angelico wrote: > On Sun, Oct 29, 2017 at 1:18 PM, Gregory Ewing > wrote: >> You're missing something fundamental about what >> entropy is in information theory. >> >> It's meaningless to talk about the entropy of a single >> message. Entropy is a function o

  1   2   3   4   5   6   7   8   9   10   >