[issue44421] random.uniform() hangs will eating up all available RAM
New submission from Christian Kleineidam : I'm writing a model that needs a lot of random numbers. The model counts up to "Year:640: Count:1339" (taking around two minutes) and then hangs on random.uniform(0, 1). While it hangs, the amount of RAM python takes grows till it eats up all available RAM with RAM usage growing by around 100 MB per second. I'm running Windows 10 and the error appears in both Python 3.8.8 as well as in 3.9.5. I'm attaching a file that reproduces the error. File "C:\Users\Christian\folder\obfuscated.py", line 427, in population = population.next() File "C:\Users\Christian\folder\obfuscated.py", line 385, in next return Class4(self.nextClass4) File "C:\Users\Christian\folder\obfuscated.py", line 280, in __init__ var42.var30() File "C:\Users\Christian\folder\obfuscated.py", line 177, in var30 var22.var30(self.var17,self.var18,self.var21) File "C:\Users\Christian\folder\obfuscated.py", line 100, in var30 self.barClass1s.append(var23.child()) File "C:\Users\Christian\folder\obfuscated.py", line 29, in child if var6>random.uniform(0, 1): File "C:\Progs\anaconda3\lib\random.py", line 417, in uniform return a + (b-a) * self.random() -- components: Library (Lib) files: obfuscated.py messages: 395836 nosy: Christian.Kleineidam priority: normal severity: normal status: open title: random.uniform() hangs will eating up all available RAM versions: Python 3.9 Added file: https://bugs.python.org/file50109/obfuscated.py ___ Python tracker <https://bugs.python.org/issue44421> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27091] Python IDLE doesn't like ๐
Christian Kleineidam added the comment: My version is: Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:16:59) [MSC v.1900 32 bit (Intel)] on win32 Yes, I think the issue is likely a dublicate of http://bugs.python.org/issue13153 -- ___ Python tracker <http://bugs.python.org/issue27091> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27091] Python IDLE doesn't like ๐
New submission from Christian Kleineidam: When I past ๐ into the Python IDLE it closes automatically. I would be fine with the IDLE not being able to display the character. Automatically closing seems however excessive. -- components: IDLE messages: 266138 nosy: Christian.Kleineidam priority: normal severity: normal status: open title: Python IDLE doesn't like ๐ versions: Python 3.5 ___ Python tracker <http://bugs.python.org/issue27091> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18844] allow weights in random.choice
Christian Kleineidam added the comment: A user can use map(), filter(), zip() without knowing anything about generators. In most cases those function will do their magic and provide a finite number of outputs. The weighted_choice_generator on the other hand isn't as easy to use. If the user wants 5 values from it, they need to know about `take()` from itertools or call `next()`. -- ___ Python tracker <http://bugs.python.org/issue18844> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18844] allow weights in random.choice
Christian Kleineidam added the comment: I like the idea of adding a weights keyword to choice and creating an additional choice_generator() that also takes weights. A choice_generator() could take a further argument to allow unique choices and be a generator version of sample(). In some cases you want to draw randomly from a sequence till you draw an item that fulfills certain criteria. At the moment neither the sample nor the shuffle method seems to be optimal for that use case. Given that items are commonly drawn from an urn in math, urn seems a good alternative for choice_generator(). random.urn(data, *, weights=None, unique=False) -- nosy: +Christian.Kleineidam ___ Python tracker <http://bugs.python.org/issue18844> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22383] Crazy unicode : How g and ษก look the same but are two different characters
New submission from Christian Kleineidam: g = 2 i = 2 ษก = 1 a = g + i a >>> 4 Given the font on which this bug tracker runs it's possible to see why a is 4 and not 3. On the other hand there are plenty of fonts (such as Arial, Tahoma or Courier New) that display chr(103) and chr(609) the same way. If a programmer is not aware of the issue it will make it nearly impossible to spot bugs that come up when someone names variables or functions via using chr(609). Python should either forbid people from using chr(609) to name functions and variables or treat it as a synonym of chr(103). -- components: Unicode messages: 226708 nosy: Christian.Kleineidam, ezio.melotti, haypo priority: normal severity: normal status: open title: Crazy unicode : How g and ษก look the same but are two different characters type: behavior versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5 ___ Python tracker <http://bugs.python.org/issue22383> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22354] Highlite tabs in the IDLE
New submission from Christian Kleineidam: Python accepts both tabs and spaces. Code that mixes tab and spaces can lead to problematic issues. Especially beginners who are new to python can be confused if they copy some code and it doesn't work as they expected because of issues of invisible whitespace. Beginners are also more likely to use the editor that comes with the IDLE instead of using a more specialised editor. If the IDLE would highlite the fact that tabs are used instead of spaces, it would be easier to spot the issue. I therefore suggest that the IDLE highlites tabs both in the shell mode and the editor mode. Possible ways to highlite is to have a light grey: <--> ยป (at the beginning of the tab) PyCharm style error underlining -- components: IDLE messages: 226535 nosy: Christian.Kleineidam priority: normal severity: normal status: open title: Highlite tabs in the IDLE type: enhancement versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5 ___ Python tracker <http://bugs.python.org/issue22354> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com