Filters:
Languages
Toughness
Just bugs labeled...
-
In [161]: summation( binomial(n,k)**2, (k,0,oo)) Out[161]: Γ(2⋅n + 1) ────────── 2 Γ(n + 1) In [162]: combsimp(summation( binomial(n,k)**2, (k,0,oo))) Out[162]: 2⋅n + 1 2 ⋅Γ(n + 1/2) ─────────────────── ___ 2⋅╲╱ π ⋅Γ(n + 1) First off, I have n defined as an integer, so IMHO gamma should reduce to factorial in that case. Second, this is just binomial(2*n, n). Third, why doesn't this work: In [165]: summation( binomial(n,k)**2, (k,0,oo)).rewrite(factorial) Out[165]: Γ(2⋅n + 1) ────────── 2 Γ(n + 1)
-
Now that we have transitioned from Mongo to SQL, and sqlalchemy is providing our database abstraction, it does not make lots of sense to abstract away the database abstraction layer. I seriously suggest ripping out Mongo. I have actually done that with no ill side-effects (besides not supporting Mongo anymore) in this branch: '''WIP/RIP_mongo''' repo: git://gitorious.org/~spaetz/mediagoblin/spaetz-mediagoblin.git This leads to quite some code simplification: {{{ 45 files changed, 1518 insertions(+), 3107 deletions(-) }}} the removing of an additional lookup layer and possibilities for further optimizations. (Such as transitioning away from the mongo-style alias "_id" to the "id" field that we actually use)
-
· link
To reproduce, try the following code: from argparse import ArgumentParser a = ArgumentParser() a.add_argument("foo-bar") args = a.parse_args(["biz"]) print args, args.foo_bar Expected output: Namespace(foo_bar='biz') biz Actual output: Namespace(foo-bar='biz') Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'Namespace' object has no attribute 'foo_bar' Other comments: The positional argument 'foo-bar' becomes impossible to retrieve without explicitly passing keyword argument dest='foo_bar'. Hyphens in positional arguments should be automatically replaced with underscores just as with other arguments. I have not tested if this problem occurs in Python versions newer than 2.6.
-
With libpython.py loaded in gdb, when backtracing and trying to pretty-print frame objects along the way, this error is sometimes raised: Python Exception <type 'exceptions.TypeError'> object of type 'FakeRepr' has no len() See attached patch against tip.
-
· link
In many cases, PyModule_AddIntMacro() could be used instead of PyModule_AddIntConstant(), e.g. in socketmodule.c and posixmodule.c: PyModule_AddIntMacro(m, AF_INET6); vs (currently) PyModule_AddIntConstant(m, "AF_INET6", AF_INET6); It reduces the possibility of typo and is less verbose.
-
· link
The empty path '' is considered as an acceptable path in os.path.join, and works as a neutral prefix: print os.path.join('','aaa') ===> aaa which seems rather natural. But it raises an exception when used as a parameter to os.listdir. Logically, it should then list the current directory. (the alternative would be to raise an exception when os.path.join gets an empty argument). The inconsistency became clear to me when I had to write the following function : def listdirs(path,flist): # Appends to "flist" all paths to files that # start with "path". Argument "path" can be empty string ''. if path=='' : localist=os.listdir('.') else : localist=os.listdir(path) for f in localist : p=os.path.join(path,f) flist.append(p) if os.path.isdir(p) : listdirs(p,flist) return flist The conditionnal is needed only to avoid the exception, while the code is unique afterwards. This is related to Issue818059, but I did not see how that issue was resolved. Furthermore, the case of the empty path as argument to os.listdir should be documented in http://docs.python.org/2/library/os.html
-
· link
IPython13.2: Launching a cluster configured for SGE use caused a type error stating that you cannot apply a regular expression to a byte sequence (that apparently was the result of some shell level command). Unfortunately, the exact message got lost. Workaround: Change ib/python3.3/site-packages/ipython-0.13.2-py3.3.egg/IPython/parallel/apps/launcher.py a follows: def parse_job_id(self, output): """Take the output of the submit command and return the job id.""" output=output.decode('UTF8') ... I guess that python3.3 issues like these lurk in many places where the result of a shell command (usually a byte string) is combined somehow with a python3.3 (unicode) string. Georg
-
multiprocessing.cpu_count() implementation should be made available in the os module, where it belongs.
-
· link
`inet_pton`, `inet_ntop`, and `adict` in `twisted.python.compat` are no longer necessary (2.6 has good implementations of first two, third is just junk). They should be deprecated.
-
In Python 3.3 (I did not test with 3.4), sys.modules cannot be reassigned without breaking the import mechanism; while it works with Python <= 3.2. Here is how to reproduce the bug: progval@Andromede:/tmp$ mkdir test_imports progval@Andromede:/tmp$ echo "from . import module" > test_imports/__init__.py progval@Andromede:/tmp$ echo "print('foo')" > test_imports/module.py progval@Andromede:/tmp$ python3.3 Python 3.3.1 (default, Apr 6 2013, 13:58:40) [GCC 4.7.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.modules = dict(sys.modules) >>> import test_imports Traceback (most recent call last): File "<stdin>", line 1, in <module> File "./test_imports/__init__.py", line 1, in <module> from . import module SystemError: Parent module 'test_imports' not loaded, cannot perform relative import >>> progval@Andromede:/tmp$ python3.2 Python 3.2.3 (default, May 6 2013, 01:46:35) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.modules = dict(sys.modules) >>> import test_imports foo >>>
