[issue44168] Wrong syntax error hint when spurious colon present in function keyword comprehension assignment
New submission from Gerrit Holl : In Python 3.9.4, in a function call, when assigning a comprehension to a keyword argument, and the comprehension contains a spurious colon (if a list or set comprehension) or a missing value (when a dict comprehension), the syntax error message gives a hint that incorrectly suggests that the expression cannot contain an assignment: $ python Python 3.9.4 | packaged by conda-forge | (default, May 10 2021, 22:13:33) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> f(a={x: for x in {}}) File "", line 1 f(a={x: for x in {}}) ^ SyntaxError: expression cannot contain assignment, perhaps you meant "=="? I certainly didn't mean "==" here. The syntax is correct if I either remove the :, or add a value after the :, such as: >>> f(a={x:x for x in {}}) >>> f(a={x for x in {}}) (correct syntax, succeeds if f is defined). The problem here has nothing to do with assignments being in the wrong place, so the message reported by cpython is incorrect. In Python 3.8.10 Python simply and correctly states that the syntax is incorrect: >>> f(a={x: for x in {}}) File "", line 1 f(a={x: for x in {}}) ^ SyntaxError: invalid syntax I have not tried Python 3.10b1. -- components: Parser messages: 393865 nosy: Gerrit.Holl, lys.nikolaou, pablogsal priority: normal severity: normal status: open title: Wrong syntax error hint when spurious colon present in function keyword comprehension assignment versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue44168> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40449] multi-line f-string, syntaxerror points to wrong line
New submission from Gerrit Holl : When there is a syntax error in a multi-line f-string, the arrow in the reported syntax error points to the wrong line: $ cat mwe.py s = ("apricot " "pineapple" f"shallot{") $ python mwe.py File "mwe.py", line 1 s = ("apricot " ^ SyntaxError: f-string: expecting '}' Tested with Python 3.7.4 and 3.8.2. -- components: Interpreter Core messages: 367753 nosy: Gerrit.Holl priority: normal severity: normal status: open title: multi-line f-string, syntaxerror points to wrong line versions: Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue40449> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39419] Core dump when trying to use workaround for custom warning category (Fatal Python error: init_sys_streams: can't initialize sys standard streams)
New submission from Gerrit Holl : Pythons commandline warning filter cannot currently handle custom warning categories. See https://bugs.python.org/issue22543 I tried a workaround as suggested on Stack Overflow <https://stackoverflow.com/a/53538033/974555> to filter on a warning category defined in pandas.errors.__init__.py (DtypeWarning): PYTHONPATH=/media/nas/x21324/miniconda3/envs/py37e/lib/python3.7/site-packages/pandas/ python -Werror::errors.DtypeWarning However, this results in a Fatal Python error and core dump: Fatal Python error: init_sys_streams: can't initialize sys standard streams AttributeError: module 'io' has no attribute 'OpenWrapper' Current thread 0x7f7bb3be76c0 (most recent call first): Aborted (core dumped) -- messages: 360469 nosy: Gerrit.Holl priority: normal severity: normal status: open title: Core dump when trying to use workaround for custom warning category (Fatal Python error: init_sys_streams: can't initialize sys standard streams) type: crash versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue39419> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36079] pdb on setuptools "ValueError: underlying buffer has been detached"
New submission from Gerrit Holl : I am unable to use `pdb` to debug a problem I have with the `python-hdf4` installer. The exception in the program to be debugged is printed twice, followed by an exception in pdb itself, ending with `ValueError: underlying buffer has been detached`. See below, in particular the lower part: $ python -mpdb setup.py install python -mpdb setup.py install > /panfs/e/vol0/gholl/checkouts/python-hdf4/setup.py(11)() > -> """ (Pdb) cont running install running bdist_egg running egg_info running build_src build_src building extension "pyhdf._hdfext" sources build_src: building npy-pkg config files writing python_hdf4.egg-info/PKG-INFO writing dependency_links to python_hdf4.egg-info/dependency_links.txt writing top-level names to python_hdf4.egg-info/top_level.txt reading manifest file 'python_hdf4.egg-info/SOURCES.txt' writing manifest file 'python_hdf4.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py running build_ext customize UnixCCompiler customize UnixCCompiler using build_ext building 'pyhdf._hdfext' extension compiling C sources C compiler: gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC compile options: '-I/panfs/e/vol0/gholl/venv/py36/lib/python3.6/site-packages/numpy/core/include -I/panfs/e/vol0/gholl/venv/py36/include -I/hpc/rhome/software/python/3.6.5/include/python3.6m -c' extra options: '-DNOSZIP' Traceback (most recent call last): File "/hpc/rhome/software/python/3.6.5/lib/python3.6/pdb.py", line 1667, in main pdb._runscript(mainpyfile) File "/hpc/rhome/software/python/3.6.5/lib/python3.6/pdb.py", line 1548, in _runscript self.run(statement) File "/hpc/rhome/software/python/3.6.5/lib/python3.6/bdb.py", line 434, in run exec(cmd, globals, locals) File "", line 1, in File "/panfs/e/vol0/gholl/checkouts/python-hdf4/setup.py", line 11, in """ File "/panfs/e/vol0/gholl/venv/py36/lib/python3.6/site-packages/numpy/distutils/core.py", line 171, in setup return old_setup(**new_attr)
[issue22543] -W option cannot use non-standard categories
Gerrit Holl added the comment: There is a thread on StackOverflow related to this problem: https://stackoverflow.com/q/42495641/974555 The (currently only and accepted) answer proposes as a workaround to set the PYTHONPATH variable, as the contents of those apparently *are* already in sys.path at the time warnings._processoptions is called, unlike site-packages. So manually adding site-packages to the PYTHONPATH variable does circumvent this problem (tested in Python 3.7.1). -- nosy: +Gerrit.Holl versions: +Python 3.6, Python 3.7 ___ Python tracker <https://bugs.python.org/issue22543> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34487] enum _sunder_ names mix metaclass and enum class attributes
New submission from Gerrit Holl : In the [`enum` module](https://docs.python.org/3/library/enum.html#supported-sunder-names) documentation, some of the `_sunder_` names are on `EnumMeta`, whereas others are on the produced `Enum` class: > 8.13.15.3.2. Supported `_sunder_` names > * `_name_` – name of the member > * `_value_` – value of the member; can be set / modified in __new__ > * `_missing_` – a lookup function used when a value is not found; may be > overridden > * `_ignore_` – a list of names, either as a list() or a str(), that will not > be transformed into members, and will be removed from the final class > * `_order_` – used in Python 2/3 code to ensure member order is consistent > (class attribute, removed during class creation) > * `_generate_next_value_` – used by the Functional API and by auto to get an > appropriate value for an enum member; may be overridden Experimentally, it appears `_name_` and `_value_` are on the `Enum` class, whereas the others are all on the `EnumMeta` class: In [272]: class Test(enum.Enum): a = 0 In [273]: Test.a._name_ Out[273]: 'a' In [274]: Test._name --- AttributeErrorTraceback (most recent call last) in () > 1 Test._name /group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/envs/FCDR37a/lib/python3.7/enum.py in __getattr__(cls, name) 344 return cls._member_map_[name] 345 except KeyError: --> 346 raise AttributeError(name) from None 347 348 def __getitem__(cls, name): AttributeError: _name In [275]: Test.a._value_ Out[275]: 0 In [276]: Test._value --- AttributeErrorTraceback (most recent call last) in () > 1 Test._value /group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/envs/FCDR37a/lib/python3.7/enum.py in __getattr__(cls, name) 344 return cls._member_map_[name] 345 except KeyError: --> 346 raise AttributeError(name) from None 347 348 def __getitem__(cls, name): AttributeError: _value In [277]: Test.a._missing_ Out[277]: > In [278]: Test._missing_ Out[278]: > This is not clear from the documentation. -- assignee: docs@python components: Documentation messages: 324003 nosy: Gerrit.Holl, docs@python priority: normal severity: normal status: open title: enum _sunder_ names mix metaclass and enum class attributes versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue34487> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29672] `catch_warnings` context manager causes all warnings to be printed every time, even after exiting
Changes by Gerrit Holl <gerrit.h...@gmail.com>: -- title: `catch_warnings` context manager should reset warning registry to previous state upon exiting, to prevent warnings from being reprinted -> `catch_warnings` context manager causes all warnings to be printed every time, even after exiting ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29672> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29672] `catch_warnings` context manager should reset warning registry to previous state upon exiting, to prevent warnings from being reprinted
Gerrit Holl added the comment: I get bitten by this frequently, and find myself patching many libraries just to avoid them from calling .catch_warnings. Does anyone know whether to fix this it would suffice to edit warnings.py, or would I need to dig into _warnings.c as well? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29672> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30616] Cannot use functional API to create enum with zero values
New submission from Gerrit Holl: The OO API allows to create empty enums, i.e. without any values. However, the functional API does not, as this will result in an IndexError as shown below: In [1]: import enum In [2]: class X(enum.IntFlag): pass In [3]: Y = enum.IntFlag("Y", []) --- IndexErrorTraceback (most recent call last) in () > 1 Y = enum.IntFlag("Y", []) ~/lib/python3.6/enum.py in __call__(cls, value, names, module, qualname, type, start) 291 return cls.__new__(cls, value) 292 # otherwise, functional API: we're creating a new Enum type --> 293 return cls._create_(value, names, module=module, qualname=qualname, type=type, start=start) 294 295 def __contains__(cls, member): ~/lib/python3.6/enum.py in _create_(cls, class_name, names, module, qualname, type, start) 382 if isinstance(names, str): 383 names = names.replace(',', ' ').split() --> 384 if isinstance(names, (tuple, list)) and isinstance(names[0], str): 385 original_names, names = names, [] 386 last_values = [] IndexError: list index out of range -- messages: 295559 nosy: Gerrit.Holl priority: normal severity: normal status: open title: Cannot use functional API to create enum with zero values versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30616> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4180] warnings.simplefilter("always") does not make warnings always show up
Gerrit Holl added the comment: I believe this fix causes this bug: http://bugs.python.org/issue29672 -- nosy: +Gerrit.Holl ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4180> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29677] 'round()' accepts a negative integer for ndigits
Changes by Gerrit Holl <gerrit.h...@gmail.com>: -- pull_requests: +304 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29677> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29677] 'round()' accepts a negative integer for ndigits
Gerrit Holl added the comment: >>> round(21345, -2) 21300 Desired and useful to me. -- nosy: +Gerrit.Holl ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29677> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29672] `catch_warnings` context manager should reset warning registry to previous state upon exiting, to prevent warnings from being reprinted
Gerrit Holl added the comment: To resolve this, the `catch_warnings` context manager upon exiting should not only reset `filters`, but also `_filters_version`, and perhaps an associated dictionary? Not sure if I'm understanding the code in `warnings.c` correctly, and whether, for this change, it would suffice to change `warnings.py` or whether `warnings.c` would need to be updated as well. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29672> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29672] `catch_warnings` context manager should reset warning registry to previous state upon exiting, to prevent warnings from being reprinted
Changes by Gerrit Holl <gerrit.h...@gmail.com>: -- title: `catch_warnings` context manager causes warnings to be reprinted -> `catch_warnings` context manager should reset warning registry to previous state upon exiting, to prevent warnings from being reprinted ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29672> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29672] `catch_warnings` context manager causes warnings to be reprinted
Gerrit Holl added the comment: To clarify, this behaviour crosses module boundaries. So even if some piece of code many layers deep buried in a module uses this context manager, it has global consequences. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29672> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29672] `catch_warnings` context manager causes warnings to be reprinted
Gerrit Holl added the comment: I suppose this is a consequence of the change in: http://bugs.python.org/issue4180 and although I can see why the warnings filter would be reset when entering the context manager, I don't think it is desirable to have side effects for modules that are entirely unrelated. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29672> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29672] `catch_warnings` context manager causes warnings to be reprinted
New submission from Gerrit Holl: Entering the `catch_warnings` context manager is causing warnings to be printed over and over again, rather than just once as it should. Without such a context manager, the behaviour is as expected: $ cat ./mwe.py #!/usr/bin/env python3.5 import warnings for i in range(3): try: print(i, __warningregistry__) except NameError: print(i, "first warning") warnings.warn("I don't like this.", UserWarning) print(i, __warningregistry__) #with warnings.catch_warnings(): #pass print(i, __warningregistry__) warnings.warn("I don't like this.", UserWarning) $ ./mwe.py 0 first warning ./mwe.py:10: UserWarning: I don't like this. warnings.warn("I don't like this.", UserWarning) 0 {'version': 0, ("I don't like this.", , 10): True} 0 {'version': 0, ("I don't like this.", , 10): True} ./mwe.py:15: UserWarning: I don't like this. warnings.warn("I don't like this.", UserWarning) 1 {'version': 0, ("I don't like this.", , 15): True, ("I don't like this.", , 10): True} 1 {'version': 0, ("I don't like this.", , 15): True, ("I don't like this.", , 10): True} 1 {'version': 0, ("I don't like this.", , 15): True, ("I don't like this.", , 10): True} 2 {'version': 0, ("I don't like this.", , 15): True, ("I don't like this.", , 10): True} 2 {'version': 0, ("I don't like this.", , 15): True, ("I don't like this.", , 10): True} 2 {'version': 0, ("I don't like this.", , 15): True, ("I don't like this.", , 10): True} Uncommenting the context manager causes the warning to be printed every time: $ ./mwe.py 0 first warning ./mwe.py:10: UserWarning: I don't like this. warnings.warn("I don't like this.", UserWarning) 0 {'version': 0, ("I don't like this.", , 10): True} 0 {'version': 0, ("I don't like this.", , 10): True} ./mwe.py:15: UserWarning: I don't like this. warnings.warn("I don't like this.", UserWarning) 1 {'version': 2, ("I don't like this.", , 15): True} ./mwe.py:10: UserWarning: I don't like this. warnings.warn("I don't like this.", UserWarning) 1 {'version': 2, ("I don't like this.", , 15): True, ("I don't like this.", , 10): True} 1 {'version': 2, ("I don't like this.", , 15): True, ("I don't like this.", , 10): True} ./mwe.py:15: UserWarning: I don't like this. warnings.warn("I don't like this.", UserWarning) 2 {'version': 4, ("I don't like this.", , 15): True} ./mwe.py:10: UserWarning: I don't like this. warnings.warn("I don't like this.", UserWarning) 2 {'version': 4, ("I don't like this.", , 15): True, ("I don't like this.", , 10): True} 2 {'version': 4, ("I don't like this.", , 15): True, ("I don't like this.", , 10): True} ./mwe.py:15: UserWarning: I don't like this. warnings.warn("I don't like this.", UserWarning) I think this is undesirable. There is code deep inside a module that I'm using that is using the context manager, and as a consequence, I get warnings printed every time that should be printed only once. See also on Stack Overflow: http://stackoverflow.com/q/42496579/974555 -- messages: 288677 nosy: Gerrit.Holl priority: normal severity: normal status: open title: `catch_warnings` context manager causes warnings to be reprinted versions: Python 3.5 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29672> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29401] Python3.6 docs should not have a "what's new in Python 3.7" page
New submission from Gerrit Holl: I believe this page is not supposed to exist: https://docs.python.org/3.6/whatsnew/3.7.html Nor this one: https://docs.python.org/3.5/whatsnew/3.6.html Neither are maintained, nor would I expect them to be. -- assignee: docs@python components: Documentation messages: 286549 nosy: Gerrit.Holl, docs@python priority: normal severity: normal status: open title: Python3.6 docs should not have a "what's new in Python 3.7" page versions: Python 3.5, Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29401> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29155] test.test_spwd.TestSpwdNonRoot failure with FileNotFoundError:
New submission from Gerrit Holl: I am building and testing Python 3.6 on the JASMIN Analysis Platform <http://www.jasmin.ac.uk/services/jasmin-analysis-platform/>, which runs Red Hat Enterprise Linux Server release 6.8 on a machine with 48 × Intel(R) Xeon(R) CPU E7-4860 v2 @ 2.60GHz, 2 TiB RAM, and a PanFSⓇ <http://www.panasas.com/products/panfs> distributed file system. test.test_spwd.TestSpwdNonRoot is failing with FileNotFoundError. Below is the full verbose output of `./python -m test -v test_spwd`: == CPython 3.6.0 (default, Jan 4 2017, 14:11:04) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] == Linux-2.6.32-642.6.2.el6.x86_64-x86_64-with-redhat-6.8-Santiago little-endian == hash algorithm: siphash24 64bit == cwd: /home/users/gholl/src/Python-3.6.0/build/test_python_40357 == encodings: locale=UTF-8, FS=utf-8 Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0) Run tests sequentially 0:00:00 [1/1] test_spwd test_getspnam_exception (test.test_spwd.TestSpwdNonRoot) ... ERROR test_getspall (test.test_spwd.TestSpwdRoot) ... skipped 'root privileges required' test_getspnam (test.test_spwd.TestSpwdRoot) ... skipped 'root privileges required' == ERROR: test_getspnam_exception (test.test_spwd.TestSpwdNonRoot) -- Traceback (most recent call last): File "/home/users/gholl/src/Python-3.6.0/Lib/test/test_spwd.py", line 67, in test_getspnam_exception spwd.getspnam(name) FileNotFoundError: [Errno 2] No such file or directory -- Ran 3 tests in 0.002s FAILED (errors=1, skipped=2) test_spwd failed 1 test failed: test_spwd Total duration: 66 ms Tests result: FAILURE -- messages: 284651 nosy: Gerrit.Holl priority: normal severity: normal status: open title: test.test_spwd.TestSpwdNonRoot failure with FileNotFoundError: ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29155> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29155] test.test_spwd.TestSpwdNonRoot failure with FileNotFoundError:
Changes by Gerrit Holl <gerrit.h...@gmail.com>: -- versions: +Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29155> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29154] 5 failures in test_doctest: ModuleNotFoundError: No module named 'IPython'
Gerrit Holl added the comment: I get the same failure cause in test_pdb and test_zipimport_support, also in situations with tests based on doctest, again getting an unexpected `*** ModuleNotFoundError: No module named 'IPython'` -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29154> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29154] 5 failures in test_doctest: ModuleNotFoundError: No module named 'IPython'
New submission from Gerrit Holl: I am building and testing Python 3.6 on the JASMIN Analysis Platform <http://www.jasmin.ac.uk/services/jasmin-analysis-platform/>, which runs Red Hat Enterprise Linux Server release 6.8 on a machine with 48 × Intel(R) Xeon(R) CPU E7-4860 v2 @ 2.60GHz, 2 TiB RAM, and a PanFSⓇ <http://www.panasas.com/products/panfs> distributed file system. I am experiencing failures in test_doctest, specifically with `ModuleNotFoundError: No module named 'IPython'`. I don't know why it comes up with IPython at all. Below is the non-verbose test output. Attached is the verbose test output. $ ./python -m test test_doctest Run tests sequentially 0:00:00 [1/1] test_doctest ** File "/dev/shm/gerrit/Python-3.6.0/Lib/test/test_doctest.py", line 1841, in test.test_doctest.test_debug Failed example: try: doctest.debug_src(s) finally: sys.stdin = real_stdin Expected: > (1)() (Pdb) next 12 --Return-- > (1)()->None (Pdb) print(x) 12 (Pdb) continue Got: *** ModuleNotFoundError: No module named 'IPython' > (1)() (Pdb) next 12 --Return-- > (1)()->None (Pdb) print(x) 12 (Pdb) continue ** File "/dev/shm/gerrit/Python-3.6.0/Lib/test/test_doctest.py", line 1885, in test.test_doctest.test_pdb_set_trace Failed example: try: runner.run(test) finally: sys.stdin = real_stdin Expected: --Return-- > (1)()->None -> import pdb; pdb.set_trace() (Pdb) print(x) 42 (Pdb) continue TestResults(failed=0, attempted=3) Got: --Return-- *** ModuleNotFoundError: No module named 'IPython' > (1)()->None -> import pdb; pdb.set_trace() (Pdb) print(x) 42 (Pdb) continue TestResults(failed=0, attempted=3) ** File "/dev/shm/gerrit/Python-3.6.0/Lib/test/test_doctest.py", line 1914, in test.test_doctest.test_pdb_set_trace Failed example: try: runner.run(test) finally: sys.stdin = real_stdin Expected: --Return-- > (3)calls_set_trace()->None -> import pdb; pdb.set_trace() (Pdb) print(y) 2 (Pdb) up > (1)() -> calls_set_trace() (Pdb) print(x) 1 (Pdb) continue TestResults(failed=0, attempted=2) Got: --Return-- *** ModuleNotFoundError: No module named 'IPython' > (3)calls_set_trace()->None -> import pdb; pdb.set_trace() (Pdb) print(y) 2 (Pdb) up > (1)() -> calls_set_trace() (Pdb) print(x) 1 (Pdb) continue TestResults(failed=0, attempted=2) ** File "/dev/shm/gerrit/Python-3.6.0/Lib/test/test_doctest.py", line 1952, in test.test_doctest.test_pdb_set_trace Failed example: try: runner.run(test) finally: sys.stdin = real_stdin # doctest: +NORMALIZE_WHITESPACE Expected: --Return-- > (3)g()->None -> import pdb; pdb.set_trace() (Pdb) list 1 def g(x): 2 print(x+3) 3 -> import pdb; pdb.set_trace() [EOF] (Pdb) next --Return-- > (2)f()->None -> g(x*2) (Pdb) list 1 def f(x): 2 -> g(x*2) [EOF] (Pdb) next --Return-- > (1)()->None -> f(3) (Pdb) list 1 -> f(3) [EOF] (Pdb) continue ** File "foo-...@baz.py", line 7, in foo-bar@baz Failed example: f(3) Expected nothing Got: 9 TestResults(failed=1, attempted=3) Got: --Return-- *** ModuleNotFoundError: No module named 'IPython' > (3)g()->None -> import pdb; pdb.set_trace() (Pdb) list 1 def g(x): 2 print(x+3) 3 -> import pdb; pdb.set_trace() [EOF] (Pdb) next --Return-- > (2)f()->None -> g(x*2) (Pdb) list 1 def f(x): 2 -> g(x*2) [EOF] (Pdb) next --Return-- > (1)()->None -> f(3) (Pdb) list 1 -> f(3) [EOF] (Pdb) continue ** File "foo-...@baz.py", line 7, in foo-bar@baz Failed example: f(3) Expected nothing Got: 9 TestResults(failed=1, attempted=3) File "/dev/shm/gerrit/Python-3.6.0/Lib/test/test_doctest.py", line 2025, in test.test_doctest.test_pdb_set_trace_nested Failed example: try: runner.run(test) finally: sys.stdin = real_stdin # doctest: +REPORT_NDIFF Differences (ndiff with -expected +actual): + *** Mo
[issue23680] Sporadic freeze in test_interrupted_write_retry_text
Gerrit Holl added the comment: I experience this problem when trying to build/test Python 3.6 on the [JASMIN Analysis Platform](http://www.jasmin.ac.uk/services/jasmin-analysis-platform/) which runs Red Hat Enterprise Linux Server release 6.8 on a machine with 48 × Intel(R) Xeon(R) CPU E7-4860 v2 @ 2.60GHz, 2 TiB RAM, and a [PanFSⓇ](http://www.panasas.com/products/panfs) distributed file system. I experience this problem regardless whether I build/test Python 3.6 from within a PanFS filesystem or otherwise. ./python -m test -v test_io == CPython 3.6.0 (default, Jan 4 2017, 15:08:07) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] == Linux-2.6.32-642.6.2.el6.x86_64-x86_64-with-redhat-6.8-Santiago little-endian == hash algorithm: siphash24 64bit == cwd: /dev/shm/gerrit/Python-3.6.0/build/test_python_34342 == encodings: locale=UTF-8, FS=utf-8 Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0) Run tests sequentially 0:00:00 [1/1] test_io […snip many lines…] test_interrupted_write_retry_text (test.test_io.CSignalsTest) ... after which there is no more output. -- nosy: +Gerrit.Holl ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23680> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25415] I can create instances of io.IOBase
Gerrit Holl added the comment: When the documentation says there is no public constructor, I expected it would be impossible to create instances, as in: TypeError: cannot create 'builtin_function_or_method' instances Perhaps I misunderstand the documentation. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25415> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24538] os.setxattr PermissionError on panfs propagates up causing `copystat`, `copytree`, and `pip install .` to fail unhepfully
Changes by Gerrit Holl topjakl...@gmail.com: -- type: - crash ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24538 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24538] os.setxattr PermissionError on panfs propagates up causing `copystat`, `copytree`, and `pip install .` to fail unhepfully
New submission from Gerrit Holl: `shutil.copystat` fails on [panfs](https://en.wikipedia.org/wiki/Panasas#PanFS) if the source file lacks u+w, because setting extended attributes results in a `PermissionError`. This leads to higher end functions such as `shutil.copytree` to fail. More seriously, it leads to `pip install .` to fail, as I [reported here](https://github.com/pypa/pip/issues/2941): In [55]: shutil.copystat(/src/on/panfs, /tmp/fubar) --- PermissionError Traceback (most recent call last) ipython-input-55-139c9fc77184 in module() 1 shutil.copystat(/home/users/gholl/checkouts/pyatmlab/.git/objects/pack/pack-c1449559ec4287b3830efe2913608dddf2f21391.pack, /tmp/fubar) /home/users/gholl/lib/python3.4/shutil.py in copystat(src, dst, follow_symlinks) 211 else: 212 raise -- 213 _copyxattr(src, dst, follow_symlinks=follow) 214 215 def copy(src, dst, *, follow_symlinks=True): /home/users/gholl/lib/python3.4/shutil.py in _copyxattr(src, dst, follow_symlinks) 151 try: 152 value = os.getxattr(src, name, follow_symlinks=follow_symlinks) -- 153 os.setxattr(dst, name, value, follow_symlinks=follow_symlinks) 154 except OSError as e: 155 if e.errno not in (errno.EPERM, errno.ENOTSUP, errno.ENODATA): PermissionError: [Errno 13] Permission denied: '/tmp/fubar' This occurs for any source file where the user write bit is not set. Now, I'm not sure if this should be addressed in `pip`, `shutil.copytree`, `shutil.copystat`, `setxattr`, `panfs`, or in none of the above. I'm reporting it in different places; please close this issue if this is the wrong place. -- components: Library (Lib) messages: 245985 nosy: Gerrit.Holl priority: normal severity: normal status: open title: os.setxattr PermissionError on panfs propagates up causing `copystat`, `copytree`, and `pip install .` to fail unhepfully versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24538 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24538] os.setxattr PermissionError on panfs propagates up causing `copystat`, `copytree`, and `pip install .` to fail unhepfully
Gerrit Holl added the comment: Perhaps the solution would be some kind of flag, at least for copytree and possibly others, on what to do when attributes cannot be completely copied — a bit like numpys options to raise, warn, or ignore? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24538 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23832] pdb's `longlist` shows only decorator if that one contains a lambda
New submission from Gerrit Holl: When a decorater contains a `lambda` declaration, using the pdb command `longlist` will show only the definition of the decorator. The definition of the function itself is not shown: cat mini.py #!/usr/bin/python3.4 def foo(x, y=None): return x @foo(foo, lambda a:a) def spam(): 0+0 1+1 1/0 spam() $ python3.4 -mpdb mini.py /tmp/mini.py(3)module() - def foo(x, y=None): (Pdb) cont Traceback (most recent call last): File /usr/lib64/python3.4/pdb.py, line 1661, in main pdb._runscript(mainpyfile) File /usr/lib64/python3.4/pdb.py, line 1542, in _runscript self.run(statement) File /usr/lib64/python3.4/bdb.py, line 431, in run exec(cmd, globals, locals) File string, line 1, in module File /tmp/mini.py, line 3, in module def foo(x, y=None): File /tmp/mini.py, line 10, in spam 1/0 ZeroDivisionError: division by zero Uncaught exception. Entering post mortem debugging Running 'cont' or 'step' will restart the program /tmp/mini.py(10)spam() - 1/0 (Pdb) longlist 6 @foo(foo, lambda a:a) (Pdb) The last line illustrates the problem. `longlist` should show the definition of `spam`, not just the decorator. -- messages: 239749 nosy: Gerrit.Holl priority: normal severity: normal status: open title: pdb's `longlist` shows only decorator if that one contains a lambda type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23832 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21798] Allow adding Path or str to Path
New submission from Gerrit Holl: It would be great if we could add either str or Path to Path objects. Currently, we can join paths only by adding a directory, or by replacing the suffix. But sometimes we want to build up a path more directly. With strings we can do that simply by concatenating strings. It would be great if we could do the same with Path objects, like this: In [2]: b = pathlib.Path(/tmp/some_base) In [3]: b + _name.dat --- TypeError Traceback (most recent call last) ipython-input-3-939467ea0aa5 in module() 1 b + _name.dat TypeError: unsupported operand type(s) for +: 'PosixPath' and 'str' In [4]: b + pathlib.Path(_name.dat) --- TypeError Traceback (most recent call last) ipython-input-4-460bf8ac7710 in module() 1 b + pathlib.Path(_name.dat) TypeError: unsupported operand type(s) for +: 'PosixPath' and 'PosixPath' In [11]: b.with_name(b.name + _name.dat) # desired effect Out[11]: PosixPath('/tmp/some_base_name.dat') -- components: Library (Lib) messages: 220893 nosy: Gerrit.Holl priority: normal severity: normal status: open title: Allow adding Path or str to Path type: enhancement versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21798 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21728] Confusing error message when initialising type inheriting object.__init__
New submission from Gerrit Holl: When I initialise a class that doesn't define its own __init__, but I still pass arguments, the error message is confusing: class A: pass ... A(42) Traceback (most recent call last): File stdin, line 1, in module TypeError: object() takes no parameters Although it is correct that object() takes no parameters, it would be more correct to state that A() does not take any parameters. -- components: Interpreter Core messages: 220313 nosy: Gerrit.Holl priority: normal severity: normal status: open title: Confusing error message when initialising type inheriting object.__init__ type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21728 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20314] Potentially confusing formulation in 6.1.4. Template strings
New submission from Gerrit Holl: The standard library documentation “6.1. string — Common string operations” describes string formatting through the `.format` method and the corresponding mini-language, and the `Template` class. In the part describing the `Template` class (6.1.4) is the text: Instead of the normal %-based substitutions, Templates support $-based substitutions, using the following rules: This is potentially confusing. The documentation in this section has not made any mention of %-based substitutions. Rather, a novel reader may, at this point, think that {}-based substitution is normal. I would suggest to resolve this issue by simply not mentioning %-based substitutions, replacing the sentence above by: Templates support $-based substitutions, using the following rules: -- assignee: docs@python components: Documentation messages: 208553 nosy: Gerrit.Holl, docs@python priority: normal severity: normal status: open title: Potentially confusing formulation in 6.1.4. Template strings type: enhancement versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20314 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11494] Confusing error message from warnings.warn
New submission from Gerrit Holl topjakl...@gmail.com: When accidentally passing a string to warnings.warn where one should pass a Warning-class, the error message is rather confusing: $ ./python Python 2.7.1+ (release27-maint:88766, Mar 8 2011, 16:51:59) [GCC 4.4.5] on linux2 Type help, copyright, credits or license for more information. import warnings warnings.warn(aaa, bbb) Traceback (most recent call last): File stdin, line 1, in module TypeError: issubclass() arg 1 must be a class It would be better for the error message to say TypeError: warnings must be classes inherited from ... or something like that. -- components: Interpreter Core, Library (Lib) messages: 130800 nosy: Gerrit.Holl priority: normal severity: normal status: open title: Confusing error message from warnings.warn type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11494 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10563] Spurious newline in time.ctime
New submission from Gerrit Holl topjakl...@gmail.com: When the time passed to time.ctime is large, it adds a newline: import time time.ctime(236) 'Wed Apr 8 17:04:32 6325' time.ctime(237) 'Wed Jul 14 08:09:04 10680\n' -- components: Library (Lib) messages: 122665 nosy: Gerrit.Holl priority: normal severity: normal status: open title: Spurious newline in time.ctime versions: Python 2.6, Python 2.7, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10563 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10563] Spurious newline in time.ctime
Gerrit Holl topjakl...@gmail.com added the comment: I'm on a 64bit system (kubuntu lucid lynx) $ uname -a Linux sjisjka 2.6.32-25-generic #45-Ubuntu SMP Sat Oct 16 19:52:42 UTC 2010 x86_64 GNU/Linux -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10563 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10563] Spurious newline in time.ctime
Gerrit Holl topjakl...@gmail.com added the comment: Yes, this solves the issue: $ ./python Python 3.1.3 (r313:86834, Nov 28 2010, 17:34:23) [GCC 4.4.3] on linux2 Type help, copyright, credits or license for more information. import time time.ctime(240) 'Fri Apr 10 03:12:32 71654' -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10563 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: How can I know the name of caller
On Jun 19, 10:50 pm, Stefan Sonnenberg-Carstens [EMAIL PROTECTED] wrote: billiejoex schrieb: ...(if it is possible) how can I get, from method called, the name of function/method that called it (in this case caller)? inspect.stack is your friend ;-) If you start doing such things on a regular basis, it will sooner or later become your enemy. Gerrit. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a way to get utf-8 out of a Unicode string?
Hei, On 2006-10-30 08:25:41 +0100, thebjorn wrote: def unfk(s): return eval(repr(s)[1:]).decode('utf-8') i.e. chopping off the u in the repr of a unicode string, and relying on eval to interpret the \xHH sequences. Is there a less hack'ish way to do this? Slightly lack hackish: return ''.join(chr(ord(c)) for c in s) Gerrit. -- http://mail.python.org/mailman/listinfo/python-list
Re: A Comparison Of Dynamic and Static Languiges
On 2006-10-21 20:41:42 +0200, Scott M. wrote: Also, widely posting your real (unaltered) email address in forums like this is a sure way to get noticed by spammers. This newsgroup is mirrored by a mailing-list, so many people use their real address. The solution to spam is spamfiltering (spambayes), not hiding ones address on the internet. Gerrit. -- http://mail.python.org/mailman/listinfo/python-list
Re: matrix Multiplication
On 2006-10-18 14:15:17 +0200, Sssasss wrote: Fredrik Lundh wrote: Sssasss wrote: I wan't to multiply two square matrixes, and i don't understand why it doesn't work. def multmat(A,B): A*B if len(A)!=len(B): return error D=[] C=[] for i in range(len(A)): D.append(0) for i in range(len(A)): C.append(D) append doesn't copy data, so you're basically adding len(A) references to the same D list to C. for more on this, see: http://pyfaq.infogami.com/how-do-i-create-a-multidimensional-list /F Ok!! Tank you very much, i understand now. You might also want to look at numpy/numarray. Gerrit. -- http://mail.python.org/mailman/listinfo/python-list
Re: Best IDE?
On 2006-10-13 16:31:37 +0200, Ahmer wrote: Subject: Best IDE? cat foo.py How much does it cost? 0 -- http://mail.python.org/mailman/listinfo/python-list
Re: Motions.
On 2006-10-11 00:26:38 +0200, Dr. Pastor wrote: I would like to track the motions of small birds in short (20-30sec) .avi films. What tool-set/programs would be wise to use? Thanks for any guidance. I'd use PIL with numpy and subtract a birdless background picture from each picture. Make that binary (choose a suitable treshhold, 100 or so) and you'll get a matrix for each frame with value 1 for the position of the bird. Been there, done that, though my problem was slightly easier: I had a few dozen of equal balls flying around and all I needed was the average total position, not tracking each individually. How to do that if birds pass each other (projecting 3D on 2D) I don't know, but I'm sure it's been done before (not necessarily in Python though). Gerrit. -- http://mail.python.org/mailman/listinfo/python-list
Re: Using Gnutar to remove a list of files
On 2006-10-10 14:35:30 +0200, [EMAIL PROTECTED] wrote: Hi folks, I've got a question for yas. I'm trying to write code that will open up a gzipped tar file using gnutar, and copy the list of files(including their directories) to a list variable in python. From there, I want to go through the list and delete those files from my system. That part is easy, but what I'm stuck on is getting the list of files in an archive into a list variable. If I use the -t parameter in gnutar, it prints a list of the files in a seperate cmd screen, but only returns 0. Is there any way to make it return a list, or to copy the information over? Thanks in advance! Use the commands module. Or tarfile of course. http://docs.python.org/lib/module-commands.html http://docs.python.org/lib/module-tarfile.html Gerrit. -- http://mail.python.org/mailman/listinfo/python-list
Re: file system iteration
On 2006-10-09 14:45:35 +0200, rick wrote: import os.path paths = [] if os.path.isdir('A:/'): paths.append('A:/') if os.path.isdir('B:/'): paths.append('B:/') ... That's a kludge, but it works OK. I'm sure WMI may have a function that returns mounted volumes, but under the circumstances currently, I can only use the standard Python library. Any ideas on how to do this better? The very least you can try: import string string.ascii_uppercase for c in string.ascii_uppercase: if os.path.isdir('%s:/' % c): ... etc. But I suppose there should be a better way. Gerrit. -- http://mail.python.org/mailman/listinfo/python-list
Re: printing variables
On 2006-10-06 04:50:33 +0200, [EMAIL PROTECTED] wrote: say i have variables like these var1 = blah var2 = blahblah var3 = blahblahblah var4 = var5 = . bcos all the variable names start with var, is there a way to conveniently print those variables out... eg print var* ?? i don't want to do : print var1, var2, var3, var4 ..etc... Don't do this: import fnmatch var1, var2, var3 = foo, bar, baz for k in fnmatch.filter(locals(), var*): ... print locals()[k] ... foo baz bar This is evil. It's unpythonic. This is yet another way to do it - QED. Gerrit. -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 358 and operations on bytes
On 2006-10-04 05:10:32 +0200, John Machin wrote: - str methods endswith, find, partition, replace, split(lines), startswith, - Regular expressions I think those can be useful on a bytes type. Perhaps bytes and str could share a common parent class? They certainly share a lot of properties and possible operations one might want to perform. I look at it this way:: Processing text? Use unicode. Binary structures and file I/O, interfacing to 8-bit-wide channels? Use bytes. But can I use regular expressions on bytes? Regular expressions are not limited to text. Gerrit. -- http://mail.python.org/mailman/listinfo/python-list
PEP 358 and operations on bytes
Hi, In Python 3, reading from a file gives bytes rather than characters. Some operations currently performed on strings also make sense when performed on bytes, either if it's binary data or if it's text of unknown or mixed encoding. Those include of course slicing and other operators that exist in lists, but also other operations that aren't currently defined in PEP 358, like: - str methods endswith, find, partition, replace, split(lines), startswith, - Regular expressions I think those can be useful on a bytes type. Perhaps bytes and str could share a common parent class? They certainly share a lot of properties and possible operations one might want to perform. kind regards, Gerrit Holl. -- My first English-language post ever was made to this newsgroup: http://groups.google.com/group/comp.lang.python/msg/f957acf785ddfb71 :) -- http://mail.python.org/mailman/listinfo/python-list
Re: hello, I want to change n bytes of a binary file
could ildg wrote: b = encrypt(a) Thank you~~,but where is the encrypt defined? I suppose it's left as an exercise for the reader. Gerrit. -- Temperature in Kiruna, Lappland, Sweden: Tue Nov 1 15:35:25 2005 [UT] 2.6°C -- http://mail.python.org/mailman/listinfo/python-list
Re: your mail
Finn Waldrip wrote: X-Spambayes-Classification: unsure; 0.242 !DOCTYPE HTML PUBLIC -//IETF//DTD HTML 2.0//EN HTMLHEAD TITLE404 Not Found/TITLE /HEADBODY H1Not Found/H1 The requested URL was not found on this server.P HR ADDRESSApache/1.3.31/ADDRESS /BODY/HTML How can my poor Spambayes ever make sense of this? Gerrit. -- Temperature in Luleå, Norrbotten, Sweden: | Current temperature 05-10-17 22:29:599.6 degrees Celsius ( 49.2F) | -- Det finns inte dåligt väder, bara dåliga kläder. -- http://mail.python.org/mailman/listinfo/python-list
Re: Well written open source Python apps
Ben wrote: Could anyone suggest an open source project that has particularly well written Python? I am especially looking for code that people would describe as very Python-ic. (Not trying to start any kind of war - just wanted some good examples of a well written Python app to read.) Mailman - http://www.list.org/ Spambayes - http://www.spambayes.org Those are written by experienced Python programmers, some of them Python developers. It looks like well written code to me. Gerrit. -- Temperature in Luleå, Norrbotten, Sweden: | Current temperature 05-10-14 10:19:498.3 degrees Celsius ( 47.0F) | -- Det finns inte dåligt väder, bara dåliga kläder. -- http://mail.python.org/mailman/listinfo/python-list
Re: Problems with properties
Michael Schneider wrote: Could someone please point out my error, I have dents in my forehead for this one. -- from unittest import TestCase import unittest Here you need to add: __metaclass__ = type this will make your classes new-style. Gerrit. -- Temperature in Luleå, Norrbotten, Sweden: | Current temperature 05-10-14 17:59:487.9 degrees Celsius ( 46.3F) | -- Det finns inte dåligt väder, bara dåliga kläder. -- http://mail.python.org/mailman/listinfo/python-list
Re: Class methods
Laszlo Zsolt Nagy wrote: Oh man, it has been a long time I have read such an disturbing question. RTMF here: http://docs.python.org/lib/built-in-funcs.html#l2h-14 I feel I was a bit harsh. Of course, those posts do keep the Google count for the famous four-letter-abbreviation down (-; Gerrit. -- Temperature in Luleå, Norrbotten, Sweden: | Current temperature 05-10-05 21:59:48 10.7 degrees Celsius ( 51.3F) | -- Det finns inte dåligt väder, bara dåliga kläder. -- http://mail.python.org/mailman/listinfo/python-list
Re: A Moronicity of Guido van Rossum
Tony Meyer wrote: X-Spambayes-Classification: ham; 0.008 On 30/09/2005, at 10:56 PM, Gerrit Holl wrote: Tony Meyer wrote: X-Spambayes-Classification: ham; 0.048 Unless I'm misreading things, that's *my* message that scored 0.048 (the from:addr:ihug.co.nz, from:name:tony meyer, and spambayes tokens make it seem that way)... It is, and that's very surprising, but apparantly it was not really hammy enough. But don't worry, by ham_cutoff is 0.2, and out of the 10 'unsure' messages per week, 2 are spam, 2 are ham, and 6 are, well, unsure. Note that with all my mailinglists, the number of messages handled is more than 2500 per week, so I'm very, very happy with spambayes... Gerrit. -- Temperature in Luleå, Norrbotten, Sweden: | Current temperature 05-10-01 09:49:529.7 degrees Celsius ( 49.5F) | -- Det finns inte dåligt väder, bara dåliga kläder. -- http://mail.python.org/mailman/listinfo/python-list
Re: A Moronicity of Guido van Rossum
Tony Meyer wrote: X-Spambayes-Classification: ham; 0.048 X-Spambayes-Evidence: '*H*': 0.90; '*S*': 0.00; 'bug.': 0.07; 'flagged': 0.07; i'd: 0.08; 'bayes': 0.09; 'from:addr:ihug.co.nz': 0.09; 'really,': 0.09; 'cc:no real name:2**0': 0.14; 'from:addr:t-meyer': 0.16; 'from:name:tony meyer': 0.16; 'obvious,': 0.16; 'spambayes': 0.16; 'subject:Guido': 0.16; 'trolling,': 0.16; 'regret': 0.82; 'lee,': 0.91; 'viagra': 0.91; 'mailings': 0.93; 'probability': 0.93 This is a feature, not a bug. It's the same feature that means that messages talking about spam on the spambayes mailing list, or the legitimate mail I get about viagra wink, get through to me. True. However, most mail to this mailinglist has less than 0.001 spam probability. As you can see, this one had 0.048 - a vast score, almost enough to put it in my unsure box. It seems to be just not hammy enough. It's interesting to see that no none of the foul language words used by Xah Lee ever occurs in any spam I receive - spam is not that stupid. Gerrit. -- Temperature in Luleå, Norrbotten, Sweden: | Current temperature 05-09-30 12:49:54 11.1 degrees Celsius ( 51.9F) | -- Det finns inte dåligt väder, bara dåliga kläder. -- http://mail.python.org/mailman/listinfo/python-list
Re: A Moronicity of Guido van Rossum
Xah Lee wrote: ...What the fuck is the former? ...What the fuck would anyone to ...]”, is rather inane, as you can now see. ...What the fuck does it mean... ...you begin to write things like Java... Can you please alter the tone of your voice? Gerrit. -- Temperature in Luleå, Norrbotten, Sweden: | Current temperature 05-09-29 18:19:556.8 degrees Celsius ( 44.3F) | -- Det finns inte dåligt väder, bara dåliga kläder. -- http://mail.python.org/mailman/listinfo/python-list
Re: Documenting properties
Paul McNett wrote: Whatever is preferred, what's the upside/downsides of the two beyond what I just explained? Nothing really, but something handy to keep in mind is that the string literal (x) can be used to block out huge sections of code during testing, where you'd have to put a # in front of every line otherwise. Except, of course, code that contains string literals with triple quotes. And with a good editor, it's not too difficult to insert a # in front of hundreds of lines (:%s/^/#/g). Gerrit. -- Temperature in Luleå, Norrbotten, Sweden: | Current temperature 05-09-27 20:19:549.8 degrees Celsius ( 49.7F) | -- Det finns inte dåligt väder, bara dåliga kläder. -- http://mail.python.org/mailman/listinfo/python-list
Re: New-style classes questions
Diez B. Roggisch wrote: What is the reason for allowing both styles? (backwards compatibility??) yes. Note that there is another way to create new-style classes: __metaclass__ = type before the first class definition: class Foo: pass ... type(Foo) type 'classobj' __metaclass__ = type class Bar: pass ... type(Bar) type 'type' I like this. However, perhaps other people reading my source code won't like it, because when they see 'class Foo:', they might expect an old-style class. But it's so much better to type and to read, that I prefer this. Does the Python style guide have any severe penalty for using this? regards, Gerrit. -- Temperature in Luleå, Norrbotten, Sweden: | Current temperature 05-09-25 15:19:47 11.0 degrees Celsius ( 51.9F) | -- Det finns inte dåligt väder, bara dåliga kläder. -- http://mail.python.org/mailman/listinfo/python-list
Programming languages national brotherhood week
Hi, I have once seen a variant of national brotherhood week with programming languages; 'all the python folk hate alle the perl folk and all the ... hate all the ... and everybody hates Java', or something like that, but I can't find it anymore. Does anyone remember it and is anyone able to find it? It was quite funny, I think it was more than five years ago though. Gerrit. -- Temperature in Luleå, Norrbotten, Sweden: | Current temperature 05-09-24 15:59:53 12.1 degrees Celsius ( 53.9F) | -- Det finns inte dåligt väder, bara dåliga kläder. -- http://mail.python.org/mailman/listinfo/python-list
Re: defining __repr__
sven wrote: i'd like to define __repr__ in a class to return the standardrepr a la __main__.A instance at 0x015B3DA0 plus additional information. how would i have to do that? how to get the standardrepr after i've defined __repr__? object.__repr__(4) 'int object at 0x94f7d8c' Gerrit. -- Temperature in Luleå, Norrbotten, Sweden: | Current temperature 05-09-15 19:19:587.8 degrees Celsius ( 46.0F) | -- Det finns inte dåligt väder, bara dåliga kläder. -- http://mail.python.org/mailman/listinfo/python-list
Re: pre-PEP: Object-oriented file module
Kenneth McDonald wrote: Subject: pre-PEP: Object-oriented file module Please have a look at http://topjaklont.student.utwente.nl/creaties/path/pep-.html if you haven't done so already. Gerrit. -- Temperature in Luleå, Norrbotten, Sweden: | Current temperature 05-08-27 22:20:00 11.8 degrees Celsius ( 53.3F) | -- In the councils of government, we must guard against the acquisition of unwarranted influence, whether sought or unsought, by the military-industrial complex. The potential for the disastrous rise of misplaced power exists and will persist. -Dwight David Eisenhower, January 17, 1961 -- http://mail.python.org/mailman/listinfo/python-list
Re: [perl-python] Python documentation moronicities (continued)
Ivan Van Laningham wrote: Richie Hindle wrote: [Xah] motherfucking ... fucking ... fucking ... fucking ... fuck ... fucking fucking ... fucking ... mother fucking ... fucking ... piece of shit ... motherfucking ... fucking ... fucking ... big asshole ... masturbation ... Fucking morons ... fucking stupid ... fuckhead coders ... fuckheads ... you fucking asses. paypal me a hundred dollars and i'll rewrite the whole re doc in a few hours. Can we paypal you a hundred dollars to leave us alone? I'll pledge $10. Are there another nine people here who'll do the same? Why don't we pay him $100 to re-write the PERL docs? Interestingly, Richard Hindle's message was classified as ham by my spambayes, whereas your message was unsure. Could it be the second-to-last word doing it? (-; Gerrit. -- Weather in Twenthe, Netherlands 12/04 19:55: 13.0C wind 2.2 m/s NNW (57 m above NAP) -- In the councils of government, we must guard against the acquisition of unwarranted influence, whether sought or unsought, by the military-industrial complex. The potential for the disastrous rise of misplaced power exists and will persist. -Dwight David Eisenhower, January 17, 1961 -- http://mail.python.org/mailman/listinfo/python-list
Re: help with getting selection from wxChoice with out after it has changed
'@'.join([..join(['fred', 'dixon']), ..join(['gmail', 'com'])]) wrote: From: '@'.join([..join(['fred', 'dixon']), ..join(['gmail', 'com'])]) [EMAIL PROTECTED] This is a SyntaxError. You want to enclose the dots with '' marks as well, like this: '@'.join(['.'.join(['fred', 'dixon']), '.'.join(['gmail', 'com'])]) regards, Gerrit Holl. -- Weather in Twenthe, Netherlands 29/03 10:55: 10.0C mist overcast wind 0.9 m/s None (57 m above NAP) -- In the councils of government, we must guard against the acquisition of unwarranted influence, whether sought or unsought, by the military-industrial complex. The potential for the disastrous rise of misplaced power exists and will persist. -Dwight David Eisenhower, January 17, 1961 -- http://mail.python.org/mailman/listinfo/python-list
Re: [OT] Re: Hi Guys. First Time Poster
Jeff Schwab wrote: sheldon279 wrote: cut Wow, you sold me. Does this kinda scam really still work? This kind of replies works to confuse spambayes. Gerrit. -- Weather in Twenthe, Netherlands 20/03 16:55: 9.0C wind 4.0 m/s ENE (57 m above NAP) -- In the councils of government, we must guard against the acquisition of unwarranted influence, whether sought or unsought, by the military-industrial complex. The potential for the disastrous rise of misplaced power exists and will persist. -Dwight David Eisenhower, January 17, 1961 -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: 2005 International Obfuscated Ruby Code Contest (IORCC)
[EMAIL PROTECTED] wrote: IMMEDIATE RELEASE: Fri Mar 18 16:34:52 CST 2005 LOCATION: http://iorcc.dyndns.org/2005/press/031805.html ANNOUNCEMENT: International Obfuscated Ruby Code Contest (IORCC) Entry Deadline, Midnight on March 31st, 2005 Dear Rubyists, Perlists, Shellists, Cists and Hackers, What is this doing on comp.lang.python? regards, Gerrit Holl. -- Weather in Twenthe, Netherlands 20/03 16:55: 9.0C wind 4.0 m/s ENE (57 m above NAP) -- In the councils of government, we must guard against the acquisition of unwarranted influence, whether sought or unsought, by the military-industrial complex. The potential for the disastrous rise of misplaced power exists and will persist. -Dwight David Eisenhower, January 17, 1961 -- http://mail.python.org/mailman/listinfo/python-list
Re: Possible to import a module whose name is contained in a variable?
Ed Leafe wrote: On Mar 7, 2005, at 5:23 AM, Michael Hoffman wrote: Avoiding exec (which is a statement, not a function) is much more important. Since it executes arbitrary code, you can get unpredictable results from it. Is there any way to use __import__ to replace the following: exec(from %s import * % modulename) No. Gerrit. -- Weather in Twenthe, Netherlands 07/03 13:25: 4.0C Few clouds mostly cloudy wind 5.4 m/s NW (57 m above NAP) -- In the councils of government, we must guard against the acquisition of unwarranted influence, whether sought or unsought, by the military-industrial complex. The potential for the disastrous rise of misplaced power exists and will persist. -Dwight David Eisenhower, January 17, 1961 -- http://mail.python.org/mailman/listinfo/python-list