[Python-announce] unittest_expander 0.4.4 released

2023-03-21 Thread Jan Kaliszewski
pander library provides. Homepage: https://github.com/zuo/unittest_expander PyPI: https://pypi.org/project/unittest-expander/ Documentation: https://unittest-expander.readthedocs.io/en/stable/ Cheers, Jan Kaliszewski (zuo) z...@kaliszewski.net ___

[Python-announce] unittest_expander 0.4.3 released

2023-03-20 Thread Jan Kaliszewski
ovides. Homepage: https://github.com/zuo/unittest_expander PyPI: https://pypi.org/project/unittest-expander/ Documentation: https://unittest-expander.readthedocs.io/en/stable/ Cheers, Jan Kaliszewski (zuo) ___ Python-announce-list mailing list -- python-an

[Python-announce] unittest_expander 0.4.0 released

2023-03-16 Thread Jan Kaliszewski
pander/ Documentation: https://unittest-expander.readthedocs.io/en/stable/ Cheers, Jan Kaliszewski (zuo) https://unittest-expander.readthedocs.io/en/stable/;>unittest_expander 0.4.0 - a library that provides flexible and easy-to-use tools to parametrize Python unit tests. (

[issue20751] Harmonize descriptor protocol documentation: direct call, super binding with Descriptor Howto docs

2021-12-12 Thread Jan Kaliszewski
Jan Kaliszewski added the comment: Sure. But don't you think there should be ``.__get__(a, type(a))`` rather than ``.__get__(a, A)``? Then the whole statement would be true regardless of whether A is the actual type of a, or only a superclass of the type of a. That would also be more

[issue20751] Harmonize descriptor protocol documentation: direct call, super binding with Descriptor Howto docs

2021-12-07 Thread Jan Kaliszewski
Jan Kaliszewski added the comment: I am very sorry, I just noticed another mistake. It should be: A dotted lookup such as ``super(A, obj).x`` (where ``obj`` is an instance of ``A`` or of a subclass of ``A``) searches ``type(obj).__mro__`` for such a base class ``B`` that follows

[issue20751] Harmonize descriptor protocol documentation: direct call, super binding with Descriptor Howto docs

2021-12-07 Thread Jan Kaliszewski
Jan Kaliszewski added the comment: Sorry, a few mistakes distorted my proposal. It should be: A dotted lookup such as ``super(A, obj).x`` (where ``obj`` is an instance of ``A`` or of a subclass of ``A``) searches ``A.__mro__`` for a base class whose `__dict__` contains name ``&q

[issue20751] Harmonize descriptor protocol documentation: direct call, super binding with Descriptor Howto docs

2021-12-07 Thread Jan Kaliszewski
Jan Kaliszewski added the comment: So the current (after the aforementioned commit) form of the description is: A dotted lookup such as ``super(A, a).x`` searches ``obj.__class__.__mro__`` for a base class ``B`` following ``A`` and then returns ``B.__dict__['x'].__get__

[issue23232] 'codecs' module functionality + its docs -- concerning custom codecs, especially non-string ones

2015-01-13 Thread Jan Kaliszewski
New submission from Jan Kaliszewski: To some extent, this issue is a follow-up of Issue 20132. It concerns some parts of functionality + documentation of the 'codecs' module related to registering custom codecs, especially non-string ones (i.e., codecs that encode/decode between arbitrary

[issue23232] 'codecs' module functionality + its docs -- concerning custom codecs, especially non-string ones

2015-01-13 Thread Jan Kaliszewski
Jan Kaliszewski added the comment: Sorry, s/Issue 20132/Issue 19548/g Issue 20132 is also related somehow, but here I ment that this is a follow-up of Issue 19548; and Zoinkity's concerns I cited are also from Issue 19548, and not from 20132

[issue19539] The 'raw_unicode_escape' codec buggy + not appropriate for Python 3.x

2014-12-25 Thread Jan Kaliszewski
Changes by Jan Kaliszewski z...@chopin.edu.pl: -- resolution: - duplicate status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19539

[issue19539] The 'raw_unicode_escape' codec buggy + not appropriate for Python 3.x

2014-12-25 Thread Jan Kaliszewski
Jan Kaliszewski added the comment: My concerns are now being addressed in the issue19548. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19539

unittest_expander 0.3.0 released

2014-08-17 Thread Jan Kaliszewski
PyPI: https://pypi.python.org/pypi/unittest_expander Documentation: http://unittest-expander.readthedocs.org/en/latest/ Cheers, Jan Kaliszewski (zuo) -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf

[issue20751] Misleading examples indDescriptor protocol documentation

2014-02-23 Thread Jan Kaliszewski
New submission from Jan Kaliszewski: 1. One misleading detail in the descriptor protocol documentation for super bindings is that the following fragment of the http://docs.python.org/reference/datamodel.html#invoking-descriptors page: Super Binding If a is an instance of super

[issue20751] Misleading examples in the descriptor protocol documentation

2014-02-23 Thread Jan Kaliszewski
Changes by Jan Kaliszewski z...@chopin.edu.pl: -- title: Misleading examples indDescriptor protocol documentation - Misleading examples in the descriptor protocol documentation ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue19539] The 'raw_unicode_escape' codec buggy + not apropriate for Python 3.x

2013-11-10 Thread Jan Kaliszewski
Jan Kaliszewski added the comment: Which means that the description Produce a string that is suitable as raw Unicode literal in Python source code is (in Python 3.x) no longer true. So, if change/removal is not possible because of internal significance of the codec, I believe

[issue19548] 'codecs' module docs improvements

2013-11-10 Thread Jan Kaliszewski
New submission from Jan Kaliszewski: When learning about the 'codecs' module I encountered several places in the docs of the module that, I believe, could be improved to be clearer and easier for codecs-begginers: 1. Ad `codecs.encode` and `codecs.decode` descriptions: I believe it would

[issue19548] 'codecs' module docs improvements

2013-11-10 Thread Jan Kaliszewski
Jan Kaliszewski added the comment: s/world/word s/begginers/beginners (sorry, it's late night here) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19548

[issue19548] 'codecs' module docs improvements

2013-11-10 Thread Jan Kaliszewski
Jan Kaliszewski added the comment: 8. Again ad `codecs.open`: the default file mode is actually 'rb', not 'r'. 9. Several places in the docs -- ad: `codecs.register_error`, `codecs.open`, `codecs.EncodedFile`, `Codec.encode/decode`, `codecs.StreamWriter/StreamReader` -- do not cover cases

[issue19548] 'codecs' module docs improvements

2013-11-10 Thread Jan Kaliszewski
Jan Kaliszewski added the comment: 11. Ad encoding 'undefined': The sentence `Can be used as the system encoding if no automatic coercion between byte and Unicode strings is desired.` was suitable for Python 2.x, but not for Python 3.x'. I believe, this sentence should be removed

[issue19548] 'codecs' module docs improvements

2013-11-10 Thread Jan Kaliszewski
Changes by Jan Kaliszewski z...@chopin.edu.pl: -- versions: -Python 2.6, Python 2.7, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19548

[issue19539] The 'raw_unicode_escape' codec buggy + not apropriate for Python 3.x

2013-11-09 Thread Jan Kaliszewski
New submission from Jan Kaliszewski: It seems that the 'raw_unicode_escape' codec: 1) produces data that could be suitable for Python 2.x raw unicode string literals and not for Python 3.x raw unicode string literals (in Python 3.x \u... escapes are also treated literally); 2) seems

[issue18858] dummy_threading lacks threading.get_ident() equivalent

2013-08-27 Thread Jan Kaliszewski
New submission from Jan Kaliszewski: In Python 3.3 threading.get_ident() has been added as a public and documented function, but there is no dummy_threading.get_ident(): import threading, dummy_threading threading.get_ident() 139974728402752 dummy_threading.get_ident

[issue18533] Avoid error from repr() of recursive dictview

2013-07-22 Thread Jan Kaliszewski
Jan Kaliszewski added the comment: As I wrote on the list -- IMHO it's still a bug (even though not so painful as segfault) that should also be fixed in 2.7 and 3.2/3.3. In other cases (such as `d={}; d[42]=d; repr(d)`) Python does its best to avoid an error -- why in this case (`d={}; d[42

[issue7796] No way to find out if an object is an instance of a namedtuple

2011-03-31 Thread Jan Kaliszewski
Jan Kaliszewski z...@chopin.edu.pl added the comment: PS. For the record: the final recipe is here: http://code.activestate.com/recipes/577629-namedtupleabc-abstract-base-class-mix-in-for-named/ -- ___ Python tracker rep...@bugs.python.org http

[issue7796] No way to find out if an object is an instance of a namedtuple

2011-03-28 Thread Jan Kaliszewski
Jan Kaliszewski z...@chopin.edu.pl added the comment: Thank you. Raymond is against the idea so I don't know if it makes sense to create the real patch for now (it would patch the collections module and, I suppose, addming tests, docs etc.). Anyway, if somebody would be interested in the idea

[issue7796] No way to find out if an object is an instance of a namedtuple

2011-03-27 Thread Jan Kaliszewski
Jan Kaliszewski z...@chopin.edu.pl added the comment: On python-ideas I have proposed an ABC being also a kind of a mix-in, potentially making namedtuple subclassing (with custom methods etc.) more convenient, e.g.: class MyRecord(namedtuple.abc): _fields = 'x y z' def

[issue7796] No way to find out if an object is an instance of a namedtuple

2011-03-27 Thread Jan Kaliszewski
Jan Kaliszewski z...@chopin.edu.pl added the comment: PS. Newer, shorter version: http://dpaste.org/2aiQ/ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7796

[issue9232] Allow trailing comma in any function argument list.

2010-12-13 Thread Jan Kaliszewski
Changes by Jan Kaliszewski z...@chopin.edu.pl: -- nosy: +zuo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9232 ___ ___ Python-bugs-list mailing

[issue9232] Allow trailing comma in any function argument list.

2010-12-13 Thread Jan Kaliszewski
Jan Kaliszewski z...@chopin.edu.pl added the comment: From 10682: The patch proposed in this (#9232) issue does not fix call syntax but def sytax only. I think it should fix call sytax as well (see code examples in #10682). -- ___ Python tracker

[issue9232] Allow trailing comma in any function argument list.

2010-12-13 Thread Jan Kaliszewski
Jan Kaliszewski z...@chopin.edu.pl added the comment: python-dev discussion continuation: http://mail.python.org/pipermail/python-dev/2010-December/106770.html -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9232

[issue10682] With '*args' or even bare '*' in def/call argument list, trailing comma causes SyntaxError

2010-12-11 Thread Jan Kaliszewski
New submission from Jan Kaliszewski z...@chopin.edu.pl: Let examples speak: def x(a, z): pass # this is ok def x(a, z,): pass # this is ok def x(a, *, z): pass # this is ok in Py3k def x(a, *, z,): pass # but this causes SyntaxError (!) def x(a, *args): pass

[issue10682] With '*args' or even bare '*' in def/call argument list, trailing comma causes SyntaxError

2010-12-11 Thread Jan Kaliszewski
Jan Kaliszewski z...@chopin.edu.pl added the comment: s/**{5: 6}/**{'5': 6}/g (but it's a detail) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10682

[issue10682] With '*args' or even bare '*' in def/call argument list, trailing comma causes SyntaxError

2010-12-11 Thread Jan Kaliszewski
Jan Kaliszewski z...@chopin.edu.pl added the comment: Oops, I see the problem was partly addressed @ issue9232. But: * the proposed patch doesn't fix calls (but defs only), * shouldn't be the issue considered as a bug -- and fixed also in 2.7 and 3.1

Re: open(False) in python3

2010-05-12 Thread Jan Kaliszewski
Terry Reedy dixit (2010-05-12, 14:26): On 5/12/2010 1:26 PM, Giampaolo Rodolà wrote: 2010/5/12 Gabriel Genellinagagsl-...@yahoo.com.ar: open() in Python 3 does a lot of things; it's like a mix of codecs.open() + builtin open() + os.fdopen() from 2.x all merged together. It does different

[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Jan Kaliszewski
New submission from Jan Kaliszewski z...@chopin.edu.pl: del list_instance([start : stop : very_big_step]) causes segfaults... The boundary values seem to be: * start -- near length of the list * stop -- near (-length) of the list * very_big_step -- near sys.maxint Let examples speak... from

[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Jan Kaliszewski
Jan Kaliszewski z...@chopin.edu.pl added the comment: ** Erratum ** -- was: del list_instance([start : stop : very_big_step]) causes segfaults... -- should be: del list_instance[start : stop : very_big_step] causes segfaults... ** Post scriptum ** In each example only the last statement causes

[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Jan Kaliszewski
Jan Kaliszewski z...@chopin.edu.pl added the comment: Interesting that in Py2.5... del range(10)[::maxint] ...this causes segfault but in Py2.6 is ok, as well as in Py3.0 (with maxsize insetad of maxint). (That's why I didn't noticed that it concerns newer version than 2.5, and marked only

[issue7788] segfault when deleting from a list using slice with very big `step' value

2010-01-26 Thread Jan Kaliszewski
Jan Kaliszewski z...@chopin.edu.pl added the comment: PS. Is such a data-dependant segfault considered as security problem? (if it is, maybe Python2.5 shuld be kept in Versions list) -- ___ Python tracker rep...@bugs.python.org http

Re: how can i know if a python object have a attribute such as 'attr1'?

2010-01-25 Thread Jan Kaliszewski
defined (see: http://docs.python.org/reference/datamodel.html#slots). Regards, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: Consume an iterable

2010-01-24 Thread Jan Kaliszewski
: 2.37005710602 consume3 10: 1.6071870327 100: 1.61109304428 1000: 1.60717701912 None: 1.81885385513 Regards, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: how to list the attributes of a class, not an object?

2010-01-24 Thread Jan Kaliszewski
as to the attributes of the dict_keys class. but i don't know how to look at that without first *creating* such an instance, then asking for dir(dk). Why you bother about creating an instance? Just do it: list(vars(type({}.keys( or dir(type({}.keys())) if dir() satisfies you. Regards, *j -- Jan

PS.

2010-01-24 Thread Jan Kaliszewski
24-01-2010, 16:56:42 Jan Kaliszewski z...@chopin.edu.pl wrote: 24-01-2010, 16:28:26 Robert P. J. Day rpj...@crashcourse.ca wrote once again, probably a trivial question but i googled and didn't get an obvious solution. how to list the attributes of a *class*? dir(type(an_obj

Re: Consume an iterable

2010-01-24 Thread Jan Kaliszewski
: 12.5794699192 None: 28.5096430779 consume3 10: 2.39173388481 100: 3.43043398857 1000: 14.3361399174 None: 14.8560190201 Regards, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: how to list the attributes of a class, not an object?

2010-01-24 Thread Jan Kaliszewski
24-01-2010, 17:37:41 Alf P. Steinbach al...@start.no wrote: DictKeys = type( {}.keys() ) dir( DictKeys ) list( vars( DictKeys ) ) help( DictKeys ) It doesn't help much though because the only method of interrest is __iter__ Not only. Please, consider: dictkeys =

Re: Consume an iterable

2010-01-24 Thread Jan Kaliszewski
=70296pathrev=70296 Nice. :) *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

[issue7764] dictview

2010-01-24 Thread Jan Kaliszewski
Changes by Jan Kaliszewski z...@chopin.edu.pl: -- title: Doc for itertools recipe consume is complicated and less efficient - dictview versions: -Python 2.6, Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue7764] Doc for itertools recipe consume is complicated and less efficient

2010-01-24 Thread Jan Kaliszewski
Changes by Jan Kaliszewski z...@chopin.edu.pl: -- title: dictview - Doc for itertools recipe consume is complicated and less efficient ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7764

[issue7764] Doc for itertools recipe consume is complicated and less efficient

2010-01-24 Thread Jan Kaliszewski
Jan Kaliszewski z...@chopin.edu.pl added the comment: (sorry! typed into a wrong field) -- nosy: +zuo versions: +Python 2.6, Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7764

[issue7771] dict view comparison methods are not documented

2010-01-24 Thread Jan Kaliszewski
New submission from Jan Kaliszewski z...@chopin.edu.pl: Dictionary views documentation (e.g. http://docs.python.org/3.1/library/stdtypes.html#dictionary-view-objects) contains nothing about comparison ( = = == !=) operations. -- assignee: georg.brandl components: Documentation

Re: enumerated while loop

2010-01-23 Thread Jan Kaliszewski
23-01-2010 o 15:49:23 Diez B. Roggisch de...@nospam.web.de wrote: Am 23.01.10 15:44, schrieb Roald de Vries: Dear all, I sometimes want to use an infinite while loop with access to the loop index, like this: def naturals(): i = 0 while True: yield i y += 1 for i in naturals(): print(i) I

Re: Symbols as parameters?

2010-01-22 Thread Jan Kaliszewski
. Please also note that you can apply not only str-based symbols but any hashable objects (obviously it could be event implemented in less efficient way to accept *any* objects, though I doubt it's worth to do...). Regards, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http

Re: Symbols as parameters?

2010-01-22 Thread Jan Kaliszewski
s/sollution/solution s/event implemented/even implemented Sorry *j -- http://mail.python.org/mailman/listinfo/python-list

Re: [2.5.1.1/dictionary] Change sorting order?

2010-01-22 Thread Jan Kaliszewski
). If the list were immutable, no searching would be needed (indexes would be sufficient), but in real life users can be added and deleted in the meantime (so index of a particular name changes). Regards, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo

Re: Consume an iterable

2010-01-22 Thread Jan Kaliszewski
, the following code? def consume(iterator, n): for _ in islice(iterator, n): pass Probably the former is faster. But I haven't check it. If you are curious, use timeit module... Regards, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: [2.5.1.1/dictionary] Change sorting order?

2010-01-22 Thread Jan Kaliszewski
PS. 22-01-2010 o 15:44:28 Jan Kaliszewski z...@chopin.edu.pl wrote: 22-01-2010, 14:58:58 Gilles Ganault nos...@nospam.com wrote: On 22 Jan 2010 13:35:26 GMT, Neil Cerutti ne...@norwich.edu wrote: Resorting is more work than is needed. Just choose a different starting index each time you

Re: Sorted dictionary

2010-01-21 Thread Jan Kaliszewski
://code.activestate.com/recipes/576998/). Regards, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorted dictionary

2010-01-21 Thread Jan Kaliszewski
Dnia 21-01-2010 o 08:49:22 Chris Rebert c...@rebertia.com napisał(a): On Wed, Jan 20, 2010 at 5:50 PM, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Thu, 21 Jan 2010 02:02:02 +0100, Jan Kaliszewski wrote: http://code.activestate.com/recipes/576998/ What's the advantage

Re: Sorted dictionary

2010-01-21 Thread Jan Kaliszewski
Dnia 21-01-2010 o 09:27:52 Raymond Hettinger pyt...@rcn.com napisał(a): On Jan 20, 5:02 pm, Jan Kaliszewski z...@chopin.edu.pl wrote: http://code.activestate.com/recipes/576998/ Using an underlying list to track sorted items means that insertion and deletion take O(n) time. That could

Sorted dictionary

2010-01-20 Thread Jan Kaliszewski
curious about your opinions. Regards, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] [RELEASED] Python 2.7 alpha 2

2010-01-09 Thread Jan Kaliszewski
Hello, I have a question: are class decorator planned to be backported from 3.x? All the best, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] [RELEASED] Python 2.7 alpha 2

2010-01-09 Thread Jan Kaliszewski
09-01-2010 o 22:34:28 Jack Diederich jackd...@gmail.com wrote: On Sat, Jan 9, 2010 at 2:53 PM, Jan Kaliszewski z...@chopin.edu.pl I have a question: are class decorator planned to be backported from 3.x? Eh? Class decorators have been in the 2.x series since 2.6. Oops, I overlooked

Re: Transforming a List of elements into a List of lists of elements

2010-01-08 Thread Jan Kaliszewski
), (5, None)] See: http://docs.python.org/library/functions.html#zip http://docs.python.org/library/functions.html#map http://docs.python.org/library/itertools.html#itertools.izip_longest Cheers, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: Transforming a List of elements into a List of lists of elements

2010-01-08 Thread Jan Kaliszewski
PS. Sorry, I wrote: zip(*[iter(s)]*3) # or simpler: zip(s) :-) But should be zip(*[iter(s)]*1) # or simpler: zip(s) :-) *j -- http://mail.python.org/mailman/listinfo/python-list

Re: How to execute a script from another script and other script does notdo busy wait.

2010-01-07 Thread Jan Kaliszewski
Rajat rajat.dud...@gmail.com wrote: I've single CPU machine. I've a feeling that the thread created, which would run script2, would eat up all of the CPU if I do not use sleep() in script2. That way, script1 would still be waiting for script2 to finish. Single CPU is not a problem for

Re: File transfer with python

2010-01-07 Thread Jan Kaliszewski
Valentin de Pablo Fouce thi...@gmail.com wrote: On 6 ene, 22:42, Jan Kaliszewski z...@chopin.edu.pl wrote: Valentin de Pablo Fouce thi...@gmail.com wrote: Ok, I am trying to do a very quick application (is home based so is not a big deal...). My intention is to transfer files from one

Re: File transfer with python

2010-01-06 Thread Jan Kaliszewski
: http://docs.python.org/library/simplehttpserver.html http://docs.python.org/library/cgihttpserver.html http://docs.python.org/library/basehttpserver.html -- as well as: http://docs.python.org/library/urllib.html http://docs.python.org/library/urllib2.html Cheers, *j -- Jan Kaliszewski (zuo) z

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Jan Kaliszewski
(booze, juice), Bottle(booze, juice)) for booze, juice in product(liquors, juices)) -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: assert type([]) == type(())

2010-01-02 Thread Jan Kaliszewski
However the following is not an error for x in []: assert type(x) == type(()) Trying to iterate over an empty sequence or iterator causes 0 (zero) steps of iteration -- so above assert statement is never run. Cheers, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http

Re: Thread performance on Python 2.6

2009-12-31 Thread Jan Kaliszewski
31-12-2009 Rodrick Brown rodrick.br...@gmail.com wrote: I started dabbling with threads in python and for some odd reason the performance seems extremely poor on my 2 core system. It this a simplified version spawn 2 threads write some data to a file and time the results vs doing the same

Re: mod, modulo and % under 2.4 and 2.5

2009-12-31 Thread Jan Kaliszewski
01-01-2010 o 02:30:20 W. eWatson wolftra...@invalid.com wrote: About a year ago, I wrote a program that used mod() for modulo under 2.5. Apparently, % is also acceptable, but the program works quite well. I turned the program over to someone who is using 2.4, and apparently 2.4 knows

Re: class version of func_globals?

2009-12-30 Thread Jan Kaliszewski
and objects as values), use: mod = sys.modules[MyClass.__module__] # (as above) vars(mod) # or mod.__dict__, though vars(mod) seems to me more elegant Cheers, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: possible attribute-oriented class

2009-09-07 Thread Jan Kaliszewski
08-09-2009 o 02:15:10 Steven D'Aprano st...@pearwood.info wrote: On Mon, 7 Sep 2009 09:37:35 am Jan Kaliszewski wrote: 06-09-2009 o 20:20:21 Ethan Furman et...@stoneleaf.us wrote: ... I love being able to type current_record.full_name == last_record.full_name instead

Re: Q on explicitly calling file.close

2009-09-06 Thread Jan Kaliszewski
... finally: f.close() Obviously it doesn't substitute catching with 'except', but I don't see how it could disturb that. Cheers, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: possible attribute-oriented class

2009-09-06 Thread Jan Kaliszewski
is still important area of Python usage). -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: possible attribute-oriented class

2009-09-05 Thread Jan Kaliszewski
05-09-2009 Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Fri, 04 Sep 2009 22:37:15 +0200, Jan Kaliszewski wrote: Named tuples (which indeed are really very nice) are read-only, but the approach they represent could (and IMHO should) be extended to some kind of mutable objects

Re: Usage of main()

2009-09-04 Thread Jan Kaliszewski
to using the __main__ idiom (i.e. 'if __name__ == __main__:' condition). Cheers, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: Usage of main()

2009-09-04 Thread Jan Kaliszewski
app-logic code in functions -- because, as we noted: * in practice it is considerably faster, * it helps you with using functions class browsers. Cheers, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: possible attribute-oriented class

2009-09-04 Thread Jan Kaliszewski
it? Cheers, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: possible attribute-oriented class

2009-09-04 Thread Jan Kaliszewski
04-09-2009 Ken Newton krnew...@gmail.com wrote: I like this version very much. I'm ready to put this into practice to see how it works in practice. [snip] Not only you (Ken) and me. :-) It appears that the idea is quite old. Nick Coghlan replied at python-id...@python.org: Jan Kaliszewski

Re: using queue

2009-09-03 Thread Jan Kaliszewski
work relatively the best with a powerful single core; with more cores it becomes being suprisingly inefficient. The culprit is Pythn GIL and the way it [mis]cooperates with OS scheduling. See: http://www.dabeaz.com/python/GIL.pdf Yo *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http

Re: Creating slice notation from string

2009-09-02 Thread Jan Kaliszewski
(:)])] [3] Of course, you could also do something like this: eval('x' + s) or eval(str(x) + s) -- but it's worse: less secure (e.g. if s could be user-typed) and most probably much more time-consuming (especially the latter). Cheers, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http

Re: Creating slice notation from string

2009-09-02 Thread Jan Kaliszewski
Erratum: eval(str(x) + s) -- but it's worse: less secure (e.g. if s could be user-typed) and most probably much more time-consuming (especially the latter). There should be *repr* instead of *str*. *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman

Re: Creating slice notation from string

2009-09-02 Thread Jan Kaliszewski
recent call last): File stdin, line 1, in module ValueError: invalid literal for int() with base 10: '' Similar problem with [2:]. Ideas? x = [1,4,3,5,4,6,5,7] s = '[3:6]' x[slice(*((int(i) if i else None) for i in s.strip([]).split(:)))] Cheers, *j -- Jan

Re: map

2009-09-01 Thread Jan Kaliszewski
('booHoo'))) Cheers, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: Efficient way to sum a product of numbers...

2009-08-31 Thread Jan Kaliszewski
, 5.7318859100341797] -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: Efficient way to sum a product of numbers...

2009-08-31 Thread Jan Kaliszewski
31-08-2009 o 22:28:56 Jan Kaliszewski z...@chopin.edu.pl wrote: setup = from itertools import starmap, imap ; from operator import mul; import random, string; names = [rndom.choice(string. ascii_letters) for x in xrange(1)]; hours = [random.randint( 1, 12) for x in xrange(1000)]; m = zip

Re: Overriding iadd for dictionary like objects

2009-08-30 Thread Jan Kaliszewski
PS. Sorry for sending 2 posts -- the latter is the correct one. Cheers, *j -- http://mail.python.org/mailman/listinfo/python-list

Re: An assessment of the Unicode standard

2009-08-30 Thread Jan Kaliszewski
such an unification would mean terrible impoverishment of our (humans') culture and, as a result, terrible squandering of our intelectual, emotional, cognitive etc. potential -- especially if such unification were a result of intentional policy (and not of a slow and 'patient' process of synthesis). *j -- Jan

Re: copy construtor question

2009-08-29 Thread Jan Kaliszewski
') ...but in such cases as copying existing objects it is usualy better (though less romantic :-)) to use an ordinary function (e.g. simply copy.copy() or copy.deepcopy(), as Gabriel has pointed). Regards, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help with Python scoping rules

2009-08-27 Thread Jan Kaliszewski
that detail, I fully agree. *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help with Python scoping rules

2009-08-26 Thread Jan Kaliszewski
such recursive references in Python). -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: all possible matchings of elements of two lists

2009-08-26 Thread Jan Kaliszewski
is to get all possible permutations of two lists given and select any combination and use zip to get the tuples. Repeat this for all possible combinations. Any other ideas? See: module itertools -- there are (OOTB) some combinatoric generators that may be useful for you. *j -- Jan Kaliszewski (zuo

Re: Need help with Python scoping rules

2009-08-26 Thread Jan Kaliszewski
): if n 2: return 1 else: return n * fact(fact, n - 1) fact(fact, 3) *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: Overriding iadd for dictionary like objects

2009-08-26 Thread Jan Kaliszewski
int.__add__(self, other) # can do something more interesting 47 48 49 if __name__ == '__main__': 50 d = VerboseDict() 51 52 print(d['a'] = 3) 53 d['a'] = MyInt(3) 54 55 print(d['a'] += 3) 56 d['a'] += MyInt(3) *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http

Re: Overriding iadd for dictionary like objects

2009-08-26 Thread Jan Kaliszewski
['a'] = MyInt(3) 54 55 print(d['a'] += 3) 56 d['a'] += MyInt(3) *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help with Python scoping rules

2009-08-25 Thread Jan Kaliszewski
*when it's called as a method* (what is possible *after* creating the class = outside the definition). Cheers, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it a bug?

2009-08-25 Thread Jan Kaliszewski
- ...) -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

Re: break unichr instead of fix ord?

2009-08-25 Thread Jan Kaliszewski
that it too now fails with characters outside the BMP. [snip] Does not this effectively make unichr() and ord() useless on Windows for all but a subset of unicode characters? Are you sure, you couldn't have UCS-4-compiled Python distro for Windows?? :-O *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl

Re: Using 'apply' as a decorator, to define constants

2009-08-22 Thread Jan Kaliszewski
21-08-2009 o 18:09:02 alex23 wuwe...@gmail.com wrote: Unfortunately, apply() has been removed as a built-in in 3.x. You can always implement it yourself :) def apply(function, args=(), keywords={}): return function(*args, **keywords) -- Jan Kaliszewski (zuo) z...@chopin.edu.pl

Re: Annoying octal notation

2009-08-22 Thread Jan Kaliszewski
-- it'd be also inconsistent with *Python* conventions, i.e.: 0x - hex prefix 0b - bin prefix Cheers, *j -- Jan Kaliszewski (zuo) z...@chopin.edu.pl -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >