[issue35655] documentation have wrong info about fibo module examples
New submission from Juan : The below sections in modules documentation have wrong information about fibo module: 6. Modules 6.1. More on Modules 6.1.1. Executing modules as scripts 6.3. The dir() Function The name of module is Fibo not fibo and the attributes are fab,fab2 not fib,fib2. root@archlinux ~]# python2 --version Python 2.7.15 [root@archlinux ~]# pip2 --version pip 18.1 from /usr/lib/python2.7/site-packages/pip (python 2.7) [root@archlinux ~]# pip2 install fibo Collecting fibo Using cached https://files.pythonhosted.org/packages/24/50/e74bd48bbef1040afb01b107e6cfbc3c1e991be24c10c40a37e335383e54/Fibo-1.0.0.tar.gz Installing collected packages: fibo Running setup.py install for fibo ... done Successfully installed fibo-1.0.0 [root@archlinux ~]# pip2 list modules |grep -i fibo Fibo 1.0.0 [root@archlinux ~]# python2 Python 2.7.15 (default, Jun 27 2018, 13:05:28) [GCC 8.1.1 20180531] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import fibo Traceback (most recent call last): File "", line 1, in ImportError: No module named fibo >>> import Fibo >>> Fibo.fib(10) Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'fib' >>> Fibo.fib2(10) Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'fib2' >>> Fibo.fab(10) 1 1 2 3 5 8 13 21 34 55 >>> Fibo.fab2(10) [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] >>> Fibo.__name__ 'Fibo' >>> dir(Fibo) ['Fab', '__builtins__', '__doc__', '__file__', '__name__', '__package__', 'fab', 'fab2', 'fab4'] -- assignee: docs@python components: Documentation messages: 332967 nosy: docs@python, eric.araujo, ezio.melotti, juanbaio10, mdk, willingc priority: normal severity: normal status: open title: documentation have wrong info about fibo module examples type: enhancement versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue35655> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29616] input() after restarting causes bug
New submission from Juan: This bug can be recreated by opening a file whose content is "input()" with IDLE, press F5 and the shell opens as expected. Without making the input in the shell stop, press F5 in the script again. In Python 3.5 IDLE only take input until another F5 (or Ctrl+F6) in the script. In Python 3.6 IDLE only take input until an Enter is pressed or another F5 (or Ctrl+F6) in the script. -- assignee: terry.reedy components: IDLE messages: 288324 nosy: Juan, terry.reedy priority: normal severity: normal status: open title: input() after restarting causes bug type: behavior versions: Python 3.5, Python 3.6 ___ Python tracker <http://bugs.python.org/issue29616> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29616] input() after restarting causes bug
Juan added the comment: What I meant was: 1. Open a file whose content is "input()" with IDLE 2. F5 3. Type something but without pressing Enter. 4. Come back to the script (with input() still responding to keystrokes on the input line) 5. F5 6. Bug. (Results vary even on the same machine by closing and opening Python again, sometimes whatever you pressed in step 3 disappears, sometimes it just takes input, doesn't respond to commands similar (not equal) to "while(1): pass") -- status: pending -> open ___ Python tracker <http://bugs.python.org/issue29616> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29616] input() after restarting causes bug
Juan added the comment: *doesn't respond to commands. I mean something similar to (not equal) "while(1): pass") -- ___ Python tracker <http://bugs.python.org/issue29616> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29616] input() after restarting causes bug
Juan added the comment: I am using Windows 10 64-bit. >> sometimes whatever you pressed in step 3 disappears, > > When Shell is restarted by whatever means, any pending input, whether in > response to '>>>' or user input(), is cancelled and > *should* disappear and not be left to look as if it were processed. It > consistently does for me. It doesn't for me. > > doesn't respond to commands > > When a user-coded input() is active, anything typed *should* be treated as > text and not interpreted as a command. Even before enters? At the comments of http://inventwithpython.com/blog/2011/11/29/the-things-i-hate-about-idle-that-i-wish-someone-would-fix/ I found someone having the same problem as me, MrValdez () This is a relevant part of his comment: > ANNOYANCE: input() doesn't play well when re-running a script when the script > is already running. > > Here's a use case. A student types this program in IDLE: > > -- > > x = input("Typ a word:") > print (x) > > -- > > They run the code. In the shell window, the student would notice the > mispelling. Without exiting the shell window, > they would go edit the code and then press F5. > > The shell would still be running the previous code instead of restarting. > > In some of my exercises, the students would sometimes think their code are > broken when in reality, they already > got the solution. They were just running the older instance. > > This becomes common enough that I ask my students to exit the shell window > before running their scripts. -- ___ Python tracker <http://bugs.python.org/issue29616> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12492] Inconsistent Python find() behavior
New submission from Juan Gonzalez : Something really weird going on in python find() string function. When I call .find() and python returns -1 it crashes when compared against 0 using the ">" operator. The statement in which crash condition occurs is the following: if url.find(str) > 0: print "RSS Item:", url break; However, if I change the statement to be "<" instead it does not crash. The error that the python compiler reports is: AttributeError: 'int' object has no attribute 'find' My version of python is: tony@ubuntu:~/auto/sel/scripts$ python -V Python 2.7.1+ -- components: Regular Expressions messages: 139810 nosy: juan.gonzalez priority: normal severity: normal status: open title: Inconsistent Python find() behavior type: crash versions: Python 2.7 ___ Python tracker <http://bugs.python.org/issue12492> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12492] Inconsistent Python find() behavior
Juan Gonzalez added the comment: Today I tried to use parse() instead of find() and I found out the following response: tony@ubuntu:~/auto/sel/scripts$ python wtfibmdom Traceback (most recent call last): File "wtfibmdom", line 22, in if url.parse(str) > 0: AttributeError: 'str' object has no attribute 'parse' tony@ubuntu:~/auto/sel/scripts$ python wtfibmdom Title: j3-dcsled-prd-validation passed Fri, 01 Jul 2011 14:03:59 -0500 Description: Build passed Traceback (most recent call last): File "wtfibmdom", line 22, in if url.find(str) > 0: AttributeError: 'int' object has no attribute 'find' I think this behavior is inconsistent since the compiler is treating the url variable as int and string at the same time. -- status: pending -> open ___ Python tracker <http://bugs.python.org/issue12492> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12492] Inconsistent Python find() behavior
Juan Gonzalez added the comment: Hi Georg, This is the python code listing: from RSS import ns, CollectionChannel, TrackingChannel #Create a tracking channel, which is a data structure that #Indexes RSS data by item URL tc = TrackingChannel() str = 'j3-nspire-prd-validation' index = 0 #Returns the RSSParser instance used, which can usually be ignored #tc.parse("http://www.python.org/channews.rdf";) tc.parse("http://pdt-california.eps.ti.com:8080/dashboard/rss.xml";) RSS10_TITLE = (ns.rss10, 'title') RSS10_DESC = (ns.rss10, 'description') #You can also use tc.keys() items = tc.listItems() for item in items: #Each item is a (url, order_index) tuple url = item[index] #print "RSS Item:", #str.find(str, beg=0 end=len(string)) if url.find(str) > 0: print "RSS Item:", url break; #Get all the data for the item as a Python dictionary index = index + 1 item_data = tc.getItem(item) print "Title:", item_data.get(RSS10_TITLE, "(none)") print "Description:", item_data.get(RSS10_DESC, "(none)") -- ___ Python tracker <http://bugs.python.org/issue12492> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12492] Inconsistent Python find() behavior
Juan Gonzalez added the comment: I print 1 before the faulty line and like Jesús says I'm surprised I get a 1 Description: Build passed 1 Traceback (most recent call last): File "wtfibmdom", line 23, in if url.find(str) > 0: AttributeError: 'int' object has no attribute 'find' -- ___ Python tracker <http://bugs.python.org/issue12492> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3821] trace module bug when using --missing
New submission from Juan Javier <[EMAIL PROTECTED]>: I get the following exception: $ /opt/python3.0b2/bin/python3.0 -m trace -c -m run.py Traceback (most recent call last): File "/opt/python3.0b2/lib/python3.0/runpy.py", line 121, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/opt/python3.0b2/lib/python3.0/runpy.py", line 34, in _run_code exec(code, run_globals) File "/opt/python3.0b2/lib/python3.0/trace.py", line 809, in main() File "/opt/python3.0b2/lib/python3.0/trace.py", line 806, in main results.write_results(missing, summary=summary, coverdir=coverdir) File "/opt/python3.0b2/lib/python3.0/trace.py", line 303, in write_results lnotab = find_executable_linenos(filename) File "/opt/python3.0b2/lib/python3.0/trace.py", line 428, in find_executable_linenos return find_lines(code, strs) File "/opt/python3.0b2/lib/python3.0/trace.py", line 392, in find_lines linenos.update(find_lines(c, strs)) File "/opt/python3.0b2/lib/python3.0/trace.py", line 386, in find_lines linenos = find_lines_from_code(code, strs) File "/opt/python3.0b2/lib/python3.0/trace.py", line 370, in find_lines_from_code line_increments = [ord(c) for c in code.co_lnotab[1::2]] File "/opt/python3.0b2/lib/python3.0/trace.py", line 370, in line_increments = [ord(c) for c in code.co_lnotab[1::2]] TypeError: ord() expected string of length 1, but int found I think that line 370 of trace.py should say: line_increments = [int(c) for c in code.co_lnotab[1::2]] instead of: line_increments = [ord(c) for c in code.co_lnotab[1::2]] -- components: Library (Lib) messages: 72879 nosy: jjdominguezm severity: normal status: open title: trace module bug when using --missing versions: Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3821> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38052] Include sspipe Module with Core Python
New submission from Juan Telleria : Could sspipe be included as a Core Python module? https://sspipe.github.io/ https://github.com/sspipe/sspipe https://pypi.org/project/sspipe/ sspipe allows to use syntax such as: from sspipe import p, px import numpy as np import pandas as pd ( np.linspace(0, pi, 100) | p({'x': px, 'y': np.sin(px)}) | p(pd.DataFrame) | px[px.x > px.y].head() | p(print, "Example 6: pandas and numpy support:\n", px) ) -- components: Extension Modules messages: 351307 nosy: Juan Telleria2 priority: normal severity: normal status: open title: Include sspipe Module with Core Python versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue38052> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38052] Include sspipe Module with Core Python
Change by Juan Telleria : -- type: -> enhancement ___ Python tracker <https://bugs.python.org/issue38052> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38052] Include sspipe Module with Core Python
Juan Telleria added the comment: There was a positive response from package mantainers for this issue :) See: https://github.com/sspipe/sspipe/issues/4 >> is the module mature and stable? I am using this module in my own projects for a while and it satisfies my own requirements. However, I think if we want to propose it as a PEP, we should plan for a 1.0.0 release with some improvements on the API and documentation and tests. >> does it have an FOSS licence compatible with Python, and if not, are the >> authors willing to re-licence it? I am willing to re-licence it. >> are the authors willing to donate the module to Python? Yes >> are the authors happy to change their release schedule to match Python? Yes >> are they happy to adhere to Python's policy on backwards compatibility and >> new functionality? Yes >> are you (or the authors) willing to write a PEP proposing to add this module >> to the standard library? https://www.python.org/dev/peps/ Yes, with your contribution. >> can you find a Core Developer willing to sponsor this PEP? (You can probably >> ask on the Python-Dev or Python-Ideas mailing lists, or the Python Discuss, >> or face-to-face in person at a sprint, etc.) We may try. I will request support for this project in Python-Dev and Pytgon-Ideas during this week by sending an e-mail. Thank you also Steven for your bullet points to complete! Juan -- ___ Python tracker <https://bugs.python.org/issue38052> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38052] Include sspipe Module with Core Python
Juan Telleria added the comment: Even if it is not currently mainstream, piping (tidy and readable code, left to right), should be a foundation, not just a module. -- ___ Python tracker <https://bugs.python.org/issue38052> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38052] Include sspipe Module with Core Python
Juan Telleria added the comment: And based on previous example, a more "pythonic" syntax would: MyObj = Class \ .method1() \ .f_function1() \ .method2() \ .f_function2(param1 = "A", param2 = .) So that any function preceded by a dot "." becomes a forward-pipe function (Object reference is passed forward). -- ___ Python tracker <https://bugs.python.org/issue38052> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39247] dataclass defaults and property don't work together
Juan Arrivillaga added the comment: So, after glancing at the source code: https://github.com/python/cpython/blob/ce54519aa09772f4173b8c17410ed77e403f3ebf/Lib/dataclasses.py#L869 During this processing of fields, couldn't you just special case property/descriptor objects? -- nosy: +juanpa.arrivillaga ___ Python tracker <https://bugs.python.org/issue39247> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39247] dataclass defaults and property don't work together
Juan Arrivillaga added the comment: Actually, couldn't the following be a workaround, just set the property on the class after the class definition: import dataclasses import typing @dataclasses.dataclass class FileObject: uploaded_by:typing.Optional[None]=None def _uploaded_by_getter(self): return self._uploaded_by def _uploaded_by_setter(self, uploaded_by): print('Setter Called with Value ', uploaded_by) self._uploaded_by = uploaded_by FileObject.uploaded_by = property( FileObject._uploaded_by_getter, FileObject._uploaded_by_setter ) p = FileObject() print(p) print(p.uploaded_by) -- ___ Python tracker <https://bugs.python.org/issue39247> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39247] dataclass defaults and property don't work together
Juan Arrivillaga added the comment: But when would you want to have a descriptor as an instance attribute? Descriptors must be in the class dictionary to work: https://docs.python.org/3/reference/datamodel.html#implementing-descriptors I suppose, you could want some container class of descriptor objects, but that seems like an extremely narrow use-case, compared to the normal and common use-case of descriptors acting like descriptors. I think special-casing descriptors make sense because they act in a special way. -- ___ Python tracker <https://bugs.python.org/issue39247> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41274] Better way to random.seed()?
New submission from Juan Jimenez : I have invented a new way to seed the random number generator with about as random a source of seeds as can be found: hashes generated from high cadence, high resolution images of the surface of the Sun. These are captured by the Solar Dynamics Observatory's (SDO) Atmospheric Imaging Assembly's (AIA) cameras at various frequencies. I wrote the POC code in Python and can be seen at https://github.com/flybd5/heliorandom. The HelioViewer project liked the idea and modified their API to do essentially what my POC code does at https://api.helioviewer.org/?action=getRandomSeed. Perhaps a solarseed() call could be created for the library to get seeds that way rather than from the system clock? -- components: Library (Lib) messages: 373487 nosy: flybd5 priority: normal severity: normal status: open title: Better way to random.seed()? type: enhancement versions: Python 3.10 ___ Python tracker <https://bugs.python.org/issue41274> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41274] Better way to random.seed()?
Juan Jimenez added the comment: I'm not a Python guru, but I was wondering, is it possible to write a new module that overrides the seed() method in the random library in its initialization code and replaces it with this method of seeding the generator? -- ___ Python tracker <https://bugs.python.org/issue41274> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41274] Better way to random.seed()?
Juan Jimenez added the comment: Thanks Rémi. :) -- ___ Python tracker <https://bugs.python.org/issue41274> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41274] Better way to random.seed()?
Juan Jimenez added the comment: How would I know if my demo is good enough to be included in that repo? Is there a guide for this, or do I just create a pull request, throw it over the fence and wait until the wolves either grunt in approval or throw it back at me in pieces? I ask because I have never participated in a repo related to as big a project as Python 3. :) -- ___ Python tracker <https://bugs.python.org/issue41274> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41446] New demo, using a web api
New submission from Juan Jimenez : As per a suggestion in https://bugs.python.org/issue41274 I would like to submit for consideration a new demo program, one that demonstrates how to use a web API to generate a pseudo-random generator seed from high resolution, high cadence images of the sun. I will be submitting a pull request for consideration. -- components: Demos and Tools messages: 374620 nosy: flybd5 priority: normal severity: normal status: open title: New demo, using a web api type: enhancement versions: Python 3.10 ___ Python tracker <https://bugs.python.org/issue41446> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41446] New demo, using a web api
Change by Juan Jimenez : -- keywords: +patch pull_requests: +20835 stage: -> patch review pull_request: https://github.com/python/cpython/pull/21693 ___ Python tracker <https://bugs.python.org/issue41446> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41274] Better way to random.seed()?
Juan Jimenez added the comment: Pull request https://github.com/python/cpython/pull/21693 created for the demo steven.daprano suggested. -- message_count: 8.0 -> 9.0 pull_requests: +20836 pull_request: https://github.com/python/cpython/pull/21693 ___ Python tracker <https://bugs.python.org/issue41274> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13785] Make concurrent.futures.Future state public
New submission from Juan Javier : Hello, This is a proposal to make the state of Future objects public. The idea is to have access to the current state of the Future using a property instead of calling several methods (done, cancelled, etc.). Also, a history property that returns a list of Event(state, timestamp) objects is written, the list stores the timestamp every time the state of a future changes. There is a patch attached to the issue. Regards. -- components: Library (Lib) files: concurrent.futures.Future.state_public.patch keywords: patch messages: 151259 nosy: bquinlan, jjdominguezm priority: normal severity: normal status: open title: Make concurrent.futures.Future state public type: enhancement versions: Python 3.3 Added file: http://bugs.python.org/file24237/concurrent.futures.Future.state_public.patch ___ Python tracker <http://bugs.python.org/issue13785> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13785] Make concurrent.futures.Future state public
Juan Javier added the comment: Hello, You're right, explaining the difference between CANCELLED and CANCELLED_AND_NOTIFIED is gong to be hard and might be confusing. I also agree that there is no precedent for storing the history of something, and I don't like either the idea of having a futures factory (that was my first idea). But, what about using callbacks? it is possible to add done callbacks, why can't we have a list of callbacks attached to each "public" state. Something like: Future.append_callback(self, state: "One of PENDING, RUNNING, CANCELLED, FINISHED", fn) -- ___ Python tracker <http://bugs.python.org/issue13785> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13785] Make concurrent.futures.Future state public
Juan Javier added the comment: The use case is to know the state of a future without having to do something like this @property def state(self): if self.future.running(): return Process.States.Running elif self.future.cancelled(): return Process.States.Cancelled elif self.future.done(): return Process.States.Done return Process.States.Pending -- ___ Python tracker <http://bugs.python.org/issue13785> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13785] Make concurrent.futures.Future state public
Juan Javier added the comment: I'm writting an application where users can submit long running jobs and I want to disply a list of those jobs and the state of each one. My idea is to use an executor and use the futures to display information about the jobs: not started, cancelled, running, etc. Think of a table with these headers: ID, Start date, Last state change date, State, Info -- ___ Python tracker <http://bugs.python.org/issue13785> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33360] ALternative recipe for password using secrets
New submission from Juan Postlbauer : Chapter 15.3.4 shows a recipe with an infinite potential loop. An alternative would be: ''.join(sorted([choice(string.ascii_lowercase) for i in range(1)]+[choice(string.ascii_uppercase) for i in range(1)]+[choice(string.digits) for i in range(3)]+[choice(string.ascii_letters+string.digits) for i in range(10-(1+1+3))],key=lambda x:randbelow(4096))) Can we assume secrets.SystemRandom is cryptographically strong but has all the methods of random?? If so it can be done in a more understandable way by using choices and shuffle. (see 2 examples below) def generate_password_random(totalchars=10,minlower=1,minupper=1,mindigits=3): restcount= totalchars-(minlower+minupper+mindigits) if restcount<0: raise ValueError("Impossible conditions") lowerchars=random.choices(string.ascii_lowercase,k=minlower) upperchars=random.choices(string.ascii_uppercase,k=minupper) digitchars=random.choices(string.digits,k=mindigits) restchars=random.choices(string.ascii_letters+string.digits,k=restcount) allchars=lowerchars+upperchars+digitchars+restchars random.shuffle(allchars) password=''.join(allchars) return password def generate_password_secrets(totalchars=10,minlower=1,minupper=1,mindigits=3): restcount= totalchars- (minlower+minupper+mindigits) if restcount<0: raise ValueError("Impossible conditions") lowerchars=[secrets.choice(string.ascii_lowercase) for _ in range(minlower)] upperchars=[secrets.choice(string.ascii_uppercase) for _ in range(minupper)] digitchars=[secrets.choice(string.digits) for _ in range (mindigits)] restchars=[secrets.choice(string.ascii_letters+string.digits) for _ in range (restcount)] allchars=lowerchars+upperchars+digitchars+restchars allchars.sort(key=lambda x:secrets.randbelow(4096)) password=''.join(allchars) return password -- assignee: docs@python components: Documentation messages: 315763 nosy: docs@python, jpc4242 priority: normal severity: normal status: open title: ALternative recipe for password using secrets type: enhancement versions: Python 3.6 ___ Python tracker <https://bugs.python.org/issue33360> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33360] ALternative recipe for password using secrets
Juan Postlbauer added the comment: Just a clarification: by "infinite potential loop" I meant a loop that *theoretically* could last forever. Of course in practice it won't, but my experiments show that for the conditions in the example in average the current recipe generates 5 tentative passwords before finding one that fulfills all conditions. -- ___ Python tracker <https://bugs.python.org/issue33360> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13785] Make concurrent.futures.Future state public
Changes by Juan Javier : -- status: open -> languishing ___ Python tracker <http://bugs.python.org/issue13785> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13785] Make concurrent.futures.Future state public
Juan Javier added the comment: I totally agree, I'm going to take a look at the code and I'll write back with some comments. That will be next week, work is currently very demanding. -- status: languishing -> open versions: +Python 3.4 -Python 3.3 ___ Python tracker <http://bugs.python.org/issue13785> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15634] synchronized decorator for the threading module
New submission from Juan Javier: I think it will be useful to have a decorator like this one on the threading module: def synchronized(func): """A decorator to make a function execution synchronized. Examples: @synchronized def foo(): pass class Foo: def __init__(self): self.__syncdata = None @property def syncdata(self): return self.__syncdata @syncdata.setter @synchronized def syncdata(self, value): self.__syncdata = value """ if not hasattr(func, "__lock"): func.__lock = threading.Lock() def _synchronized(*args, **kwds): with func.__lock: func(*args, **kwds) _synchronized.__doc__ = func.__doc__ return _synchronized What do you think? -- components: Library (Lib) messages: 168071 nosy: jjdominguezm priority: normal severity: normal status: open title: synchronized decorator for the threading module type: enhancement versions: Python 3.4 ___ Python tracker <http://bugs.python.org/issue15634> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15634] synchronized decorator for the threading module
Juan Javier added the comment: Ok, you are right, serialized is the right name. Also, passing the lock to the decorator will the correct option. -- ___ Python tracker <http://bugs.python.org/issue15634> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15634] synchronized decorator for the threading module
Juan Javier added the comment: What about this? def serialized(lock): def _serialized(func): def __serialized(*args, **kwds): with lock: return func(*args, **kwds) __serialized.__doc__ = func.__doc__ return __serialized return _serialized -- ___ Python tracker <http://bugs.python.org/issue15634> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13785] Make concurrent.futures.Future state public
Juan Javier added the comment: Hi Brian, No, no progress on this. I think this is not an interesting feature after all. You can close this. Juan Javier -- ___ Python tracker <http://bugs.python.org/issue13785> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15634] Add serialized decorator to the threading module
Juan Javier added the comment: It looks like this is not very interesting after all. -- status: open -> closed ___ Python tracker <http://bugs.python.org/issue15634> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13785] Make concurrent.futures.Future state public
Changes by Juan Javier : -- status: open -> closed ___ Python tracker <http://bugs.python.org/issue13785> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15634] Add serialized decorator to the threading module
Juan Javier added the comment: David, I think this doesn't deserve to be part of the library since it is trivial to write and it is just a particular use case. Adding it as an example in the threading module's documentation might be a good idea, what do you think? -- ___ Python tracker <http://bugs.python.org/issue15634> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6751] Default return value in ConfigParser
New submission from Juan Javier : I think it is useful, at least for me, to add an argument, default, to [Safe,Raw]ConfigParser.get that, if present, will be returned if the methid fails to return the value. That is, instead of rasing an exception, return default, if present. It could be done overriding the get method in SafeConfigParser, something like this: class SafeConfigParser(ConfigParser): def get(self, section, option, raw=False, vars=None, **kwds): try: return super().get(section, option, raw, vars) except Exception as exc: if "default" in kwds: return kwds["default"] raise exc -- components: Library (Lib) messages: 91808 nosy: jjdominguezm severity: normal status: open title: Default return value in ConfigParser type: feature request versions: Python 3.2 ___ Python tracker <http://bugs.python.org/issue6751> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6751] Default return value in ConfigParser
Juan Javier added the comment: I've applied the enhancement to the three parsers, actually I've made the change to RawconfigParser with a small change to ConfigParser. I've also created some unit tests. -- keywords: +patch Added file: http://bugs.python.org/file18122/configparser.py.diff ___ Python tracker <http://bugs.python.org/issue6751> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6751] Default return value in ConfigParser
Changes by Juan Javier : Added file: http://bugs.python.org/file18123/test_cfgparser.py.diff ___ Python tracker <http://bugs.python.org/issue6751> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6751] Default return value in ConfigParser
Juan Javier added the comment: I would like the method to have the exact same behavior as before if the "default" argument is not present, and return the given default value when "deafult" argument is present. If you simply add a "default" keyword, it will always be present and you wouldn't know if the user wants the exception thrown or the default value returned. Do you know how to program this using a "default" keyword argument? -- ___ Python tracker <http://bugs.python.org/issue6751> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9733] Can't iterate over multiprocessing.managers.DictProxy
New submission from Juan José Conti : I expected I could iterate over a DictProxy as I do over a regular dict. >>> from multiprocessing import Manager >>> m = Manager() >>> d = m.dict() >>> d >>> for x in d: ... print x ... Traceback (most recent call last): File "", line 1, in File "", line 2, in __getitem__ File "/usr/lib/python2.6/multiprocessing/managers.py", line 740, in _callmethod raise convert_to_error(kind, result) KeyError: 0 >>> d['a'] = 1 >>> for x in d: ... print x ... Traceback (most recent call last): File "", line 1, in File "", line 2, in __getitem__ File "/usr/lib/python2.6/multiprocessing/managers.py", line 740, in _callmethod raise convert_to_error(kind, result) KeyError: 0 -- components: Library (Lib) messages: 115302 nosy: jjconti priority: normal severity: normal status: open title: Can't iterate over multiprocessing.managers.DictProxy versions: Python 2.6, Python 2.7 ___ Python tracker <http://bugs.python.org/issue9733> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7633] decimal.py: type conversion in context methods
Juan José Conti added the comment: I've been working in the modified version of my last patch to solve the 6 mentioned points. I'm posting it in less than 24 hs. If you're not hurry, please wait for me. This is just my second patch and is very useful to learn how to contribute to Python. -- ___ Python tracker <http://bugs.python.org/issue7633> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7633] decimal.py: type conversion in context methods
Juan José Conti added the comment: 1) Agree. Extra checks removed. 2) My mistake. Fixed. 3) Fexed. 4) Methods documentation fixed. Also added examples. 5) Fixed 6) Allow ints in the following unary methods (all except the ones excluded by skrah in cdecimal): - abs - canonical - copy_abs - copy_decimal - copy_negate - exp - is_finite - is_infinite - is_nan - is_normal - is_qnan - is_signed - is_snan - is_subnormal - is_zero - ln - log10 - logb - minus - next_minus - next_plus - sqrt - to_*_string - to_integral_* (also documented them properly as in 4) copy_sing fixed and documented to have the same behaibour. Ans a change in Doc/library/decimal.rst to reflec the new behaibour. -- Added file: http://bugs.python.org/file16032/issue7633_jjconti3.patch ___ Python tracker <http://bugs.python.org/issue7633> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7633] decimal.py: type conversion in context methods
Juan José Conti added the comment: Yeah... I did't like that docstring either :) Removed! Also fixed Decimal.copy_sign, changed Context.copy_sign and added tests. -- Added file: http://bugs.python.org/file16052/issue7633_jjconti4.patch ___ Python tracker <http://bugs.python.org/issue7633> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1779] int("- 1") is valud, but float("- 1") isn't. Which is right?
Juan José Conti added the comment: This is my first patch. Bug fix on revision 60076. -- nosy: +jjconti Added file: http://bugs.python.org/file9220/bug_fix_for_1779.diff __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1779> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1779] int("- 1") is valud, but float("- 1") isn't. Which is right?
Juan José Conti added the comment: The same patch as before plus tests. Added file: http://bugs.python.org/file9228/bug_fix_for_1779-plustests.diff __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1779> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7263] Fix set.intersection docstring
Juan Benavente Ponce added the comment: set.intersection and frozenset.intersection docstrings are back to the wrong two-sets-only version in Python 3.3 (Python 2.7 is not affected): """ intersection(...) Return the intersection of two sets as a new set. (i.e. all elements that are in both sets.) """ The correct docstring should be the one already submitted by Alexander Belopolsky: """ intersection(...) Return the intersection of two or more sets as a new set. (i.e. all elements that are in all sets.) """ Thanks everyone for your great work and Merry Christmas! -- nosy: +turgon versions: +Python 3.3 -Python 2.7, Python 3.2 ___ Python tracker <http://bugs.python.org/issue7263> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7263] Fix set.intersection docstring
Juan Benavente Ponce added the comment: Comparing the docstrings with the on-line documentation, I have found that, in addition to the already mentioned issue, the fact that many methods only require the first argument to be a set (or frozenset) object is not mentioned anywhere in the docstrings. Would it be useful if I write here a list of all the cases where this happens, and a possible alternative? An example: Python 2.7 set.union current docstring: """Return the union of sets as a new set. (i.e. all elements that are in either set.)""" possible enhancement: """union(set1, *iterables) --> new set Return a new set with elements from set1 and all the iterables.""" Would it be a good idea to create a different docstring for the bound method? E.g: unbound version: """union(set1, *iterables) --> new set Return a new set with elements from set1 and all the iterables.""" bound version: """set1.union(*iterables) --> new set Return a new set with elements from set1 and all the iterables.""" If writing this list would be useful, please tell me so, and I will do it. Thanks for your time! -- ___ Python tracker <http://bugs.python.org/issue7263> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7633] decimal.py: type conversion in context methods
Juan José Conti added the comment: The same happens with other Context methods, like divide: Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from decimal import * >>> c = getcontext() >>> c.divide >>> c.divide(2,3) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/decimal.py", line 3966, in divide return a.__div__(b, context=self) TypeError: wrapper __div__ doesn't take keyword arguments >>> c.divide(Decimal(2),3) Decimal('0.6667') >>> c.divide(6,Decimal(2)) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/decimal.py", line 3966, in divide return a.__div__(b, context=self) TypeError: wrapper __div__ doesn't take keyword arguments -- nosy: +jjconti ___ Python tracker <http://bugs.python.org/issue7633> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7633] decimal.py: type conversion in context methods
Juan José Conti added the comment: I've been reading http://speleotrove.com/decimal and seems not to be an explicit definition about this. I'm thinking in a patch I could supply tomorrow. What about the idea of changing the implementation from: return a.__add__(b, context=self) to return Decimal(a+b,context=self) ? -- type: feature request -> ___ Python tracker <http://bugs.python.org/issue7633> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7633] decimal.py: type conversion in context methods
Juan José Conti added the comment: The attached patch solves this issue. Finally, only operand 'a' needs to be converted to Decimal if it's not. I discover this after writing my tests and start the implementation. A Context.method is modified if it has more than one operand (for example a and b) and Decimal.method uses _convert_other 26 Context's methods were modified. 26 unit tets were added to ContextAPItests TestCase. docstring was added to Context.divmod -- keywords: +patch type: -> behavior Added file: http://bugs.python.org/file15751/issue7633_jjconti.patch ___ Python tracker <http://bugs.python.org/issue7633> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7633] decimal.py: type conversion in context methods
Juan José Conti added the comment: New patch. Fix Context.method that were returning NotImplemented. Decimal.__methods__ don't use raiseit=True in _convert_other so I check in Context.method and raise TypeError if necessary. Added tests for Context.divmod missed in first patch. -- Added file: http://bugs.python.org/file15760/issue7633_jjconti2.patch ___ Python tracker <http://bugs.python.org/issue7633> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7652] Merge C version of decimal into py3k.
Changes by Juan José Conti : -- nosy: +jjconti ___ Python tracker <http://bugs.python.org/issue7652> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25058] Right square bracket argparse metavar
New submission from Juan Jimenez-Anca: When trying to assign the metavar in add_argument() method of argparse module I'm unable to include characters after a right square bracket. Trying to set something like this: metavar="[host:database:collection:]field" would raise an AssertionError, which includes: File "/usr/lib64/python3.4/argparse.py", line 329, in _format_usage assert ' '.join(opt_parts) == opt_usage However, the following is accepted: metavar="[host:database:collection:]field" -- components: Library (Lib) messages: 250388 nosy: cortopy priority: normal severity: normal status: open title: Right square bracket argparse metavar type: behavior versions: Python 3.4 ___ Python tracker <http://bugs.python.org/issue25058> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25058] Right square bracket argparse metavar
Juan Jimenez-Anca added the comment: My apologies for the formatting of the last line. This is my issue corrected: When trying to assign the metavar in add_argument() method of argparse module I'm unable to include characters after a right square bracket. Trying to set something like this: metavar="[host:database:collection:]field" would raise an AssertionError, which includes: File "/usr/lib64/python3.4/argparse.py", line 329, in _format_usage assert ' '.join(opt_parts) == opt_usage However, the following is accepted: metavar="[host:database:collection:] field" -- ___ Python tracker <http://bugs.python.org/issue25058> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33364] Conditionals not evaluating propertly
New submission from Juan Enrique Segebre Zaghmout : The following code generates False when it should generate true: True == False < 20 Either way the order of operation is taken should result in True but the answer still results in False. To further confirm this issue I did a simple test in which we would group the operations, the test uses print statements to visualize results. The short following code represents the above conditional and the two order of operations possibilities. print(True == False < 20); print((True == False) < 20); print(True == (False < 20)); This yields the following output: False True True Proving the bug. To explain even further, the code shall be interpreted in either of the following two ways: 1. True == False < 20 False < 20 True 2. True == False < 20 True == True True In either case the result is True, yet python yields False. -- components: Interpreter Core messages: 315779 nosy: Segebre priority: normal severity: normal status: open title: Conditionals not evaluating propertly type: behavior versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue33364> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18512] sys.stdout.write does not allow bytes in Python 3.x
New submission from Juan Luis Boya García: Sometimes developers need to write text to stdout, and it's nice to have on the fly Unicode to UTF-8 conversion (or what matches the platform), but sometimes they also need to output binary blobs, like text encoded in other codifications than the system default, binary files, etc. Python2 does the thing more-or-less right and allows writing both text and binary. I think Python3 should also accept both. -- components: Library (Lib) messages: 193394 nosy: ntrrgc priority: normal severity: normal status: open title: sys.stdout.write does not allow bytes in Python 3.x type: behavior versions: Python 3.3 ___ Python tracker <http://bugs.python.org/issue18512> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18512] sys.stdout.write does not allow bytes in Python 3.x
Juan Luis Boya García added the comment: Sorry for the late response, GMail's SPAM filter ate the replies. The main issue is sys.stdout being opened as text instead of binary. This fact is stated in the docs. http://docs.python.org/3/library/sys.html#sys.stdout In any case, there are some caveats worth noting: > You can do >sys.stdout.buffer.write(b"hello") This is problematic if both buffer and IOTextWrapper are used. For example: print("Hello", end=""); sys.stdout.buffer.write(b"World") That line may write `WorldHello` instead of `HelloWorld` (and it does indeed, at least in Linux implementation). Yes, an application should not do this in Python3, but using print() and writing to stdout were OK in Python2, which makes porting programs harder. A workaround is to perform sys.stdout.flush() before sys.stdout.buffer.write(). > (from the docs) > Using io.TextIOBase.detach(), streams can be made binary by default. > sys.stdout = sys.stdout.detach() This should help in cases where most output is binary, but it's worth noting that interactive shells (such as the builtin python or IPython) and debuggers (both pdb and ipdb) stop working when this is used. Also, it will probably break every function there that relies on sys.stdout being Unicode or binary depending on only the Python version. -- ___ Python tracker <http://bugs.python.org/issue18512> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28336] Slicing (operation) is not symmetrical with respect to suffixes and prefixes
New submission from Juan Carlos Pujol Mainegra: Let s be a string or other array-like object, a, b > 0 integers, s[0:b] returns a b-long prefix to s, the same as s[:b], but s[-a:0] returns empty (for len(s) > 0 and a > 1), while it should return the same as s[-a:], an a-long suffix (a > 0). A syntax asymmetry like this shall not be imposed to those using non-literal slicing indexes, as it would be necessarily to introduce a control condition to test whether the upper bound index is a non-negative quantity, assuming the lower bound index is negative. Furthermore, it breaks the whole negative slicing idea, being that (I consider) index i always be treated as i mod len(s), so that constructions like s[-a:b] (for a, b > 0 or a, b < 0) could return s[-a:] + s[:b]. -- components: Interpreter Core messages: 277829 nosy: jksware priority: normal severity: normal status: open title: Slicing (operation) is not symmetrical with respect to suffixes and prefixes type: enhancement versions: Python 3.6 ___ Python tracker <http://bugs.python.org/issue28336> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1720992] automatic imports
Juan Manuel Borges Caño added the comment: Thank you for the link. I think this bug is already closed. _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1720992> _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com