Re: neonumeric - C++ arbitrary precision arithmetic library

2021-03-07 Thread Christian Gollwitzer

Am 07.03.21 um 20:42 schrieb Peter J. Holzer:

The second part is converting a parse tree into code. I am quite sure
that it is possible to devise a formal language to specify the semantics
of any programming language and then to use this to generate the code.
However, I strongly suspect that such a language would be comparable in
expressiveness and ease of use to other programming languages - or in
other worlds it would be just another programming language. 


As far as I understand the idea, Leigh (aka Mr Flibble) thinks that he 
can create a "library" of code translators that translate the individual 
pieces of the parse tree into some intermediate code, and by specifying 
these codelets within the grammar the semantics of a language can be 
fully described.


My argument against this whole thing is that the library would be 
enormous. He seems to think that big chunks can be reused for different 
languages, but I don't believe this. A simple example:


int a = -3
unsigned int b = 5;

in C: a < b is false. This is insane but follows from the type casting 
rules in C.


in Python or any other language with sane integers, -3 < 5 will always 
be true. For large enough values you must convert them to big integers. 
CPython simply uses big integers for everything, but that obviously 
slows down the whole thing. If you want to compile that to fast machine 
code, you need to do the computation in fixed integers and check for 
overflow *after every single step*.


And there are myriads of differences. Introducing JavaScript again will 
bring myriads of differences and so on. The closest thing to such a 
project I can think of is LLVM. It still requires you to write the 
actual code generator, but features many intrinsics and libriaries that 
could be reused and therefore it is easy to add a new language. The 
approximate value of LLVM is estimated here:


  https://chriscummins.cc/2019/llvm-cost/

It's over 5000 man years of work. There is no way a single developer, 
regardless how brilliant he may be, can recreate this in his lifetime. 
Maybe focussed to a single language or two, but not "universal" in any 
sense.



Christian
--
https://mail.python.org/mailman/listinfo/python-list


[issue43332] Make http.client._tunnel send one byte string over the network

2021-03-07 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +23549
pull_request: https://github.com/python/cpython/pull/24783

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43332] Make http.client._tunnel send one byte string over the network

2021-03-07 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset c25910a135c2245accadb324b40dd6453015e056 by Gregory P. Smith in 
branch 'master':
bpo-43332: Buffer proxy connection setup packets before sending. (GH-24780)
https://github.com/python/cpython/commit/c25910a135c2245accadb324b40dd6453015e056


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: editor recommendations?

2021-03-07 Thread Cameron Simpson
On 03Mar2021 10:00, Lele Gaifax  wrote:
>Cameron Simpson  writes:
>> My fingers know vim. Some others' fingers know emacs.
>
>Emacs has also an Evil[1] mode, that mimics some vi/vim features.

Whenever I've tries emulate-vi modes they tend to lack some coner case 
known to my fingers.

[... Doom Emacs recommendation - I have no opinion ...]

>-- Emacs outshines all other editing software in approximately the same
>way that the noonday sun does the stars. It is not just bigger and
>brighter; it simply makes everything else vanish.  — Neal Stephenson

A novice of the temple once approached the Chief Priest with a question.

  "Master, does Emacs have the Buddha nature?" the novice asked.

  The Chief Priest had been in the temple for many years and could be relied
  upon to know these things.  He thought for several minutes before replying.

  "I don't see why not.  It's got bloody well everything else."

  With that, the Chief Priest went to lunch.  The novice suddenly achieved
enlightenment, several years later.

Commentary:

His Master is kind,
Answering his FAQ quickly,
With thought and sarcasm.

Cheers,
Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43431] Subprocess timeout causes output to be returned as bytes in text mode

2021-03-07 Thread Jordan Macdonald


New submission from Jordan Macdonald :

Passing the argument `text=True` to `subprocess.run()` is supposed to mean that 
any captured output of the called process is automatically decoded and retuned 
to the user as test instead of bytes.

However, if you give a timeout and that timeout expires, the raised 
`subprocess.TimeoutExpired` exception will have the captured output as as bytes 
even if text mode is enabled.

Test output:
bash-5.0$ python3 test_subprocess.py
Version and interpreter information: namespace(_multiarch='x86_64-linux-gnu', 
cache_tag='cpython-37', hexversion=50792432, name='cpython', 
version=sys.version_info(major=3, minor=7, micro=7, releaselevel='final', 
serial=0))
Completed STDOUT Type: 
Completed STDOUT Content: 'Start\nDone\n'
Timeout STDOUT Type: 
Timeout STDOUT Content: b'Start\n'

--
components: Library (Lib)
files: test_subprocess.py
messages: 388257
nosy: macdjord
priority: normal
severity: normal
status: open
title: Subprocess timeout causes output to be returned as bytes in text mode
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file49856/test_subprocess.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: How to implement logging for an imported module?

2021-03-07 Thread Pankaj Jangid
"Joseph L. Casale"  writes:

>> I couldn't find any information on how to implement logging in a
>> library that doesn't know the name of the application that uses
>> it. How is that done?

> Create (get) a root logger (you don't have to use it) and set the
> level, and attach a handler to it. Then get the logger your library
> uses and set the level to what you want.

So does that mean if we change the following code to get a logger
without any name then it will work? Without any further change.

>> logger = logging.getLogger('foo')
>> logger.addHandler(ch)
>> logger.setLevel(logging.DEBUG)

-- 
Regards,
Pankaj Jangid


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Choosable dependency

2021-03-07 Thread Grant Edwards
On 2021-03-07, Manfred Lotz  wrote:
> On Sat, 6 Mar 2021 15:40:41 - (UTC)
> Grant Edwards  wrote:
>
>> On 2021-03-06, Manfred Lotz  wrote:
>> > Let us say I have a package which reads a TOML file. 
>> >
>> > I want to give the user of my package the choice to decide if he
>> > wants to use the toml, tomlkit or rtoml package.   
>> 
>> Why would the user choose one over the other?  Does the user get
>> different functions/features depending on which one they choose?
>
> I am a user of my package and I like to use rtoml which however is not
> available on another OS (due to Rust no being available there) where I
> also want to use my package. Here I can use toml which is always
> possible to install. Therefore, toml is the default so that the ordinary
> user doesn't need to care.

I still don't understand why the user needs to choose. Why not just use 
whichever one is installed?

Import whichever one you prefer, and if that fails, import one of the
others, if that fails, import the third one.

--
Grant



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Choosable dependency

2021-03-07 Thread Dan Stromberg
I sometimes do things like:

try:
import rtoml as toml
except ImportError:
import toml

...but I don't like it very much, because it tends to confuse static
analyzers like pyflakes and pylint.  Maybe mypy will deal with it better?
Not sure yet.

On Sat, Mar 6, 2021 at 3:05 AM Manfred Lotz  wrote:

> Let us say I have a package which reads a TOML file.
>
> I want to give the user of my package the choice to decide if he wants
> to use the toml, tomlkit or rtoml package.
>
> So, in case the user chose to use rtoml then there should be an import
> only for rtoml, aso.
>
> How could I achieve this?
>
> --
> Thanks,
> Manfred
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31466] No easy way to change float formatting when subclassing encoder.JSONEncoder

2021-03-07 Thread Inada Naoki


Change by Inada Naoki :


--
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43420] Optimize rational arithmetics

2021-03-07 Thread Sergey B Kirpichev


Sergey B Kirpichev  added the comment:

On Sun, Mar 07, 2021 at 10:34:24PM +, Aaron Meurer wrote:
> I'm surprised to hear that the "typical use-case" of Fraction
> is fractions converted from floats.

For statistics module - that may be true.  Unfortunately, no
(other) practical applications, using Fraction's, were proposed by
my reviewers so far.

> By the way, the "algorithm" here really isn't that
> complicated. I didn't even realize it had a name.

Rather "algorithms"; everything is there in the II-nd volume of
the Knuth, section 4.5 - Rational Arithmetic.  Probably, this
is even a better reference, since it explains gcd==1 case
for addition.  Both, however, reference the Henrici article.

> It's far less complicated than, for example, Lehmer's gcd
> algorithm (which is implemented in math.gcd).

Or Karatsuba multiplication.

BTW, low-denominators performance may be restored (at least
partially), using same approach (like KARATSUBA_CUTOFF - but
checking the maximal denominator).  I don't like this idea, but...

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43332] Make http.client._tunnel send one byte string over the network

2021-03-07 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
versions: +Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43430] Exception raised when attempting to create Enum via functional API

2021-03-07 Thread Ethan Furman


Change by Ethan Furman :


--
assignee:  -> ethan.furman

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43430] Exception raised when attempting to create Enum via functional API

2021-03-07 Thread Suhail S.


Change by Suhail S. :


--
nosy: +barry, eli.bendersky, ethan.furman

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43430] Exception raised when attempting to create Enum via functional API

2021-03-07 Thread Suhail S.


New submission from Suhail S. :

It is possible to create custom Enum classes with a metaclass that is a subtype 
of EnumMeta. It is also possible to inherit from such an enumeration to create 
another enumeration. However, attempting to do so via the functional API raises 
an exception. See attached file that highlights minimal failing test case.

--
components: Library (Lib)
files: test.py
messages: 388255
nosy: suhailsingh247
priority: normal
severity: normal
status: open
title: Exception raised when attempting to create Enum via functional API
type: crash
versions: Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49855/test.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: python curses constant names for mouse wheel movements?

2021-03-07 Thread Alan Gauld via Python-list
On 07/03/2021 07:16, pjfarl...@earthlink.net wrote:

> Where can I find any documentation of the correct curses constant name(s) to
> use for detecting a "wheel down" action?  Or do I just have to manually
> define my own BUTTON5 constant name for the wheel-down event?

I suspect you need to look in the ncurses documentation or
even the C code. And that is no guarantee that the Python
curses module will expose any values you do find other
than as numeric codes.

I would have expected the mouse wheel down/click to appear as
a BUTTON2 event to be honest. I didn't even realize there was
a BUTTON4 event defined let alone BUTTON5.

Incidentally, when you talk about wheel up/down are you
talking about wheel rotation events rather than actual
button down/up events? In that case 4 and 5 might make sense.

If you find the answer please post back, I'm very interested
since I'm in the middle of writing a book on the Python curses
module and was unaware of this behaviour. A whole new area
to explore I'm also interested in any documentation you
have already found on it - where did you get this understanding?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43428] Sync importlib_metadata enhancements through 3.7.

2021-03-07 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
keywords: +patch
pull_requests: +23548
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24782

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: editor recommendations?

2021-03-07 Thread Russell
Dan Stromberg  wrote:
> On Tue, Mar 2, 2021 at 8:11 PM Dan Stromberg  wrote:
> 
>>
>> On Tue, Mar 2, 2021 at 8:00 PM Russell  wrote:
>>
>>> Ethan Furman  wrote:
>>> > I'm currently using vim, and the primary reason I've stuck with it for
>>> so long is because I can get truly black screens with it.  By which I mean
>>> that I have a colorful window title bar, a light-grey menu bar, and then a
>>> light-grey frame around the text-editing window (aka the only window), and
>>> a nice, black-background editing area.
>>>
>>> I use vim. It's actually extremely powerful, especially for text/code
>>> editing. I'd recommend reading one of the many books on using vim
>>> effectively. Also, plugins can really add a lot...
>>>
>>
>> On the subject of learning vim: There's an excellent vi cheat sheet
>> available on the internet.  I've put a copy of it at
>> https://stromberg.dnsalias.org/~strombrg/vi.ref.6
>>
>> vi is of course the predecessor of vim. But that cheat sheet is still
>> great for learning much of vim.
>>
> 
> I just ran across:  http://lib.ru/MAN/viref.txt
> ...which is pretty much the same thing, but converted to nice HTML.

To that end, vim also has extensive documentation built in. Just type
:help to get started. There's a pretty good tutorial accessible from the
main help screen. 

And I'll stop talking about vim in the Python group now, I promise. :)

-- 
rust
0x68caecc97f6a90122e51c0692c88d9cb6b58a3dc
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43379] Pasting multiple lines in the REPL is broken since 3.9

2021-03-07 Thread Ned Deily


Ned Deily  added the comment:

It certainly could be an issue with using GNU readline vs libedit and Terry is 
correct that you should follow up with Homebrew. But I don't think you stated 
from which code editor application you were copying from; that could also make 
a difference. In any case, good luck!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42600] Cancelling tasks waiting for asyncio.Conditions crashes w/ RuntimeError: Lock is not acquired.

2021-03-07 Thread Daniele Varrazzo


Daniele Varrazzo  added the comment:

I have stumbled in this bug, or something similar, implementing psycopg3 async 
connection pool. A function such as the following fails but only in Python 3.6 
(tested 3.6.12):

async def wait(self, timeout: float) -> AsyncConnection:
"""Wait for a connection to be set and return it.
Raise an exception if the wait times out or if fail() is called.
"""
async with self._cond:
if not (self.conn or self.error):
try:
await asyncio.wait_for(self._cond.wait(), timeout)
except asyncio.TimeoutError:
# HERE
self.error = PoolTimeout(
f"couldn't get a connection after {timeout} sec"
)

In python 3.6, printing self._cond.locked() in the HERE position gives False, 
even if it's inside the with block. Everything grinds to a halt afterwards.

However I don't have the same problem in other Python versions (3.7.10, 3.8.5 
among the ones tested) so I'm not sure it is the same issue.

Is this a manifestation of the same bug or a different one? Is there any 
workaround or should I make the async pool just not supported on Python 3.6?

--
nosy: +piro

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43429] mmap.size() raises OSError on Unix for anonymous memory

2021-03-07 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
pull_requests: +23547
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24781

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43429] mmap.size() raises OSError on Unix for anonymous memory

2021-03-07 Thread Zackery Spytz


New submission from Zackery Spytz :

For anonymous memory, mmap.size() works without issue on Windows, but it raises 
OSError on Unix.

--
components: Extension Modules
messages: 388252
nosy: ZackerySpytz
priority: normal
severity: normal
status: open
title: mmap.size() raises OSError on Unix for anonymous memory
type: behavior
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43379] Pasting multiple lines in the REPL is broken since 3.9

2021-03-07 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Thank you for retesting with the python.org installer.  Since this is Homebrew 
specific, please open an issue with them, with the updated debug information.

--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43428] Sync importlib_metadata enhancements through 3.7.

2021-03-07 Thread Jason R. Coombs


New submission from Jason R. Coombs :

importlib metadata has added a few important 
[changes](https://importlib-metadata.readthedocs.io/en/latest/history.html#v3-7-0)
 since the last sync in issue42382 (importlib_metadata 3.3):

- Performance enhancements to distribution discovery.
- `entry_points` only returns unique distributions.
- Introduces new ``EntryPoints`` object for containing a set of entry points 
with convenience methods for selecting entry points by group or name.
- Added packages_distributions function to return a mapping of packages to the 
distributions that provide them.

--
assignee: jaraco
components: Library (Lib)
messages: 388250
nosy: jaraco
priority: normal
severity: normal
status: open
title: Sync importlib_metadata enhancements through 3.7.
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



RE: Apriori Algorithm

2021-03-07 Thread Avi Gross via Python-list
Speaking for myself, that is a very significant piece of homework to do and
unless you do quite a bit and get stuck and ask for help in some aspect,
this is not the place to ask if anyone wishes to do all the work.

The assignment seems to want you to write your own code to implement the
algorithm. So unless the outlines of the algorithm were taught in class or a
textbook, you need to find the algorithm by searching the internet and you
may find places with more or less of a good description:

https://en.wikipedia.org/wiki/Apriori_algorithm

Once you find one you need to choose a language you are able to program in
from the list of choices and see what libraries of allowed components are
likely to be helpful so you do not have to start from nothing but the
basics. If you decide on JAVA or C++, this is not the forum to ask.

As I noted earlier, your data will need to be read in by any program and
made into whatever format your algorithm uses. What this is will be up to
you but note you have a collection of collections where you are told of two
very specific datasets that must be handled by the algorithm. So your
algorithm might be asked to just handle interest, or perhaps also character
strings and arbitrary items. You need to know what is expected so you design
your code to handle it. Given the nature of the data you show, it should not
use anything that holds a fixed number of items as the number of items per
line varies and presumably it should handle any number of such lines.

It looks like for a basic version they suggest a particular parameter be
included and they want an extended version that does more and another that
does even more.

Looks like a serious amount of work and way too detailed to expect anything
but this kind of answer. Many people get paid hundreds of dollars per hour
to do things like this and if you learn how, you could be one.

Presumably your class has taught you most of what is needed to understand
the assignment and how to find out more. I, like most others here, have not
been in the class or had any reason to think about this problem before. Any
voluntary role here is generally to help with questions about fairly
specific python code as compared to big projects.

Good luck!

-Original Message-
From: Python-list  On
Behalf Of sarang shah
Sent: Sunday, March 7, 2021 5:23 PM
To: python-list@python.org
Subject: Re: Apriori Algorithm

On Sunday, March 7, 2021 at 11:55:21 AM UTC-6, Avi Gross wrote:
> I apologize for my earlier snide remark as I was not then aware there 
> was an algorithm called apriori based on the Latin term and wondered 
> if someone was pulling someone's leg, in advance.
> 
> Someone has posted a pointer to Python code that is supposed to do 
> that. If that is suitable, then the serious task is to read what they say
and use it.
> I note the data you show below is ambiguous and not in the format that 
> code asks for.
> 
> Are you saying each line I see of what looks like integers is a 
> grouping you want to contrast to other such lines in the algorithm? I 
> doubt it can be used as is but needs to become some kind of data 
> structure such as a list of tuples or whatever the algorithm wants.
> -Original Message-
> From: Python-list  
> On Behalf Of dn via Python-list
> Sent: Sunday, March 7, 2021 3:09 AM
> To: pytho...@python.org
> Subject: Re: Apriori Algorithm
> 
> On 07/03/2021 20.56, sarang shah wrote:
> > I have this dataset in a text file I need to make an apriori 
> > algorithm
> based on it. Please help. 
> > 
> > 25 52 164 240 274 328 368 448 538 561 630 687 730 775 825 834
> > 39 120 124 205 401 581 704 814 825 834
> > 35 249 674 712 733 759 854 950
> > 39 422 449 704 825 857 895 937 954 964
> > 15 229 262 283 294 352 381 708 738 766 853 883 966 978
> > 26 104 143 320 569 620 798
> > 7 185 214 350 529 658 682 782 809 849 883 947 970 979
> > 227 390
> > 71 192 208 272 279 280 300 333 496 529 530 597 618 674 675 720 855 
> > 914 932
> 
> > 183 193 217 256 276 277 374 474 483 496 512 529 626 653 706 878 939
> > 161 175 177 424 490 571 597 623 766 795 853 910 960
> > 125 130 327 698 699 839
> > 392 461 569 801 862
> > 27 78 104 177 733 775 781 845 900 921 938
> > 101 147 229 350 411 461 572 579 657 675 778 803 842 903
> > 71 208 217 266 279 290 458 478 523 614 766 853 888 944 969
> > 43 70 176 204 227 334 369 480 513 703 708 835 874 895
> > 25 52 278 730
> > 151 432 504 830 890
> Great! 
> For what purpose - is this a 'homework assignment'? 
> What code do you have so far? 
> 
> --
> Regards,
> =dn
> --
> https://mail.python.org/mailman/listinfo/python-list




Yes. Each line is a group set. 

a.Pleaseimplement analgorithm of your choice (Apriori, or FP-Tree) tofind
frequent itemsets. You can importstandardlibraries/modules, but thealgorithm
should be written by yourself. Min-support should be a user input parameter.
Two sample of transaction datasets, Dataset1and Dataset2, are providedto
test if your program works correctly.You can 

[issue42382] No easy way to get the distribution which provided a importlib.metadata.EntryPoint

2021-03-07 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
versions: +Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42382] No easy way to get the distribution which provided a importlib.metadata.EntryPoint

2021-03-07 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Choosable dependency

2021-03-07 Thread Manfred Lotz
On Sat, 6 Mar 2021 15:40:41 - (UTC)
Grant Edwards  wrote:

> On 2021-03-06, Manfred Lotz  wrote:
> > Let us say I have a package which reads a TOML file. 
> >
> > I want to give the user of my package the choice to decide if he
> > wants to use the toml, tomlkit or rtoml package.   
> 
> Why would the user choose one over the other?  Does the user get
> different functions/features depending on which one they choose?
> 

I am a user of my package and I like to use rtoml which however is not
available on another OS (due to Rust no being available there) where I
also want to use my package. Here I can use toml which is always
possible to install. Therefore, toml is the default so that the ordinary
user doesn't need to care.


-- 
Manfred

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43406] Possible race condition between signal catching and signal.signal

2021-03-07 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
pull_requests: +23546
pull_request: https://github.com/python/cpython/pull/24755

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43420] Optimize rational arithmetics

2021-03-07 Thread Aaron Meurer


Aaron Meurer  added the comment:

I'm surprised to hear that the "typical use-case" of Fraction is fractions 
converted from floats. Do you have evidence in the wild to support that? 

I would expect any application that uses fractions "generically" to run into 
the same sorts of problems SymPy does. The issue is that the sum or product of 
two unrelated fractions has a denominator that is ~ the product of the 
denominators of each term. So they tend to grow large, unless there is some 
structure in the terms that results in lots of cancellation. That's why real 
world numeric typically doesn't use exact arithmetic, but there are legitimate 
use-cases for it (computer algebra being one).

This actually also applies even if the denominators are powers of 2. That's why 
arbitrary precision floating point numbers like Decimal or mpmath.mpf limit the 
precision, or effectively, the power of 2 in the denominator. 

By the way, the "algorithm" here really isn't that complicated. I didn't even 
realize it had a name. The idea is that for a/b * c/d, if a/b and c/d are 
already in lowest terms, then the only cancellation that can happen is from a/d 
or from c/b. So instead of computing gcd(a*c, b*d), we only compute gcd(a, d) 
and gcd(c, b) and cancel them off the corresponding terms. It turns out to be 
faster to take two gcds of smaller numbers than one gcd of big ones. The 
algorithm for addition is a bit more complicated, at least to see that it is 
correct, but is still not that bad (the paper linked in the OP explains it 
clearly in one paragraph). It's far less complicated than, for example, 
Lehmer's gcd algorithm (which is implemented in math.gcd).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Apriori Algorithm

2021-03-07 Thread sarang shah
On Sunday, March 7, 2021 at 11:55:21 AM UTC-6, Avi Gross wrote:
> I apologize for my earlier snide remark as I was not then aware there was an 
> algorithm called apriori based on the Latin term and wondered if someone was 
> pulling someone's leg, in advance. 
> 
> Someone has posted a pointer to Python code that is supposed to do that. If 
> that is suitable, then the serious task is to read what they say and use it. 
> I note the data you show below is ambiguous and not in the format that code 
> asks for. 
> 
> Are you saying each line I see of what looks like integers is a grouping you 
> want to contrast to other such lines in the algorithm? I doubt it can be 
> used as is but needs to become some kind of data structure such as a list of 
> tuples or whatever the algorithm wants.
> -Original Message- 
> From: Python-list  On
> Behalf Of dn via Python-list 
> Sent: Sunday, March 7, 2021 3:09 AM 
> To: pytho...@python.org 
> Subject: Re: Apriori Algorithm 
> 
> On 07/03/2021 20.56, sarang shah wrote:
> > I have this dataset in a text file I need to make an apriori algorithm 
> based on it. Please help. 
> > 
> > 25 52 164 240 274 328 368 448 538 561 630 687 730 775 825 834 
> > 39 120 124 205 401 581 704 814 825 834 
> > 35 249 674 712 733 759 854 950 
> > 39 422 449 704 825 857 895 937 954 964 
> > 15 229 262 283 294 352 381 708 738 766 853 883 966 978 
> > 26 104 143 320 569 620 798 
> > 7 185 214 350 529 658 682 782 809 849 883 947 970 979 
> > 227 390 
> > 71 192 208 272 279 280 300 333 496 529 530 597 618 674 675 720 855 914 932 
> 
> > 183 193 217 256 276 277 374 474 483 496 512 529 626 653 706 878 939 
> > 161 175 177 424 490 571 597 623 766 795 853 910 960 
> > 125 130 327 698 699 839 
> > 392 461 569 801 862 
> > 27 78 104 177 733 775 781 845 900 921 938 
> > 101 147 229 350 411 461 572 579 657 675 778 803 842 903 
> > 71 208 217 266 279 290 458 478 523 614 766 853 888 944 969 
> > 43 70 176 204 227 334 369 480 513 703 708 835 874 895 
> > 25 52 278 730 
> > 151 432 504 830 890
> Great! 
> For what purpose - is this a 'homework assignment'? 
> What code do you have so far? 
> 
> -- 
> Regards, 
> =dn
> -- 
> https://mail.python.org/mailman/listinfo/python-list




Yes. Each line is a group set. 

a.Pleaseimplement analgorithm of your choice (Apriori, or FP-Tree) tofind 
frequent itemsets. You can importstandardlibraries/modules, but thealgorithm 
should be written by yourself. Min-support should be a user input parameter. 
Two sample of transaction datasets, Dataset1and Dataset2, are providedto test 
if your program works correctly.You can usePython, Java or C++.

 b.  Extend your program to output all the maximal frequent itemsets and closed 
frequent itemsets. 
c.  Extend your program to output all the association rules. Min-Confidence 
should be a user input parameter. For all the association rules, output 
measures include support, confidence, lift, all-confidence and cosine.


-- 
https://mail.python.org/mailman/listinfo/python-list


RE: neonumeric - C++ arbitrary precision arithmetic library

2021-03-07 Thread Avi Gross via Python-list
The precedence example used below made a strange assumption that the
imaginary program would not be told up-front what computer language it was
being asked to convert from. That is not the scenario being discussed as we
have described. In any particular language, there usually is a well-known
precedence order such as "*" coming before "+" unless you use something like
parentheses to make your intent clear and over-ride it.

But it makes me think of a related question. Assume you are writing code in
a language like Python and the language has been analyzed and all kinds of
info stored that describes it and that includes things like precedence rules
for operators. Suppose it works fine and YOU want to break it. Could you?

If your language supports constructs like creating what looks like new infix
operators as an example, or overloading existing ones, could you write
expressions this mystical product would interpret differently than the
original compiler or interpreter?

As an example, what does this simple statement mean:

A + B

I mean A can be an integer or floating point number or character string but
can also be a complex number or a data.frame  or just about any arbitrary
object. So can B. And in many cases, the operation is not at all Abelian and
B+A is something else. In many cases, the logic is to look at the right-hand
or left-hand variable and see if it has a method defined to be called such
as __ADD__ or __RADD__  or maybe  inherited such a method from another class
perhaps using some specific method with complicated multiple inheritance
scenarios. Or the language may choose to convert either A or B or both to
some other format and perform some kind of addition and maybe convert the
result to something. Lots of work is in the Python interpreter to deal with
this and some of it has to be flexible enough to deal with times when a
class or object is changed as the program runs. Might it be possible to
create edge cases that break a static set of description files? If not, how
much more complex must the imaginary program get to handle these challenges
and what might that do to the purported gains in efficiency claimed?

I am currently studying a language called Kotlin. They, like some other
languages, allow the creation of new infix operators and once I have defined
"myplus" I can write code like:

A myplus B

What if it would also allow me to specify dynamically what the priority of
"myplus" is? Clearly it cannot be a reserved keyword in some table loaded in
the language in advance. R lets me do something similar like create
"%myplus%" as an operator and even weirder things like rebinding "+" to mean
something else that no longer has a particular priority that was
pre-ordained.

So if we had a contest on finding ways to break a sort of general purpose
customizable any-language mangler, I wonder if it might be easy to mangle it
at first. To get around that, you might have to not handle languages you
declare as misbehaving, or make a more complex system that handles all known
cases. But even then, can we design a new language for the express purpose
of exposing some hidden flaw and make them deal with that?

New languages keep popping up, some with no prior intent on breaking
anything, but I think a universal translator may not be imminent.

-Original Message-
From: Python-list  On
Behalf Of Peter J. Holzer
Sent: Sunday, March 7, 2021 2:43 PM
To: python-list@python.org
Subject: Re: neonumeric - C++ arbitrary precision arithmetic library

On 2021-03-06 23:41:10 +0100, Mirko via Python-list wrote:
> I even wonder why they have tried. Writing a universal 
> compiler/interpreter sounds logically impossible to me, Here's a 
> simple Python expression:
> 
> >>> 3+3*5
> 18
> 
> And here's the same expression in (GNU) Smalltalk:
> 
> st> 3+3*5
> 30
> 
> 
> How would such a universal compiler know which evaluation strategy to 
> follow, if not by writing a parser end evaluator for every supported 
> language?

That depends on what you mean by "writing". If we stick to your example, you
would need to specify in some way that in Python * has higher precedence
than +, while in Smalltalk it doesn't. You could write some code in Python
or Smalltalk or C or Assembler or even for a Turing machine to do that. Or
you can write the grammar in some formal language (e.g. BNF) and let the
compiler interpret that (or generate native code from it and run that). The
latter is what a "universal compiler" would do and parser generators have
been around for a long time (they were nothing new when I studied CS in the
1980's). While there is still progress here (I've come across a few
interesting papers over the last year or so), I'd say that part of the
problem is solved.

The second part is converting a parse tree into code. I am quite sure that
it is possible to devise a formal language to specify the semantics of any
programming language and then to use this to generate the code.
However, I strongly suspect that such 

RE: How to implement logging for an imported module?

2021-03-07 Thread Joseph L. Casale
> I couldn't find any information on how to implement logging in a library that
> doesn't know the name of the application that uses it. How is that done?

Hello,
That's not how it works, it is the opposite. You need to know the name of its 
logger,
and since you imported it, you do.

Logging is hierarchical, organized by dot separated names. However, all loggers
share the same root (top level) logger (a logger without any name, or in other 
words,
no hierarchical specificity). Loggers are singletons, all loggers share the 
same root
and each time you get a logger, if any code has previously asked for that 
logger by
name and therefore created it, you'll get that instance.

When you create a logger, it starts at level WARNING, which means only warnings
or higher are considered.

When you create a handler, it starts at level NOTSET, which means only level 0
and above are considered. Since NOTSET is 0, everything is considered by 
default.

Loggers pass messages that they are considering to all their handlers, which 
then
each filter again by the handlers own distinct level.

Don't add handlers in library code (except a null handler).

Do set a level on your library logger that you deem appropriate (INFO is likely
not appropriate).

Then, in your consuming code, if you instantiate a named logger, you won't see
messages that fall below the threshold of the library, and root defaults.

Create (get) a root logger (you don't have to use it) and set the level, and 
attach a
handler to it. Then get the logger your library uses and set the level to what 
you want.

Proceed with creating your own named logger and using that in your code, however
when the library emits a log message, it will traverse up, unfiltered and be 
passed to
a handler.

Think of the process like a tree data structure,  with the single root at the 
top, and
each immediate child being a named logger without additional specificity (no 
dot),
and each child of those taking the named plus one dot, followed by another name.

That helps when understanding the design behavior of propagation, and rather 
than
restate what is already well done, see 
https://docs.python.org/3/library/logging.html#logging.Logger.propagate. 

It does make a lot of sense, and it facilitates a concise and powerful ability 
to configure
an application where some messages can be ignored, written to different files, 
combined
into one, or some even emailed.

Last word of advice, don't fight it by hacking up or patching (somehow?), it 
will
simply not work right for any other case even slightly different than the one 
you
somehow beat into submission.

I hope that helps,
Joseph Casale

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: neonumeric - C++ arbitrary precision arithmetic library

2021-03-07 Thread Peter J. Holzer
On 2021-03-06 23:41:10 +0100, Mirko via Python-list wrote:
> I even wonder why they have tried. Writing a universal
> compiler/interpreter sounds logically impossible to me, Here's a
> simple Python expression:
> 
> >>> 3+3*5
> 18
> 
> And here's the same expression in (GNU) Smalltalk:
> 
> st> 3+3*5
> 30
> 
> 
> How would such a universal compiler know which evaluation strategy
> to follow, if not by writing a parser end evaluator for every
> supported language?

That depends on what you mean by "writing". If we stick to your example,
you would need to specify in some way that in Python * has higher
precedence than +, while in Smalltalk it doesn't. You could write some
code in Python or Smalltalk or C or Assembler or even for a Turing
machine to do that. Or you can write the grammar in some formal language
(e.g. BNF) and let the compiler interpret that (or generate native code
from it and run that). The latter is what a "universal compiler" would
do and parser generators have been around for a long time (they were
nothing new when I studied CS in the 1980's). While there is still
progress here (I've come across a few interesting papers over the last
year or so), I'd say that part of the problem is solved.

The second part is converting a parse tree into code. I am quite sure
that it is possible to devise a formal language to specify the semantics
of any programming language and then to use this to generate the code.
However, I strongly suspect that such a language would be comparable in
expressiveness and ease of use to other programming languages - or in
other worlds it would be just another programming language. Certainly
better suited to compiler construction (otherwise why would you use
it?), but probably not massively so (unlike writing a Yacc grammar is a
lot easier/quicker than writing a top-down parser), So there wouldn't be
a huge incentive to use it unless you plan to write compilers for lots
of languages. On the other hand there are downsides: Such a generic
system might be slow and/or memory-hungry, it might not run on every
platform, it might have a steep learning curve, and it's probably not so
well-suited for non-compiler programs.

> And if it's hard for this simple problem, how about more complex
> cases.

For this simple problem it's easy :-)

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43379] Pasting multiple lines in the REPL is broken since 3.9

2021-03-07 Thread Romain Vincent


Romain Vincent  added the comment:

The lack of dots was something I noticed.

So from your questions (Ned Deily) I have been testing out several things and 
found a "wae"!

But first, to answer your questions:

1. both LF and CRLF and it didn't change anything.

2. Running "import readline;print(readline.__doc__)" prints
"... GNU readline", with python 3.7, 3.8 and 3.9.

3. I am using iTerm2, but the problem also happens on MacOS's native 
Terminal.app. Versions of python were installed with **homebrew**.


Maybe worth to mention: if I paste my code in a multi line string to execute 
with python -c, then it works properly.

e.g.

---

python3.9 -i -c 'a = 42
if a:
  print("hello world")
'
hello world
>>>

---

The example is different because I realized I had the same problem on python3.7 
and python3.8 when the 2 first lines were at the same level of indentation 
(Note sure if this gives a hint as to what the problem is).



HOWEVER, if I use python versions directly downloaded from 
https://www.python.org/, then I don't have the problem at all!

Demonstration:

---
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7
Python 3.7.2 (v3.7.2:9a3ffc0492, Dec 24 2018, 02:44:43) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import readline;print(readline.__doc__)
Importing this module enables command line editing using libedit readline.
>>> a = 42
>>> if a:
...   print("hello world")
... 
hello world
>>> 

---

Same for python3.9

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43332] Make http.client._tunnel send one byte string over the network

2021-03-07 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
assignee:  -> gregory.p.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Please don't feed the trolls

2021-03-07 Thread Terry Reedy
Trolling, among other things, is fishing with a moving line, especially 
with a revolving lure, as from a moving boat.  A troll, among other 
things, is that method or the lure used.


On the internet, 'troll' is used metaphorically.  A troll is a flashy 
post designed to catch peoples emotions and hook them into responding. 
Trolling is posting such posts.  People do this either out of compulsion 
or for entertainment.


Quite separately, a troll in Scandinavian folklore is an unpleasant 
mythical creature living in a cave, or perhaps under or around a bridge. 
Bridge trolls are reputed to disrupt communication by travel.


Fishermen would not call a person trolling for fish a troll.  It would 
be an insult.  On the internet, we do call people trolling trolls, again 
methphorically, because they disrupt communication.


The proper response to trolls is to not feed them by responding as they 
wish.  When people respond, they continue trolling, and a moderator has 
to ban them.


People reading python-list posts on google groups or comp.lang.python 
should not help them evade their bans by quoting them.


On 3/6/2021 2:11 PM, Bonita Montero, responding to a banned troll for at 
least a third time:



Someone who says that he is capable of writing a compiler that
translates every language has megalomania. No one can do this.


We certainly need not believe so until it is done.

But we do not know whether X is an actual megalomaniac acting like a 
troll or an actual troll acting like a megalomaniac.  The same can apply 
to any other character type that can lead to trolling or be assumed as a 
pose by a troll.


In Spanish, bonito/a means a pretty male/female.  By coincidence, it is 
also a tuna-like fish caught by trolling.  (Decades ago, my father 
caught one on a boat one a Mexican river/lagoon.)  Please unhook 
yourself and swim away.



--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


[issue43332] Make http.client._tunnel send one byte string over the network

2021-03-07 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
keywords: +patch
pull_requests: +23545
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/24780

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Choosable dependency

2021-03-07 Thread Grant Edwards
On 2021-03-06, Manfred Lotz  wrote:
> Let us say I have a package which reads a TOML file. 
>
> I want to give the user of my package the choice to decide if he wants
> to use the toml, tomlkit or rtoml package. 

Why would the user choose one over the other?  Does the user get
different functions/features depending on which one they choose?

If you're just using a common subset to provide a fixed set of
features regardless, then just use whatever is installed.

--
Grant


-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43216] Removal of @asyncio.coroutine in Python 3.10

2021-03-07 Thread Mariusz Felisiak


Change by Mariusz Felisiak :


--
nosy: +felixxm

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24800] exec docs should note that the no argument form in a local scope is really the two argument form

2021-03-07 Thread Eryk Sun


Eryk Sun  added the comment:

So there are a couple things to clarify here. When the documentation says "if 
the optional parts are omitted, the code is executed in the current scope", I 
think it should explicitly state that this is equivalent to calling 
exec(object, globals(), locals()). This should help to disabuse the reader of 
any assumption that the compiled code will extend the nested scoping (i.e. 
lexical closures) of the calling context.

When it says that if "exec gets two separate objects as globals and locals, the 
code will be executed as if it were embedded in a class definition", I think 
this can be misleading. exec() compiles top-level code. It extends module-like 
execution, allowing globals and locals to differ and defaulting to the current 
scope. This sharply contrasts to code that's compiled for a `class` statement 
in the same context.

--
type: behavior -> enhancement
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.4, Python 3.5, Python 
3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29982] tempfile.TemporaryDirectory fails to delete itself

2021-03-07 Thread Guido van Rossum


Guido van Rossum  added the comment:

SGTM

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: How to implement logging for an imported module?

2021-03-07 Thread Dieter Maurer
Robert Latest wrote at 2021-3-7 10:21 GMT:
>I'm trying to add logging to a module that gets imported by another module. But
>I only get it to work right if the imported module knows the name of the
>importing module. The example given in the "Logging Cookbook" also rely on this
>fact.

I have used so called "monkey patching" to achieve something like this
(in fact "function call tracing").
"monkey patching" means code modification at runtime.

Suppose your application implements a logging decorator `log`.
Then on import, you can replace methods (easiest) or functions
with decorated variants either directly in the imported module/class
or for use by the importer.
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Apriori Algorithm

2021-03-07 Thread Avi Gross via Python-list
I apologize for my earlier snide remark as I was not then aware there was an
algorithm called apriori based on the Latin term and wondered if someone was
pulling someone's leg, in advance.

Someone has posted a pointer to Python code that is supposed to do that. If
that is suitable, then the serious task is to read what they say and use it.
I note the data you show below is ambiguous and not in the format that code
asks for.

Are you saying each line I see of what looks like integers is a grouping you
want to contrast to other such lines in the algorithm? I doubt it can be
used as is but needs to become some kind of data structure such as a list of
tuples or whatever the algorithm wants.

-Original Message-
From: Python-list  On
Behalf Of dn via Python-list
Sent: Sunday, March 7, 2021 3:09 AM
To: python-list@python.org
Subject: Re: Apriori Algorithm

On 07/03/2021 20.56, sarang shah wrote:
> I have this dataset in a text file I need to make an apriori algorithm
based on it. Please help.
> 
> 25 52 164 240 274 328 368 448 538 561 630 687 730 775 825 834 
> 39 120 124 205 401 581 704 814 825 834 
> 35 249 674 712 733 759 854 950 
> 39 422 449 704 825 857 895 937 954 964 
> 15 229 262 283 294 352 381 708 738 766 853 883 966 978 
> 26 104 143 320 569 620 798 
> 7 185 214 350 529 658 682 782 809 849 883 947 970 979 
> 227 390 
> 71 192 208 272 279 280 300 333 496 529 530 597 618 674 675 720 855 914 932

> 183 193 217 256 276 277 374 474 483 496 512 529 626 653 706 878 939 
> 161 175 177 424 490 571 597 623 766 795 853 910 960 
> 125 130 327 698 699 839 
> 392 461 569 801 862 
> 27 78 104 177 733 775 781 845 900 921 938 
> 101 147 229 350 411 461 572 579 657 675 778 803 842 903 
> 71 208 217 266 279 290 458 478 523 614 766 853 888 944 969 
> 43 70 176 204 227 334 369 480 513 703 708 835 874 895 
> 25 52 278 730 
> 151 432 504 830 890 


Great!
For what purpose - is this a 'homework assignment'?
What code do you have so far?

-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43422] Revert _decimal C API changes

2021-03-07 Thread hai shi


hai shi  added the comment:

+1 from me. 3.10.0 final haven't been released, so no one will be affected.

--
nosy: +shihai1991, vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22790] some class attributes missing from dir(Class)

2021-03-07 Thread Eryk Sun


Eryk Sun  added the comment:

>> Why are __flags__, __basicsize__, __itemsize__, 
>>__dictoffset__, and __weakrefoffset__ interesting?
>
> I haven't said they are, but on the other hand I don't see 
> why consistency is a bad thing.

IMO, they're not interesting because they're not documented attributes in 
Python's data model. They don't exist in other implementations, such as PyPy. 
So I'd prefer to hide them and, as much as possible, discourage developers from 
thinking it's okay to use them. They may be interesting attributes while 
developing extension modules that define new types, but anyone working at that 
level surely doesn't need the help of dir() to know what attributes are 
available.

--
components: +Interpreter Core -Documentation
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.4, Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43425] test_peg_generator.test_c_parser emits DeprecationWarning due to distutils

2021-03-07 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the clarification. As per issue41282 I thought disutils will be 
removed. The accepted PEP 632 states this scenario so I guess silencing the 
warning is good enough.

> The final dependency on distutils is CPython itself, which uses it to build 
> native extension modules in the standard library (except on Windows). Because 
> this is a CPython build-time dependency, it is possible to continue to use 
> distutils for this specific case without it being part of the standard 
> library.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43425] test_peg_generator.test_c_parser emits DeprecationWarning due to distutils

2021-03-07 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

We just need to suppress the warning unless I am missing somey. Distutils will 
still be used internally by CPython.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43427] Possible error on the descriptor howto guide

2021-03-07 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8304] time.strftime() and Unicode characters on Windows

2021-03-07 Thread Eryk Sun


Eryk Sun  added the comment:

Update since msg255133:

Python 3.8+ now calls setlocale(LC_CTYPE, "") at startup in Windows, as 3.x has 
always done in POSIX. So decoding the output of C strftime("%Z") with 
PyUnicode_DecodeLocaleAndSize() 'works' again, since both default to the 
process code page. The latter is usually the system code page, unless 
overridden to UTF-8 in the application manifest.

But calling C strftime() as a workaround is still a fragile solution, since it 
requires that the process code page is able to encode the process or thread UI 
language. In general, the system code page, the current user locale, and 
current user preferred language are independent settings in Windows. 

Calling C strftime() also unnecessarily limits the format string to characters 
in the current LC_CTYPE locale encoding, which requires hacky workarounds.

Starting with Windows 10 v2004 (build 19041), ucrt uses an internal 
wide-character version of the time-zone name that gets returned by an internal 
__wide_tzname() call and used for "%Z" in wcsftime(). The wide-character value 
gets updated by _tzset() and kept in sync with _tzname.

If Python switched to using wcsftime() in Windows 10 2004+, then the current 
locale encoding would no longer be a problem for any UI language. 

Also, bpo-36779 switched to setting time.tzname by directly calling WinAPI 
GetTimeZineInformation(). time.tzset() should be implemented in order to keep 
the value of time.tzname in sync with time.strftime("%Z").

--
components: +Extension Modules
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.4, Python 3.5, Python 
3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43427] Possible error on the descriptor howto guide

2021-03-07 Thread Marcos M


Marcos M  added the comment:

Let me provide a link to ease finding this piece of documentation

https://docs.python.org/3/howto/descriptor.html#static-methods

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43427] Possible error on the descriptor howto guide

2021-03-07 Thread Marcos M


New submission from Marcos M :

> To recap, functions have a __get__() method so that they can be converted to 
> a method when accessed as attributes. The non-data descriptor transforms an 
> obj.f(*args) call into f(obj, *args). Calling cls.f(*args) becomes f(*args).

I THINK it should say

cls.f(*args) becomes f(cls, *args)

as stated in the table that follows that paragraph.

--
assignee: docs@python
components: Documentation
messages: 388239
nosy: docs@python, marcosmodenesi
priority: normal
severity: normal
status: open
title: Possible error on the descriptor howto guide
type: enhancement
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



google text-to-speech python

2021-03-07 Thread tommy yama
Hi,

Anyone familiar with how to change speech pace with python script?

Thanks!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43216] Removal of @asyncio.coroutine in Python 3.10

2021-03-07 Thread Kamil Turek


Change by Kamil Turek :


--
nosy: +kamilturek

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43319] A possible misleading expression in the Virtual Environment Tutorial

2021-03-07 Thread Kamil Turek


Change by Kamil Turek :


--
nosy: +kamilturek

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10653] test_time test_strptime fails on windows

2021-03-07 Thread Eryk Sun


Eryk Sun  added the comment:

> decoding the output of strftime("%Z") with PyUnicode_DecodeLocaleAndSize()
> works again since both agree on using the process active code page

At least it works as much as it ever did. It depends on the process active code 
page being compatible with the preferred UI language of the current process or 
thread. For example if the UI language is Japanese ('ja-JP') for the current 
user, but the process active code page is Latin 1252 (based on the system 
locale), then the result will be garbage. In that case, given the time-zone 
name is in Japanese, both LC_TIME and LC_CTYPE have to be changed to "ja-JP" in 
order to correctly encode (as tzname in ucrt), decode-encode (for strftime in 
ucrt) and finally decode again via PyUnicode_DecodeLocaleAndSize(). If Python 
switched back to using wcsftime() in Windows 10 2004+, then the current locale 
encoding would no longer be a problem for any UI language.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10653] test_time test_strptime fails on windows

2021-03-07 Thread Eryk Sun


Eryk Sun  added the comment:

Update since msg243660: 

Python 3.8+ now calls setlocale(LC_CTYPE, "") at startup in Windows, as it has 
always done in POSIX, so decoding the output of strftime("%Z") with 
PyUnicode_DecodeLocaleAndSize() works again since both agree on using the 
process active code page. 

In 3.7+, per bpo-36779, time.tzname is set when the module is first loaded by 
directly querying GetTimeZoneInformation(). time.tzset() is still not 
supported, despite the fact that it was always supported by ucrt, so this value 
can become stale relative to strftime("%Z").

Starting with Windows 10 v2004 (build 19041), ucrt uses an internal 
wide-character version of the time-zone name that gets returned by an internal 
__wide_tzname() call and used for "%Z" in wcsftime(). The wide-character value 
gets updated by _tzset() and kept in sync with _tzname.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43420] Optimize rational arithmetics

2021-03-07 Thread Mark Dickinson


Mark Dickinson  added the comment:

> There is one exception I've found: stdlib's statistics module uses
> Fraction's in the _sum() helper, exactly in a paradigm "sum a lot
> of values".

That's an interesting example: it does indeed satisfy the "sum of a lot of 
values" part, but not the "incompatible denominators" part. :-) The typical use 
there is that those fractions have been converted from floats, and so all 
denominators will be a smallish power of two. So we don't encounter the same 
coefficient explosion problem that we do when summing fractions with unrelated 
denominators. I have many similar use-cases in my own code, where numerators 
and denominators don't tend to ever get beyond a few hundred digits, and 
usually not more than tens of digits.

Thanks for the timings! So assuming that wasn't a specially-chosen best case 
example, the crossover is somewhere around numerators and denominators of ten 
digits or so.

> It's not going to be complicated so much

For me, the big difference is that the current code is obviously correct at a 
glance, while the proposed code takes study and thought to make sure that no 
corner cases are missed.

Shrug. Put me down as -0.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43420] Optimize rational arithmetics

2021-03-07 Thread Sergey B Kirpichev


Sergey B Kirpichev  added the comment:

> I'd prefer to keep the code simplicity

It's not going to be complicated so much and algorithms are well known,
but I see your point.

> and the speed for small inputs here

Speed loss is not so big, 10-20%.

> Python's needs aren't the same as SymPy's needs or SAGE's needs

So, for which needs it will serve?

Sorry, I can't suggest an application, which does use builtin
Fraction's (not sure if even SAGE uses them, as a fallback).  SymPy doesn't,
for sure (but it could - it's PythonRational class uses same optimizations,
except for g == 1 branches in _add/_sub, I think).

There is one exception I've found: stdlib's statistics module uses Fraction's
in the _sum() helper, exactly in a paradigm "sum a lot of values".

> not all of the fractions.Fraction use-cases involve summing lots of values 
> with incompatible denominators.

No need for a lots of values (i.e. 1000): denominator of the sum will grow very 
fast, that
why modern CAS use modular GCD algorithms, for example.

> Could you give some idea of the crossover point for a single addition?

$ ./python -m timeit -r11 -s 'from fractions import Fraction as F' -s 
'a=F(10,31011021112)' -s 'b=F(86,11011021115)' 'a + b'
2 loops, best of 11: 12.4 usec per loop
$ ./python -m timeit -r11 -s 'from patched import Fraction as F' -s 
'a=F(10,31011021112)' -s 'b=F(86,11011021115)' 'a + b'
2 loops, best of 11: 12.5 usec per loop

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



python curses constant names for mouse wheel movements?

2021-03-07 Thread pjfarley3
I have a python curses project trying to detect mouse wheel movements, and I
understand that mouse wheel events by convention are reported as BUTTON4 and
BUTTON5 events.

I am running on a Win10 system with python 3.8.7 and windows-curses 2.2.0,
which I am given to understand uses the gohlke PDCurses wheels for the
underlying curses implementation.

I can display the values of all of the BUTTON1 to BUTTON4 event constants
but python 3.8.7 barfs if I try to use any BUTTON5 event names.  It also
does not recognize the BUTTONn_RESERVED_EVENT names for buttons 1-4.

print(   "B1={:08x},{:08x},{:08x},{:08x},{:08x}\n".format(
curses.BUTTON1_RELEASED, curses.BUTTON1_PRESSED,
curses.BUTTON1_CLICKED, 
curses.BUTTON1_DOUBLE_CLICKED,
curses.BUTTON1_TRIPLE_CLICKED) + \
"B2={:08x},{:08x},{:08x},{:08x},{:08x}\n".format(
curses.BUTTON2_RELEASED, curses.BUTTON2_PRESSED,
curses.BUTTON2_CLICKED, 
curses.BUTTON2_DOUBLE_CLICKED,
curses.BUTTON2_TRIPLE_CLICKED) + \
"B3={:08x},{:08x},{:08x},{:08x},{:08x}\n".format(
curses.BUTTON3_RELEASED, curses.BUTTON3_PRESSED,
curses.BUTTON3_CLICKED, 
curses.BUTTON3_DOUBLE_CLICKED,
curses.BUTTON3_TRIPLE_CLICKED) + \
"B4={:08x},{:08x},{:08x},{:08x},{:08x}\n".format(
curses.BUTTON4_RELEASED, curses.BUTTON4_PRESSED,
curses.BUTTON4_CLICKED, 
curses.BUTTON4_DOUBLE_CLICKED,
curses.BUTTON4_TRIPLE_CLICKED) + \
"S/C/A={:08x},{:08x},{:08x}".format(
curses.BUTTON_SHIFT, curses.BUTTON_CTRL,
curses.BUTTON_ALT))

yields this output:

B1=0001,0002,0004,0008,0010
B2=0020,0040,0080,0100,0200
B3=0400,0800,1000,2000,4000
B4=8000,0001,0002,0004,0008
S/C/A=0400,0800,1000

Any attempt to use a BUTTON5 constant name or BUTTONn_RESERVED_EVENT
constant name fails:

Python 3.8.7 (tags/v3.8.7:6503f05, Dec 21 2020, 17:59:51) [MSC v.1928 64 bit
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import curses
>>> print("B5={:08x}".format(curses.BUTTON5_RELEASED))
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: module 'curses' has no attribute 'BUTTON5_RELEASED'
>>> print("B5={:08x}".format(curses.BUTTON1_RESERVED_EVENT))
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: module 'curses' has no attribute 'BUTTON1_RESERVED_EVENT'

When I actually capture mouse wheel events, the wheel-up event is reported
as 0x0001 or BUTTON4_PRESSED, but the wheel-down event is reported as 0x
0020, which has no constant name associated with it for which I can find
any documentation.

This is a logging trace if curses.get_wch() and curses.getkey() results and
the curses.getmouse() results when KEY_MOUSE is returned.  I have manually
annotated the getmouse display lines indicating what mouse action I actually
performed.

DEBUG:root:wch='539' = 0x021b at (0,0)
DEBUG:root:3ch='KEY_MOUSE at (0,0)'
DEBUG:root:3ch KEY_MOUSE detected at (0,0)
DEBUG:root:Mouse data id=0, x=60, y=31, z=0, bs=0004
Button 1 click
DEBUG:root:wch='539' = 0x021b at (0,0)
DEBUG:root:3ch='KEY_MOUSE at (0,0)'
DEBUG:root:3ch KEY_MOUSE detected at (0,0)
DEBUG:root:Mouse data id=0, x=-1, y=-1, z=0, bs=0001
wheel up once
DEBUG:root:wch='539' = 0x021b at (0,0)
DEBUG:root:3ch='KEY_MOUSE at (0,0)'
DEBUG:root:3ch KEY_MOUSE detected at (0,0)
DEBUG:root:Mouse data id=0, x=-1, y=-1, z=0, bs=0020
wheel down once
DEBUG:root:wch='539' = 0x021b at (0,0)
DEBUG:root:3ch='KEY_MOUSE at (0,0)'
DEBUG:root:3ch KEY_MOUSE detected at (0,0)
DEBUG:root:Mouse data id=0, x=-1, y=-1, z=0, bs=0001
wheel up once
DEBUG:root:wch='539' = 0x021b at (0,0)
DEBUG:root:3ch='KEY_MOUSE at (0,0)'
DEBUG:root:3ch KEY_MOUSE detected at (0,0)
DEBUG:root:Mouse data id=0, x=-1, y=-1, z=0, bs=0020
wheel down once

Where can I find any documentation of the correct curses constant name(s) to
use for detecting a "wheel down" action?  Or do I just have to manually
define my own BUTTON5 constant name for the wheel-down event?

TIA for any help or RTFM you can provide.

Peter


-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43060] Convert _decimal C API from pointer array to struct

2021-03-07 Thread Mark Dickinson


Mark Dickinson  added the comment:

Just a note that #43422 would make this moot.

--
nosy: +mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41324] Add a minimal decimal capsule API

2021-03-07 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

@mattip, see issue43422

--
assignee: skrah -> 

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43420] Optimize rational arithmetics

2021-03-07 Thread Mark Dickinson


Mark Dickinson  added the comment:

Personally, I'd prefer to keep the code simplicity, and the speed for small 
inputs here. Python's needs aren't the same as SymPy's needs or SAGE's needs, 
and not all of the fractions.Fraction use-cases involve summing lots of values 
with incompatible denominators.

> With big denominators (~10**6) this really does matter, my local
> benchmarks suggest the order of magnitude difference for
> summation of several such numbers.

Could you give some idea of the crossover point for a single addition? At 
roughly what size numerator/denominator do we start seeing a performance 
benefit?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



How to implement logging for an imported module?

2021-03-07 Thread Robert Latest via Python-list
Hello,

I'm trying to add logging to a module that gets imported by another module. But
I only get it to work right if the imported module knows the name of the
importing module. The example given in the "Logging Cookbook" also rely on this
fact.

https://docs.python.org/3/howto/logging-cookbook.html#logging-cookbook

I couldn't find any information on how to implement logging in a library that
doesn't know the name of the application that uses it. How is that done?

Here's some example code consisting of the main module foo.py and imported
modules bar.py and baz.py


### foo.py
import logging

import bar, baz

formatter = logging.Formatter(
'%(asctime)s - %(name)s - %(levelname)s - %(message)s')

ch = logging.StreamHandler()
ch.setFormatter(formatter)

logger = logging.getLogger('foo')
logger.addHandler(ch)
logger.setLevel(logging.DEBUG)

logger.debug('debug from <%s>', __name__)
logger.info('info from <%s>', __name__)
logger.warning('warning from <%s>', __name__)
logger.error('error from <%s>', __name__)

bar.func()
baz.func()

### bar.py
'''This "generic" approach doesn't honor loglevel or formats
when imported by another module'''
import logging

l = logging.getLogger(__name__)
def func():
l.debug('debug from <%s>', __name__)
l.info('info from <%s>', __name__)
l.warning('warning from <%s>', __name__)
l.error('error from <%s>', __name__)

### baz.py
'''This only works if the importing module is named 'foo', which
precludes its use as a library module'''
import logging

l = logging.getLogger('foo.baz')
def func():
l.debug('debug from <%s>', __name__)
l.info('info from <%s>', __name__)
l.warning('warning from <%s>', __name__)
l.error('error from <%s>', __name__)

-- 
https://mail.python.org/mailman/listinfo/python-list


A 35mm film camera represented in Python object

2021-03-07 Thread D.M. Procida
Hi everyone, I've created  -
a representation of a Canonet G-III QL17 in Python.

There's also documentation: .

It's a pure Python model of the physical sub-systems of a camera and
their interactions. So far it's at a fairly high level - I haven't yet
got down to the level of individual springs and levers yet.

I spend quite a bit of my time repairing old cameras. To me they feel
like computer programs encoded into physical objects, and figuring out
how a mechanism works feels like working out how code works (but more
fun).

The Canonet G-III QL17 is one of my favourites. One of my reasons for
writing this code is to appreciate the intricate mechanical logic
embodied in the machine.

You can do things like advance the film, release the shutter, meter the
scene with the built-in light meter (if the camera has a battery of
course) and even spoil your film if you make the mistake of opening the
back in daylight.

>>> from camera import Camera
>>> c = Camera()

>>> c.state()
== Camera state =

-- Controls -
Selected speed:1/120

-- Mechanical ---
Back closed:   True
Lens cap on:   False
Film advance mechanism:False
Frame counter: 0
Shutter cocked:False
Shutter timer: 1/128 seconds
Iris aperture: ƒ/16
Camera exposure settings:  15.0 EV

-- Metering -
Light meter reading:4096 cd/m^2
Exposure target:15.0 EV
Mode:   Shutter priority
Battery:1.44 V
Film speed: 100 ISO

-- Film -
Speed:  100 ISO
Rewound into cartridge: False
Exposed frames: 0 (of 24)
Ruined: False

-- Environment --
Scene luminosity:   4096 cd/m^2

>>> c.film_advance_mechanism.advance()
Cocking shutter
Cocked

>>> c.shutter.trip()
Shutter opens
Shutter closes
Shutter opened for 1/128 seconds
Shutter uncocked

You can't do impossible things:

>>> c.shutter_speed = 1/33
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/daniele/Repositories/camera/camera.py", line 29, in 
shutter_speed
raise self.NonExistentShutterSpeed(f"Possible shutter speeds are
  {possible_settings}")
camera.NonExistentShutterSpeed: Possible shutter speeds are 1/4, 
  1/8, 1/15, 1/30, 1/60, 1/120, 1/240, 1/500

But you can also do things that you shouldn't do, like opening the back
of the camera in daylight with a partially-exposed roll of film inside -
which will spoil the film::

>>> c.back.open()
Opening back
Resetting frame counter to 0
'Film is ruined'

I hope this interesting to someone.

Daniele
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43422] Revert _decimal C API changes

2021-03-07 Thread Mark Dickinson


Mark Dickinson  added the comment:

+1 for reverting these before 3.10. See also @mattip's comments on #41324, and 
#43060.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41369] Update to libmpdec-2.5.1

2021-03-07 Thread Mark Dickinson


Mark Dickinson  added the comment:

Sounds fine to me. If I'm understanding right, what we have in master right now 
is somewhere between libmpdec 2.5.0 and libmpdec 2.5.1; is that right? If so, 
it definitely makes sense to update to 2.5.1.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43372] ctypes: test_frozentable fails when make regen-frozen

2021-03-07 Thread Miro Hrončok

Miro Hrončok  added the comment:

Thanks for the fixer!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1814] Victor Stinner's GMP patch for longs

2021-03-07 Thread Sergey B Kirpichev


Change by Sergey B Kirpichev :


--
nosy: +Sergey.Kirpichev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21922] PyLong: use GMP

2021-03-07 Thread Sergey B Kirpichev


Change by Sergey B Kirpichev :


--
nosy: +Sergey.Kirpichev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43319] A possible misleading expression in the Virtual Environment Tutorial

2021-03-07 Thread miss-islington


miss-islington  added the comment:


New changeset 8d00462850b32da4649c3403692ed5515e6a96d1 by cmhzc in branch 
'master':
bpo-43319: Fixed the tutorial on venv about standard library (GH-24740)
https://github.com/python/cpython/commit/8d00462850b32da4649c3403692ed5515e6a96d1


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Apriori Algorithm

2021-03-07 Thread dn via Python-list
On 07/03/2021 20.56, sarang shah wrote:
> I have this dataset in a text file I need to make an apriori algorithm based 
> on it. Please help.
> 
> 25 52 164 240 274 328 368 448 538 561 630 687 730 775 825 834 
> 39 120 124 205 401 581 704 814 825 834 
> 35 249 674 712 733 759 854 950 
> 39 422 449 704 825 857 895 937 954 964 
> 15 229 262 283 294 352 381 708 738 766 853 883 966 978 
> 26 104 143 320 569 620 798 
> 7 185 214 350 529 658 682 782 809 849 883 947 970 979 
> 227 390 
> 71 192 208 272 279 280 300 333 496 529 530 597 618 674 675 720 855 914 932 
> 183 193 217 256 276 277 374 474 483 496 512 529 626 653 706 878 939 
> 161 175 177 424 490 571 597 623 766 795 853 910 960 
> 125 130 327 698 699 839 
> 392 461 569 801 862 
> 27 78 104 177 733 775 781 845 900 921 938 
> 101 147 229 350 411 461 572 579 657 675 778 803 842 903 
> 71 208 217 266 279 290 458 478 523 614 766 853 888 944 969 
> 43 70 176 204 227 334 369 480 513 703 708 835 874 895 
> 25 52 278 730 
> 151 432 504 830 890 


Great!
For what purpose - is this a 'homework assignment'?
What code do you have so far?

-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list


Apriori Algorithm

2021-03-07 Thread sarang shah
I have this dataset in a text file I need to make an apriori algorithm based on 
it. Please help.

25 52 164 240 274 328 368 448 538 561 630 687 730 775 825 834 
39 120 124 205 401 581 704 814 825 834 
35 249 674 712 733 759 854 950 
39 422 449 704 825 857 895 937 954 964 
15 229 262 283 294 352 381 708 738 766 853 883 966 978 
26 104 143 320 569 620 798 
7 185 214 350 529 658 682 782 809 849 883 947 970 979 
227 390 
71 192 208 272 279 280 300 333 496 529 530 597 618 674 675 720 855 914 932 
183 193 217 256 276 277 374 474 483 496 512 529 626 653 706 878 939 
161 175 177 424 490 571 597 623 766 795 853 910 960 
125 130 327 698 699 839 
392 461 569 801 862 
27 78 104 177 733 775 781 845 900 921 938 
101 147 229 350 411 461 572 579 657 675 778 803 842 903 
71 208 217 266 279 290 458 478 523 614 766 853 888 944 969 
43 70 176 204 227 334 369 480 513 703 708 835 874 895 
25 52 278 730 
151 432 504 830 890 
-- 
https://mail.python.org/mailman/listinfo/python-list