Re: "also" to balance "else" ?

2005-06-14 Thread John Roth
g until 3.0 to remove the old way of doing things. So "at end" or "on normal exit" could be put in any time; the use of "else" in that context wouldn't go away until 3.0. The real question is whether it's worth doing at all. I consider it a fairly minor iss

Re: __str__ vs __repr__

2005-06-15 Thread John Roth
ething that's meaningful to a human being when it's printed or otherwise rendered. repr() should be something that can round trip: that is, if you feed it into eval() it should reproduce the object. You can't always achieve either one, especially with very complex objects, but that's the goal. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: __str__ vs __repr__

2005-06-16 Thread John Roth
"Donn Cave" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Quoth "John Roth" <[EMAIL PROTECTED]>: > ... > | str() should be something that's meaningful to a human being when > | it's printed or otherwise rendered. >

Re: utf8 and ftplib

2005-06-16 Thread John Roth
d a unicode string on input; it got a character string already encoded in utf-8 format. The internal mechanism is first going to try to decode that into unicode before then encoding it into utf-8. Unfortunately, the default for encoding or decoding (outside of special contexts) is ASCII-7. So everything

Re: utf8 and ftplib

2005-06-17 Thread John Roth
"Richard Lewis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > On Thu, 16 Jun 2005 12:06:50 -0600, "John Roth" > <[EMAIL PROTECTED]> said: >> "Richard Lewis" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL

Re: Why is there no instancemethod builtin?

2005-06-18 Thread John Roth
n builtins. That's the function of the types module. The other point to be made here is that, in most cases, type checks are a design smell. That's not always true, but it's the first thing to check when you see one. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for an interpreter that does not request internet access

2007-06-25 Thread John Roth
ing the socket in promiscuous mode. Either one will give you that symptom. There are definitely anti-virus products that are that clueless. Scream at the vendor. I doubt if it's Idle, but I'm not in the mood to check the code to see if it's doing it right. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: Too many 'self' in python.That's a big flaw in this language.

2007-06-27 Thread John Roth
also makes your variable longer. > > >From My point,I think this only help python interpreter to deside > > where to look for. > Is there anyone know's how to make the interpreter find instance name > space first? > Or any way to make programmer's life easier? Guido ha

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-18 Thread John Roth
munity. I will most likely emphasize those in my documentation. Providing a method that would translate an arbitrary string into a valid Python identifier would be helpful. It would be even more helpful if it could provide a way of converting untranslatable characters. However, I suspect that the transla

Re: Python 3K or Python 2.9?

2007-09-14 Thread John Roth
It would ALSO eliminate a whole level of indirection in method invocation and get rid of the instancemethod, classmethod and staticmethod wrapper classes. This would be a significant simplification. If it had been done earlier, it would have eliminated most of the justification for method attributes (those silly @ things), thus showing that unneeded complexity breeds more unneeded complexity. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.0 migration plans?

2007-09-29 Thread John Roth
http://del.icio.us/steve.holden > > Sorry, the dog ate my .sigline I was thinking of starting work on converting Python FIT to 3.0, and then they posted PEP 3137. I think it's a real good idea, but it shows that 3.0a1 isn't ready for a conversion effort. http://www.python.org/de

Re: coverage.py: "Statement coverage is the weakest measure of code coverage"

2007-10-28 Thread John Roth
#x27;t have hooks where I need them, and it doesn't have a byte code dedicated to a debugging hook (I think). In other words, the current coverage.py tool is getting the most out of the available hooks: the ones we really need just aren't there. I'd probably opt to rewrite the pr

Re: coverage.py: "Statement coverage is the weakest measure of code coverage"

2007-10-29 Thread John Roth
quot;, or "do the tests exercise > the 'no iterations' case for this loop", et cetera. That is, whether > all the functional branches are exercised by tests, not whether the > language is parsed correctly. Since &#

Re: SWIG overhead

2007-02-01 Thread John Roth
to dig into the SWIG code before I could figure out what was going on. Bottom line: the c-types module was a lot smaller, in Python, and completely comprehensible. And while I didn't measure the performance, I doubt if it was slower. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: huge amounts of pure Python code broken by Python 2.5?

2007-02-06 Thread John Roth
epended on the default source coding. Fortunately, the fix is (not quite trivially) easy - just scan the library and put the right coding comment in the front. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows XP unicode and escape sequences

2007-12-13 Thread John Roth
res You've got two problems. First, you don't need to encode it; if the command prompt window displayed your output after encoding it would display the multi-byte form of your characters. You should just send it a unicode object. Second, check the .encoding attribute of the sys.stdout object. Th

Re: English-like Python

2009-01-16 Thread John Roth
ess natural language. The direction that natural language processing has taken in the last 50 years has come up lacking big-time. It does a good job in a single domain, but try to build something that crosses domains and nothing works. There isn't a good alternative in sight John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: Guido's new method definition idea

2008-12-06 Thread John Roth
y. In particular, the decorator problem goes away (the decorators are irrelevant, and can be ignored) and so does the problem with injecting a method into an object. It is, of course, harder to implement, and it would not be backwards compatible because all the internal wrappers vanish as well. That makes problems for anyone who is looking through __dict__ to find particular kinds of method. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: what should we use instead of the 'new' module?

2008-11-13 Thread John Roth
tance, not to a class. As another poster said, an instance method in a class is simply the function object. Static and class methods require wrappers, but those are both built-in functions and they also have decorators. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: 2to3 does not fix FileType from types Module; no replacement?

2009-03-18 Thread John Roth
x27;re checking for a > file type, you'll want to use isinstance(some_file, io.IOBase). If you're > inheriting form it, I suggest you look at the io module's classes. Nontheless, a warning would be helpful, possibly with some doc. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest: Calling tests in liner number order

2008-05-23 Thread John Roth
a random permutation as a way of flushing out intertest dependencies. > Does the following patch has a chance of being introduced in the > standard python distribution? I certainly hope not! John Roth Python FIT -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest: Calling tests in liner number order

2008-05-25 Thread John Roth
ecipe ( http://aspn.activestate.com/ASPN/Cookbook/Python/ ) or a note in the documentation with a caveat that it's not good practice, but it may be useful in some circumstances. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: How to make a function associated with a class?

2008-07-01 Thread John Roth
t implements it. The general pattern is to get the class for the first operand, check to see if it has the implementation method, and call it if present. If it doesn't, get the class for the other operand, check and if it has the method call it with the operands reversed. Then if it isn't

Re: Python 3.0 and removal of the 'string' module

2008-07-11 Thread John Roth
d that story around the campfire | > > _o__)                             and nobody got scared.” —Jack Handey | > > Ben Finney > > The PEPs are also a good source; library changes are all listed in PEP 3008. PEP 361 not only gives the schedule but it also gives a lot of detail

Re: Mutually referencing imports -- impossible?

2008-07-13 Thread John Roth
down the process of the import step by step. There are more productive ways of banging your head against the wall and going insane. In your situation, it might be a whole lot easier to extract a common superclass that both of your classes could inherit from. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggestion: Python global scope

2008-07-15 Thread John Roth
wrong way to go. Finally, as Gerhard Haring has said, it's backward incompatible, so the window for considering it has past: the 3.x series is pretty much frozen. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: str(bytes) in Python 3.0

2008-04-12 Thread John Roth
n that calling str() on a bytes object returns a bytes literal rather than an unadorned character string is that there are no default encodings or decodings: there is no way of determining what the corresponding string should be. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: Idea for P3K

2008-05-07 Thread John Roth
nd ==. I wouldn't mind seeing a way of assigning in the middle of an expression because it comes up fairly frequently when one needs to do a test and save the result at the same time. However I absolutely do not want to see the operator be =. However, if it's not =, then it opens another can of worms, that is, what to call it, and where it fits into the precedence structure. <-- might work. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: rspec for python

2008-08-25 Thread John Roth
them. Compare Rake and Scons - the Ruby and Python embedded DSL build systems that are intended to replace Make, Ant and similar external build DSLs. You can see the difference in fluency. John Roth Python FIT -- http://mail.python.org/mailman/listinfo/python-list

Re: power of explicit self?

2009-12-12 Thread John Roth
mpiler. There's a place in the runtime for invoking a method where the object is inserted at the beginning of the parameter list. IIRC, that's done by wrapping the function object. John Roth -- http://mail.python.org/mailman/listinfo/python-list

PEP 3147 - new .pyc format

2010-01-30 Thread John Roth
which object. Summary: I like it, but I think it needs a bit more work. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: Go versus Brand X

2009-11-21 Thread John Roth
not all) of the warts removed and some more modern features added. Brought to you by the same people who brought you C and Unix all those years ago. The use of the Plan 9 toolchain is not a coincidence. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: Docstrings considered too complicated

2010-02-25 Thread John Roth
ng to take more work to get the point across that comments that reproduce what the method name says are waste. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: Usable street address parser in Python?

2010-04-18 Thread John Roth
iness. There's a reason why commercial products come with huge data bases -- it's impossible to parse everything correctly with a single set of rules. Those data bases also contain the actual street names and address ranges by zip code, so that direct marketing files can be cleansed to US

Re: Another "Go is Python-like" article.

2010-05-21 Thread John Roth
hey know now. That's not a joke - look at the names on the development team. I haven't a clue how anyone can think it's similar to Python. Or Java, for that matter. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: Beyond the moratorium

2010-08-12 Thread John Roth
t;   `\      approaches zero. All non-Free software is a dead end.” —Mark | > _o__)                                                    Pilgrim, 2006 | > Ben Finney You might also want to look at PEP 3152, which was just posted. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: Overload print

2010-08-26 Thread John Roth
> > In [12]: f = Foo() > > In [13]: print f > foo Maybe what the OP really wants is the format() method on a string? That gives a very rich set of override options, at the expense of not using the print statement/method, including the ability to define your own formatting language for a class. John Roth -- http://mail.python.org/mailman/listinfo/python-list

Re: What the \xc2\xa0 ?!!

2010-09-07 Thread John Roth
tring] = unicode(value, 'UTF-8') > TypeError: decoding Unicode is not supported > > The solution I've arrived at is to specify the encoding for value > strings both when reading and writing value strings. > > for k, v in valuesDict.iteritems(): >     valuePair =

Re: Function Point Analysis (FPA) - Equivalent lines of code of Python

2010-09-10 Thread John Roth
th Paul, any global table trying to do that is going to be pretty bogus. John Roth -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3