[issue36415] [math] Implement pow2 function

2019-03-24 Thread Марат Нагаев
Марат Нагаев added the comment: 110 times is the result on MacBook 2017 13 In my phone this works 187 times faster! -- ___ Python tracker <https://bugs.python.org/issue36

[issue36415] [math] Implement pow2 function

2019-03-24 Thread Марат Нагаев
New submission from Марат Нагаев : Hello. I want to implement pow2 function special for powers of 2. pow2 works 110 times faster if we pow 4 to 10**6 pow2 implementaion on Python: def pow2(a,b): p=log2(a)*b if not p.isinteger(): raise TypeError('a isn't power of 2!') return 1«p

[issue36228] Support coercion of complex to float/int

2019-03-22 Thread Марат Нагаев
Марат Нагаев added the comment: ping @tim.peters -- ___ Python tracker <https://bugs.python.org/issue36228> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36228] Support coercion of complex to float/int

2019-03-09 Thread Марат Нагаев
Марат Нагаев added the comment: Can I implement this methods? @tim.peters -- ___ Python tracker <https://bugs.python.org/issue36228> ___ ___ Python-bugs-list m

[issue36228] Support coercion of complex to float/int

2019-03-08 Thread Марат Нагаев
Марат Нагаев added the comment: I think at bank. I find post (Russian) about complex numbers: https://cyberleninka.ru/article/v/primenenie-kompleksnyh-chisel-v-finansovyh-operatsiyah And rounding was used. Sorry, I don't know about English version of this article

[issue36228] Support coercion of complex to float/int

2019-03-08 Thread Марат Нагаев
Марат Нагаев added the comment: >For those rare cases where this is needed, it isn't that hard to spell out >`complex(floor(z.real) But in Python we have math.tau. However it's just 2*pi. >`math.floor` of a `float` object returns an `int` Maybe the best solution is to add functi

[issue36228] Support coercion of complex to float/int

2019-03-08 Thread Марат Нагаев
Марат Нагаев added the comment: Oh, __floor__ can return anything. So I suggest: 1. Methods __floor__ and __ceil__ for complex object. 2. Don't change __float__ and __int__ methods. 3. So I think it isn't nessesary to add methods floor and ceil to complex module. Example: from math import * z

[issue36228] Support coercion of complex to float/int

2019-03-07 Thread Марат Нагаев
Марат Нагаев added the comment: I think math.floor should raise TypeError if complex argument passed, but we need cmath.floor(and ceil). As I know floor complex number is just floor real part and floor imag. Example: z=1.1+2.5j floor(z) #2+3j I think it's correct. But I don't know about complex

[issue36228] Add function to complex object

2019-03-07 Thread Марат Нагаев
Change by Марат Нагаев : -- title: Add function to complex objectf -> Add function to complex object ___ Python tracker <https://bugs.python.org/issu

[issue36228] Add function to complex objectf

2019-03-07 Thread Марат Нагаев
New submission from Марат Нагаев : I think complex object should have methods __float__ (returns real part) and __int__ (returns int(real)). Also I think we need floor and ceil methods om cmath module. I think, these functions are useful. -- components: Extension Modules, Library (Lib

[issue32655] File mode should be a constant

2018-01-24 Thread Марат Нагаев
New submission from Марат Нагаев <sidorovmarat1...@gmail.com>: Hey guys, I find bug in Python. If you'll try to file stream using open function you can edit file mode: Watch git: https://gist.github.com/nagayev/7d17ead7b3bc2b06f2445fb5d9122a5c In fact,mode don't changed,so mode shoul be co

[issue32655] File mode shou

2018-01-24 Thread Марат Нагаев
Change by Марат Нагаев <sidorovmarat1...@gmail.com>: -- components: IO nosy: nagayev priority: normal severity: normal status: open title: File mode shou type: behavior versions: Python 3.7 ___ Python tracker <rep...@bugs.python.or

[issue31918] Don't let all python code modify modules

2017-11-01 Thread Марат Нагаев
Change by Марат Нагаев <sidorovmarat1...@gmail.com>: -- components: +Extension Modules ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue31918] Don't let all python code modify modules

2017-11-01 Thread Марат Нагаев
New submission from Марат Нагаев <sidorovmarat1...@gmail.com>: import os os="os" #I think it's bad, os and other modules constants -- title: D -> Don't let all python code modify modules ___ Python tracker <rep...@b

[issue31918] D

2017-11-01 Thread Марат Нагаев
Change by Марат Нагаев <sidorovmarat1...@gmail.com>: -- nosy: Марат Нагаев priority: normal severity: normal status: open title: D type: enhancement ___ Python tracker <rep...@bugs.python.org> <https://bugs.python