Re: Good use for itertools.dropwhile and itertools.takewhile

2012-12-04 Thread Terry Reedy
On 12/4/2012 3:44 PM, Terry Reedy wrote: If the original string has no excess whitespace, description is what remains of s after product prefix is omitted. (Py 3 code) from itertools import takewhile def allcaps(word): return word == word.upper() def split_product_itertools(s): product

Re: why does dead code costs time?

2012-12-05 Thread Terry Reedy
) ... f('test') 42 This one is pretty scary The difference between `return None` and `return` leads to inconsistency and is in contradiction with the specs, AFAIK. I'm glad we pointed this out. You did not specify version, but I confirmed in 3.3.0. Please open a tracker i

Re: How does one make argparse print usage when no options are provided on the command line?

2012-12-05 Thread Terry Reedy
script name (it is operating system dependent whether this is a full pathname or not). If the command was executed using the -c command line option to the interpreter, argv[0] is set to the string '-c'. If no script name was passed to the Python interpreter, argv[0] is the empty

Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

2012-12-06 Thread Terry Reedy
wing error : Traceback (most recent call last): File "E:\Python\py32\itest4.py", line 20, in mdb.escape_string(img)) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte so how to fix it ? -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: mini browser with python

2012-12-06 Thread Terry Reedy
extract all the info as either text or a table and be able to format and place it how you want. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with usbtmc-communication

2012-12-06 Thread Terry Reedy
t it does in Python? I am not familiar with the protocol at all, but my guess (without looking at the octave code) is that two of these three commands > usbkeith.write("SYST:REM" + "\n") > usbkeith.write(":SENS:VOLT:PROT 1.5\n") > usbkeith.write(":OUTP:STAT

Re: question about importing a package

2012-12-06 Thread Terry Reedy
import sys as _sys from itertools import chain as _chain in the stdlib when the module author does not define __all__. 3) __init__.py acts like just another module, so you have to import the package contents that you want into it before you import the package into your code -- Terry Jan Reedy

Re: python 3.3 urllib.request

2012-12-07 Thread Terry Reedy
trol. So the only thing to do might be to change hardware and/or OS or have the program restart itself if it gets repeated errors. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Confused compare function :)

2012-12-07 Thread Terry Reedy
hing exceptions may be and often is as slow as the redundant check and even multiple redundant checks. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: accessing an OLE Automation (IDispatch) server from python which requires the use of "out params"

2012-12-10 Thread Terry Reedy
e app. I believe the easiest way to do that is to install the pywin extensions http://sourceforge.net/projects/pywin32/?source=directory I assume it can handle out params. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: String manipulation in python..NEED HELP!!!!

2012-12-11 Thread Terry Reedy
O(n*n) solution. Much better to build a list of chars and then join them. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Python parser problem

2012-12-12 Thread Terry Reedy
language has no limits. Implementations will, but they are larger than you will every write by hand. Auto-generated code that, for instance, nests a tuple more than 2**16 levels deep may have problems. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-12 Thread Terry Reedy
ing all the usual joys of reinventing the wheel. This deeper integration means that it could not be completely reimplemented in Python ;-). -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: samba 4 release

2012-12-12 Thread Terry Reedy
[end quote] As I understand, Active Directory is the center, so to speak, of a Windows server universe. The Wikipedia entry may be clearer than some of Microsoft's pages. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with unittest2

2012-12-13 Thread Terry Reedy
On 12/13/2012 10:03 AM, Daniel Laird wrote: All, I am new to python and am stuck with python 2.6 (Ubuntu 10.04 and dont want to force switch to 2.7) You can altinstall 2.7 and leave the system 2.6 alone. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: unpacking first few items of iterable

2012-12-13 Thread Terry Reedy
,b,c (1, 2, None) This has the advantage that if iterable has more than 3 items, 'it' is available to iterate over the rest. This is the standard idiom for removing a couple of special items before iterating over the remainder (when one does not want the remainder as a concrete list). -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Python version and svn

2012-12-13 Thread Terry Reedy
rsion. In any case, Python development was moved from svn to hg in March, 2011, before all current releases, so I am sure they do not have such. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: What are the minimum requirements to get a job in?

2012-12-14 Thread Terry Reedy
You are right. Critics before audience. And multiple people have been credited with the quote. http://www.barrypopik.com/index.php/new_york_city/entry/miss_one_day_of_practice_i_notice_miss_two_the_critics_notice_miss_three_th/ -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python

Re: Is there a quick & accurate way to test a python install?

2012-12-15 Thread Terry Reedy
to raise errors. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with web browser module

2012-12-15 Thread Terry Reedy
be nice if they came up the separate tabs within the same browser instance.:-) I believe this worked with Firefox the last time I tested. I just read the docs. Never tried IE. I believe details partly depend on browser. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a quick & accurate way to test a python install?

2012-12-15 Thread Terry Reedy
On 12/15/2012 9:21 PM, Gene Heskett wrote: On Saturday 15 December 2012 21:19:37 Terry Reedy did opine: On 12/15/2012 8:38 PM, Gene Heskett wrote: see 26.11.2. I'm not a python guru, Terry, so you will have to expand on this 26.11.2. http://docs.python.org/3/library/test.html#ru

Re: Is there a quick & accurate way to test a python install?

2012-12-15 Thread Terry Reedy
it is all or nothing. ImportError: cannot import name test_timeout I have no idea why this one gave an exception rather than a skip. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a quick & accurate way to test a python install?

2012-12-16 Thread Terry Reedy
On 12/16/2012 6:22 AM, Gene Heskett wrote: On Sunday 16 December 2012 01:33:35 Terry Reedy did opine: You appear to have some of /Lib/test/ present, including Lib/test/regrtest.py, but not move of the test_xxx.py files. I do not know what is normal for an Ubuntu distribution. On Windows, I

Re: Iterating over files of a huge directory

2012-12-17 Thread Terry Reedy
y about 15 bytes. By using 3.3 rather than 3.0-3.2, the all-ascii-char unicode paths only take 1 byte per char rather than 2 or 4. If you disagree with the responses on the issue, after reading them, post one yourself with real numbers. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode

2012-12-17 Thread Terry Reedy
is may be windows specific) which seems to works for all BMP (Basic Multilingual Plane) chars. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Why Isn't Multiple Inheritance Automatic in Python?

2012-12-17 Thread Terry Reedy
while I'm not convinced that this was the correct thing to do, Terry Reedy pointed out in the issue comments back in 2010 that the proper way to initialize immutable instances is by overriding __new__ rather than __init__, the former of which is still perfectly clean to inherit. It seems to

Re: where to view open() function's C implementation source code ?

2012-12-18 Thread Terry Reedy
On 12/18/2012 12:25 AM, iMath wrote: where to view open() function's C implementation source code ? depends on the python version. io in 3.x otherwise, it is a builtin -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Delete dict and subdict items of some name

2012-12-18 Thread Terry Reedy
rrect, YOU NEED TEST CASES. In fact, your original post should have contained at least one non-trivial test case: an input dict and what you wanted it to look like after processing. Writing at least some tests before code is a great idea. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: I need help with graphs in python (2.7.3.1)

2012-12-18 Thread Terry Reedy
) -- -- - infomation386 warning97 xx error 5 x critical 23 xxx The main problem is to compute the scaling factor from the data. You also have to decide on the rounding (I rounded up). -- Terry Jan Reedy -- http

Re: Is it possible monkey patch like this?

2012-12-18 Thread Terry Reedy
so) or must you leave it as is? Chris and Peter gave you answers for the former case. If the latter, you must copy and modify for the change you specified. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Brython - Python in the browser

2012-12-19 Thread Terry Reedy
vascript. I presume the same would be true if the javascript step were omitted and Python were directly compiled to the virtual machines defined by current javascript engines. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Fuzzy Logic Library for Python 3

2012-12-19 Thread Terry Reedy
ages with Python 3. I do not know about installation issues and how there are related to Py3. I would expect that most of the actual code should run with little or no change. The only change in arithmetic is int / int, and that can be given the Py3 meaning in 2.6/7 with a future import. -- T

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Terry Reedy
(without the quotes) echo the input as entered (with \U escapes) while 'print(s)' gets the same traceback you did. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Brython - Python in the browser

2012-12-19 Thread Terry Reedy
On 12/19/2012 7:54 PM, Ian Kelly wrote: On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy wrote: That says that my browser, Firefox 17, does not support HTML5. Golly gee. I don't think any browser support5 all of that moving target, and Gecko apparently supports about as large a subset as

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Terry Reedy
when the same thing can be done with both. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Terry Reedy
On 12/19/2012 10:12 PM, Westley Martínez wrote: On Wed, Dec 19, 2012 at 09:54:20PM -0500, Terry Reedy wrote: On 12/19/2012 9:03 PM, Chris Angelico wrote: On Thu, Dec 20, 2012 at 5:27 AM, Ian Kelly wrote: From what I've been able to discern, [jmf's] actual complaint about PEP 393

Re: Py 3.3, unicode / upper()

2012-12-20 Thread Terry Reedy
s been said, the bad cases I presented here are not corner cases. There is practically and systematically a regression in Py33 compared to Py32. I posted evidence otherwise. Jim never responded to those posts. Instead he repeats the falsehood refuted by evidence. That's very easy to

Re: Py 3.3, unicode / upper()

2012-12-20 Thread Terry Reedy
o be 'problematic'? Do you really think that getting wrong answers faster is better that getting right answers possibly slower? The 'find' operation is just 1 of about 30 that are tested by stringbench.py. Run that on 3.3 and 3.2, as I did, before talking about FSR as '

Re: Py 3.3, unicode / upper()

2012-12-20 Thread Terry Reedy
icode is here to serve anybody. This we agree on. Python3.3 unicode serves everybody better than 3.2 does. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Py 3.3, unicode / upper()

2012-12-20 Thread Terry Reedy
have the additional space-saving of the new scheme for ascii and latin-1 text. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Brython - Python in the browser

2012-12-20 Thread Terry Reedy
f you want to talk shape, I could argue that you should use -= for adding a sibling (horizontal link, -) and |= for adding a child (vertical link, |). Since you probably want to stick with += and like the 'arrowness' of <=, use the augmented assignment operator <<= instead of c

Re: Strange effect with import

2012-12-20 Thread Terry Reedy
nto the handle method of your version of MyTCPhandler. Or if you need to override multiple methods and use the same values in multiple methods, override __init__ and add self.x = x-value statements. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Brython - Python in the browser

2012-12-21 Thread Terry Reedy
you define a new operator that is unambiguous? Then the result is not exactly Python. The Python 3.3 Reference defines the Python 3.3 language. Supporting only a subset (as Brython does) is okay as long as the implementation only claims support for a subset (as Brython does). -- Terry Jan Reedy

Re: Second try: non-blocking subprocess pipe and Tkinter in 2.7

2012-12-21 Thread Terry Reedy
loops, including that of gui frameworks. Being able write a tk loop adapter and easily add io events and handlers to work along side with tk key and mouse events and write to a widjet should be an interesting test of the new framework. -- Terry Jan Reedy -- http://mail.python.org/mailman/lis

Re: redirect standard output problem

2012-12-22 Thread Terry Reedy
se state that you're using IDLE - it likely makes a difference! Indeed! Especially for i/o issues, retest in the command window;-). -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Plz Suggest... How can i install the pure python package py-bidi in WIndows.

2012-12-22 Thread Terry Reedy
don't and perhaps cannnot support Python 2 -- or even 3.2-. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-22 Thread Terry Reedy
filled up without any content. If you are going to post from google groups, learn how to do so without doubling the spaces each time. Also learn to snip what is not needed for your reply. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Python, email temperature

2012-12-23 Thread Terry Reedy
ot;, ".join(toaddrs))) The body is appended after the double return. A subject line and any other standard headers would go before. OT note: the PSF (Python Software Foundation) has bought a Raspberry PI and another ARM board to test Python on. I am happy to read that it seems to be worki

Re: Parsing files in python

2012-12-23 Thread Terry Reedy
the end of the file ppr.run(args) # Reads globals(), which python has nicely created for you, to create the master scene description and output whatever is needed for povray. It could be part of a template.py file you provide. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-23 Thread Terry Reedy
ect, then all of its attributes are also accessible, the same as from the original module. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing files in python

2012-12-24 Thread Terry Reedy
arly). What I meant was to not invent a domain-specific base language and syntax that is a complete replacement for an existing one. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread Terry Reedy
in an editor window, it stops with an interactive prompt in the shell window, and one can then enter code such as above.) Oh, by the way, after 7 days I'm completely in love with this python thing. I should have made the switch much earlier! Welcome to the club. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: pickle module doens't work

2012-12-27 Thread Terry Reedy
referring to 'Python-coded class' and 'code' is referring to '(compiled) Python code', and not machine code. Now, everything that pickle pickles is a 'class instance' and class code can be compiled from either Python or the interpreter's system language (

Re: Custom alphabetical sort

2012-12-27 Thread Terry Reedy
'r', 'R', 's', 'S', 't', 'T', 'u', 'U', 'ü', 'Ü', 'ú', 'Ú', 'û', 'Û', 'ù', 'Ù', 'v', 'V', 'w', 'W', 'x', 'X', 'y', 'Y', 'z', 'Z') One way is to create a list of 2-lists / 2-tuples, like [(modified_word_1, word_1), (modified_word_2, word_2), ...] and to use the native sorting wich will use the first element modified_word_2 as primary key. The task lies in the creation of the primary keys. I did it once for French (seriously) and for German (less seriously) scripts. (Only as an exercise for fun). >>> rob = ['noduleux', 'noël', 'noèse', 'noétique', ... 'nœud', 'noir', 'noirâtre'] >>> z = list(rob) >>> random.shuffle(z) >>> z ['noirâtre', 'noèse', 'noir', 'noël', 'nœud', 'noétique', 'noduleux'] >>> zo = libfrancais.sortfr(z) >>> zo ['noduleux', 'noël', 'noèse', 'noétique', 'nœud', 'noir', 'noirâtre'] >>> zo == rob True PS Py 3.3 warranty: ~30% slower than Py 3.2 Do you have any actual timing data to back up that claim? If so, please give specifics, including build, os, system, timing code, and result. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: learning curve

2012-12-28 Thread Terry Reedy
dletasks() self.apply() self.cancel() def cancel(self, event=None): # put focus back to the parent window self.parent.focus_set() self.destroy() # # command hooks def validate(self): ret

Re: email.message.Message - as_string fails

2012-12-28 Thread Terry Reedy
found a bug based on an untrue assumption. It is also possible that you missed a limitation in the doc, or tripped over an intended but not written limitation. So I hope you do the tracing, so if doc or code need a fix, a tracker issue can be opened. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: learning curve

2012-12-28 Thread Terry Reedy
tiation of your classes. Yes, as a matter of fact, it is the example verbatim from the tutorial pages that I found. Apparently, it isn't the best example... Let us say that it was an example of how to write classes, with usage left as an exercise for the reader ;-) -- Terry Jan

Re: dict comprehension question.

2012-12-29 Thread Terry Reedy
: 1, 4: 2, 5: 1, 6: 1} >>> Indeed, this is much better -- I didn't think of it.. It still turns an O(n) problem into an O(k*n) problem, where k is the number of distinct items. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: dict comprehension question.

2012-12-29 Thread Terry Reedy
more powerful because it can also do sequential interaction. Indeed, I would say that it should only be used when there is sequential interaction. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Confused about logger config from within Python (3)

2012-12-29 Thread Terry Reedy
rade of the module for nearly a decade now. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.3, gettext and Unicode problems

2012-12-30 Thread Terry Reedy
mputation and posters have wasted time looking for the error in the string or bytes computation itself. My interpretation of this output is that even though gettext correctly detects the MO file charset as UTF-8, it tries to encode the translated message with the system's "preferred e

Re: Python 3.3, gettext and Unicode problems

2012-12-30 Thread Terry Reedy
On 12/30/2012 8:48 PM, Terry Reedy wrote: On 12/30/2012 7:39 PM, Marcel Rodrigues wrote: I'm using Python 3.3 (CPython) and am having trouble getting the standard gettext module to handle Unicode messages. Addition to previous response. import gettext t = gettext.translation(&quo

Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread Terry Reedy
s name to end with an underscore ? No, it allows underscores. As I read that re, 'rx', etc, do match. They are two chars in the indicated sets. I disagree with requiring 2 chars, as .x, .y, are sometimes quite appropriate. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-03 Thread Terry Reedy
On 1/3/2013 9:19 AM, Mike C. Fletcher wrote: On 13-01-02 09:48 PM, Terry Reedy wrote: ... 2) self.lightDone: Invalid name "lightDone" (should match [a-z_][a-z0-9_]{2,30}$) So I can now understand that pylint doesn't like my naming convention with a capital letter in the middle

Re: Yet another attempt at a safe eval() call

2013-01-04 Thread Terry Reedy
pression parser/evaluator using ast, but it looked like that would take more code that the rest of the assembler combined, and I've got other higher-priority tasks to get back to. Will ast.literal_eval do what you want? -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: import of ttk

2013-01-04 Thread Terry Reedy
as well. The article I'm looking at is here - http://www.zetcode.com/gui/tkinter/introduction/ -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: reduce expression to test sublist

2013-01-05 Thread Terry Reedy
as an item in set1 is found that is not in set2. set(lst1) < set(lst2) will, and directly return False/True. The OP is trying to compute the lst1 < lst2, where lst1 and lst2 are interpreted as sets, rather than as sequences with the lexicographic ordering default. -- Terry Jan Ree

Re: reduce expression to test sublist

2013-01-05 Thread Terry Reedy
) is similar, except that all takes an iterable, so that the testing is done as part of the input iterable. def all(iterable): it = iter(iterable): for item in it: if not it: return False: else: return True def issublist(a, b): b = set(b) return all(item in b for item in a)

Re: python wiki gone?

2013-01-05 Thread Terry Reedy
nyone doing such a thing in the future: A replacement page "The Python wiki is off-line for maintenance." would have been nice. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: import of ttk

2013-01-05 Thread Terry Reedy
On 1/5/2013 2:21 PM, Verde Denim wrote: On 01/04/2013 11:39 PM, Terry Reedy wrote: On 1/4/2013 11:02 PM, Verde Denim wrote: In reading through one of the learning articles, I have a bit of code that imports ttk, but I apparently don't have this installed. I've looked up the svn ch

Re: Ubuntu Python -dbg packages

2013-01-06 Thread Terry Reedy
sr/bin/python3-dbg' [60300 refs] import PyQt4 [60323 refs] PyQt4.__file__ '/usr/lib/python3/dist-packages/PyQt4/__init__.py' [60323 refs] import PyQt4.QtCore Traceback (most recent call last): File "", line 1, in ImportError: No module named QtCore [150996 refs] -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Over 30 types of variables available in python ?

2013-01-06 Thread Terry Reedy
en. C programmers do not have easy direct access. However, virus writers learn to work with them ;-(. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Ubuntu Python -dbg packages

2013-01-06 Thread Terry Reedy
ts) ... skipped "can't run this test with mbcs as filesystem encoding" The others were for other posix-windows differences. Any ideas about the python3-pyqt4-dbg modules mentioned originally? No. I stuck to what looked like might be easier. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with Unicode char in Python 3.3.0

2013-01-07 Thread Terry Reedy
thon33\lib\encodings\cp437.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_map)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\U0001d11e' in posit ion 0: character maps to Yes, this is very annoying, especially in Win 7. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Vigil, the eternal morally vigilant programming language

2013-01-08 Thread Terry Reedy
output is indeed a permutation of the unmutated input items, before checking that they are are actually sorted. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with Unicode char in Python 3.3.0

2013-01-08 Thread Terry Reedy
On 1/7/2013 8:12 AM, Terry Reedy wrote: On 1/7/2013 7:57 AM, Franck Ditter wrote: <<< print('\U0001d11e') Traceback (most recent call last): File "", line 1, in print('\U0001d11e') UnicodeEncodeError: 'UCS-2' codec can't encode c

Re: test failed: test_urlwithfrag

2013-01-08 Thread Terry Reedy
(To everyone else, I already explained that the error message means exactly what it says and listed the test_url files that do exist. No need to repeat a third time.) -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: [Offtopic] Line fitting [was Re: Numpy outlier removal]

2013-01-08 Thread Terry Reedy
0,0, a line eyeballed with a clear ruler could easily be better than either regression line, as a human will tend to minimize the deviations *perpendicular to the line*, which is the proper thing to do (assuming both variables are measured in the same units). -- Terry Jan Reedy -- http://mai

Re: socket.makefile raises ValueError when mode = 'rt'

2013-01-09 Thread Terry Reedy
t be explicitly given to have effect) contradicts the later code. I think you should open an issue on the tracker suggesting that 't' be added to the mode check and that the doc mention the remaining mode limitation. In the meanwhile, your ftpfile.__init__ could remove t from the mode before passing it on. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Why BOM in logging message?

2013-01-10 Thread Terry Reedy
ease with bug patches before we release a new official bugfix release. 2.7.4, with many bugfixes, is still to see the light of day. The pattern of which machines have the August code and which have the April code correlates with when we rolled out each server instance. Great detective w

Re: PyWart: Import resolution order

2013-01-11 Thread Terry Reedy
s to import random.exponential. The import fails and they post here, having forgotten about their own random.py, which does not have such a function. Posts like this happen a few times a year. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: pylint or similar to test version-specific language constructs?

2013-01-11 Thread Terry Reedy
he ternary operator, decorators) which are version-specific. Search each chapter of the reference manual (about 7) for 'version changed'. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with importing in Python

2013-01-11 Thread Terry Reedy
fferent things with casing. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: String concatenation benchmarking weirdness

2013-01-12 Thread Terry Reedy
A"*1000).find("B") (*1000) 0.980.63155.1 "B" in "A"*1000 (*1000) 0.660.6699.7("A"*1000).partition("B") (*1000) 0.770.77100.4 ("A"*1000).rfind("B") (*1000) 0.660.6699.7("A"*1000).rpartition("B") (*1000) 0.880.88100.4 ("A"*1000).rsplit("B", 1) (*1000) 0.880.87101.2 ("A"*1000).split("B", 1) (*1000) == no match, two characters 1.191.2198.1("AB"*1000).find("BC") (*1000) 1.792.5171.2("AB"*1000).find("CA") (*1000) 1.281.08119.1 "BC" in "AB"*1000 (*1000) 1.102.1152.1("AB"*1000).partition("BC") (*1000) 2.372.37100.0 ("AB"*1000).rfind("BC") (*1000) 1.361.36100.5 ("AB"*1000).rfind("CA") (*1000) 2.252.2699.9("AB"*1000).rpartition("BC") (*1000) 2.382.6290.7("AB"*1000).rsplit("BC", 1) (*1000) 1.181.3090.1("AB"*1000).split("BC", 1) (*1000) == quick replace multiple character match 0.120.3237.1("A" + ("Z"*128*1024)).replace("AZZ", "BBZZ", 1) (*10) == quick replace single character match 0.120.3037.9("A" + ("Z"*128*1024)).replace("A", "BB", 1) (*10) == repeat 1 character 10 times 0.080.0990.3"A"*10 (*1000) == repeat 1 character 1000 times 0.160.1982.2"A"*1000 (*1000) == repeat 5 characters 10 times 0.110.1298.3"ABCDE"*10 (*1000) == repeat 5 characters 1000 times 0.400.5867.9"ABCDE"*1000 (*1000) == replace and expand multiple characters, big string 1.952.1391.7"...text.with.2000.newlines...replace("\n", "\r\n") (*10) == replace multiple characters, dna 2.933.2590.3dna.replace("ATC", "ATT") (*10) == replace single character 0.250.2696.6"This is a test".replace(" ", "\t") (*1000) == replace single character, big string 0.731.0172.0"...text.with.2000.lines...replace("\n", " ") (*10) == replace/remove multiple characters 0.300.3489.0"When shall we three meet again?".replace("ee", "") (*1000) == split 1 whitespace 0.120.1393.3("Here are some words. "*2).partition(" ") (*1000) 0.110.1198.8("Here are some words. "*2).rpartition(" ") (*1000) 0.320.3786.5("Here are some words. "*2).rsplit(None, 1) (*1000) 0.320.3396.9("Here are some words. "*2).split(None, 1) (*1000) == split 2000 newlines 1.762.1980.5"...text...".rsplit("\n") (*10) 1.722.1081.9"...text...".split("\n") (*10) 1.872.5872.4"...text...".splitlines() (*10) == split newlines 0.360.34103.9 "this\nis\na\ntest\n".rsplit("\n") (*1000) 0.350.33105.9 "this\nis\na\ntest\n".split("\n") (*1000) 0.310.3489.7"this\nis\na\ntest\n".splitlines() (*1000) == split on multicharacter separator (dna) 2.182.3493.4dna.rsplit("ACTAT") (*10) 2.502.6494.5dna.split("ACTAT") (*10) == split on multicharacter separator (small) 0.59 0.62 95.3 "this--is--a--test--of--the--emergency--broadcast--system".rsplit("--") (*1000) 0.55 0.59 93.1 "this--is--a--test--of--the--emergency--broadcast--system".split("--") (*1000) == split whitespace (huge) 1.542.3465.5human_text.rsplit() (*10) 1.512.2268.3human_text.split() (*10) == split whitespace (small) 0.460.6076.5("Here are some words. "*2).rsplit() (*1000) 0.450.5187.6("Here are some words. "*2).split() (*1000) == startswith multiple characters 0.180.1897.3"Andrew".startswith("Andrew") (*1000) == startswith multiple characters - not! 0.180.18100.1 "Andrew".startswith("Anders") (*1000) == startswith single character 0.170.1896.8"Andrew".startswith("A") (*1000) == strip terminal newline 0.110.2152.0s="Hello!\n"; s[:-1] if s[-1]=="\n" else s (*1000) 0.060.0792.1"\nHello!".rstrip() (*1000) 0.060.0792.2"Hello!\n".rstrip() (*1000) 0.060.0791.2"\nHello!\n".strip() (*1000) 0.060.0791.1"\nHello!".strip() (*1000) 0.060.0791.1"Hello!\n".strip() (*1000) == strip terminal spaces and tabs 0.070.0789.4"\t \tHello".rstrip() (*1000) 0.070.0791.4"Hello\t \t".rstrip() (*1000) 0.040.0588.7"Hello\t \t".strip() (*1000) == tab split 0.570.56100.8 GFF3_example.rsplit("\t", 8) (*1000) 0.530.53100.7 GFF3_example.rsplit("\t") (*1000) 0.490.49101.2 GFF3_example.split("\t", 8) (*1000) 0.510.49103.5 GFF3_example.split("\t") (*1000) 102.13 125.57 81.3TOTAL -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: stringbench (was Re: String concatenation benchmarking weirdness)

2013-01-12 Thread Terry Reedy
On 1/12/2013 6:42 AM, Chris Angelico wrote: On Sat, Jan 12, 2013 at 10:31 PM, Terry Reedy wrote: 0.410.4395.2("WHERE IN THE WORLD IS CARMEN SAN DEIGO?"*10).lower() Why does stringbench misspell the name Carmen Sandiego? Copyright avoidance? Or ignorance. Perhaps I w

Re: ANN: Python training "text movies"

2013-01-12 Thread Terry Reedy
once instead of char by char, and with the extra features mentioned above. I presume the purported advantage over an after-the-fact transcript is focusing watcher attention on each entry and response. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the variables (read or write)

2013-01-14 Thread Terry Reedy
ad, 'lst' is written to. What about: self.lst.append(self.lst[-1]+self.lst[-2]) (which might collect Fibonacci numbers)? 'self' read, 'lst' read and written. Knowing that for non-builtins is another matter ;-). -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: code explanation

2013-01-14 Thread Terry Reedy
ikely find the answer in the reference manual, especially the section on def statements. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: atexit handler in IDLE?

2013-01-15 Thread Terry Reedy
* work in 3.x. When I run this on the command line I see: This is my program Program is ending... OK.. that's all folks! When I run this in IDLE I see: This is my program Program is ending... But the atexit handler is never called. ;-( I tried in 3.3 idle and get the same. -- Te

Re: cymbalic reference?

2013-01-15 Thread Terry Reedy
ould I use to print "the-class-I-am-in good" instead of hard-coding "Abc good"? I tried __class_ and self.__class__ self.__class__.__name__ or type(self).__name__) -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: PyWart: Exception error paths far too verbose

2013-01-16 Thread Terry Reedy
The only thing special that IDLE does now is to color the text red. I should sometime see how that is done. (Being able to doubleclick on an item and have IDLE open an edit window at the specified line would be really nice!) -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: cymbalic reference?

2013-01-16 Thread Terry Reedy
use it is in use for c in d: print(c) So maybe I want {Abc:'http://example.com'} and o = s() instead. Yes, as I suggested. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: PyWart: Exception error paths far too verbose

2013-01-16 Thread Terry Reedy
On 1/16/2013 11:43 AM, Rick Johnson wrote: On Wednesday, January 16, 2013 3:53:55 AM UTC-6, Terry Reedy wrote: I agree with the complaint and you may have the germ of a good idea. The problem is that for some tracebacks, paths jump all over the place rather than having a common prefix. Dealing

Re: iterating over the lines of a file - difference between Python 2.7 and 3?

2013-01-17 Thread Terry Reedy
her implementations to match actual behavior to. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Thorough Python 2.7.3 Windows Build Documentation?

2013-01-17 Thread Terry Reedy
same pitfall that cost me performance so that we can all get the most out of Python. Any and all help will be greatly appreciated. Thanks. The 'documentation' of how we build Python on Windows is the PCBuild directory in the source tree. -- Terry Jan Reedy -- http://mail.python.o

Re: Any built-in ishashable method ?

2013-01-18 Thread Terry Reedy
was really difficult to spot. Yeh, see the example above ;-). -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Any built-in ishashable method ?

2013-01-18 Thread Terry Reedy
would make hashing pointless!). -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Question related to multiprocessing.Process

2013-01-19 Thread Terry Reedy
p.start() This is documented in 17.2.3. Programming guidelines 17.2.3.2. Windows -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Messing with the GC

2013-01-19 Thread Terry Reedy
unt add 2 instead of 1, as f seems to? I don't know, but perhaps because it is written in C rather than Python and Python code objects are different from C code.) -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: PyWart: Exception error paths far too verbose

2013-01-20 Thread Terry Reedy
x27;t have to scroll through page after page of irrelevant text they've already read. Thank you. Quite aside from the fact that there already was a quick reply telling me the same thing. A properly threaded reader would have placed it just below my post. -- Terry Jan Reedy -- http:

<    1   2   3   4   5   6   7   8   9   10   >