Re: [Python-Dev] readd u'' literal support in 3.3?

2011-12-08 Thread Shane Hathaway
On 12/07/2011 11:31 PM, Chris McDonough wrote: All I can really offer is my own experience here based on writing code that needs to straddle Python 2.5, 2.6, 2.7 and 3.2 without use of 2to3. Having u'' work across all of these would mean porting would not require as much eyeballing as code modifi

[Python-Dev] Test, please ignore

2008-07-18 Thread Shane Hathaway
... ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Re: [Python-Dev] Implementing restricted Python in Zope2

2008-07-18 Thread Shane Hathaway
ranjith kannikara wrote: As a student I am not familiar with Restricted Python and python AST implementation.And in need of help to start the Restricted Python implementation. Here is some context for Python-Dev. RestrictedPython is a custom Python compiler that, when combined with a restrict

Re: [Python-Dev] Explicit Tail Calls

2007-10-12 Thread Shane Hathaway
Adam Olsen wrote: > Since they're not going to be accepted into python anyway, the > implementation is off-topic for python-dev. Please take them up > elsewhere (such as my offer to discuss in private.) I was aware of Guido's earlier rejections, but I figured the rejection was due to the risky im

Re: [Python-Dev] Explicit Tail Calls

2007-10-12 Thread Shane Hathaway
Shane Hathaway wrote: > Shane Hathaway wrote: >> I'm interested in seeing a good way to write tail calls in Python. Some >> algorithms are more readable when expressed using tail recursion. > > About ten seconds after I wrote the previous message, I realized two things:

Re: [Python-Dev] Explicit Tail Calls

2007-10-12 Thread Shane Hathaway
Shane Hathaway wrote: > I'm interested in seeing a good way to write tail calls in Python. Some > algorithms are more readable when expressed using tail recursion. About ten seconds after I wrote the previous message, I realized two things: - It's easy to write "return Retu

[Python-Dev] Explicit Tail Calls

2007-10-12 Thread Shane Hathaway
Hello, I'm interested in seeing a good way to write tail calls in Python. Some algorithms are more readable when expressed using tail recursion. I know tail call optimization has been discussed before [1], but I would like to consider a different approach. The previous discussion centered on im

Re: [Python-Dev] ImportWarning flood

2006-07-07 Thread Shane Hathaway
Anthony Baxter wrote: > On Saturday 01 July 2006 12:55, Guido van Rossum wrote: >> It's up to the release manager now to decide whether the pitchforks >> at Google or the pitchforks in the larger Python community are >> sharper. ;-) > > At this point, I think removing the warning code is the prude

Re: [Python-Dev] Pre-PEP: Allow Empty Subscript List Without Parentheses

2006-06-18 Thread Shane Hathaway
Noam Raphael wrote: > 2006/6/17, "Martin v. Löwis" <[EMAIL PROTECTED]>: >> Noam Raphael wrote: >>> I meant the extra code for writing a special class to handle scalars, >>> if I decide that the "x[()]" syntax is too ugly or too hard to type, >>> so I write a special class which will allow the synta

Re: [Python-Dev] Logging enhancements

2006-01-09 Thread Shane Hathaway
Vinay Sajip wrote: > On 1/9/06, Shane Hathaway <[EMAIL PROTECTED]> wrote: >>- The logging.config.fileConfig function has bare excepts that hide >>configuration errors. I'd like to remove the bare excepts and break up >>fileConfig for clarity. > > I'v

Re: [Python-Dev] Logging enhancements

2006-01-09 Thread Shane Hathaway
Tim Peters wrote: > [Shane Hathaway] > >>What is the time frame for Python 2.5? If I finish soon and the changes >>are not disruptive, do I have enough time for my changes to make it into >>2.5? > > > Yup! 2.5 hasn't even had an alpha release yet, a

Re: [Python-Dev] Logging enhancements

2006-01-09 Thread Shane Hathaway
Neal Norwitz wrote: > On 1/9/06, Shane Hathaway <[EMAIL PROTECTED]> wrote: > >>I'd like to create a patch for the logging package, but before I do, I >>need to know whether someone else is working on the package and whether >>my patch is likely to be accepte

[Python-Dev] Logging enhancements

2006-01-09 Thread Shane Hathaway
I'd like to create a patch for the logging package, but before I do, I need to know whether someone else is working on the package and whether my patch is likely to be accepted. Is there another group I should talk to? Specifically, I want to change the following: - The logging.config.fileConf

Re: [Python-Dev] [Doc-SIG] that library reference, again

2005-12-30 Thread Shane Hathaway
Ian Bicking wrote: > Right now most people who might be willing to contribute to the Python > documentation don't. Well, "most don't" is an understatement. "Hardly > any" would be more accurate. If just a small portion of people could > contribute fairly easily that would be a big step forwar

Re: [Python-Dev] Pythonic concurrency

2005-10-07 Thread Shane Hathaway
Antoine Pitrou wrote: >>I'd be happy to explain how >>ZODB solves those problems, if you're interested. > > > Well, yes, I'm interested :) > (I don't anything about Zope internals though, and I've never even used > it) Ok. Quoting your list: > To apply the same thing to Python you would at l

Re: [Python-Dev] Pythonic concurrency

2005-10-07 Thread Shane Hathaway
Antoine Pitrou wrote: > A relational database has a very strict and regular data model. Also, it > has transactions. This makes it easy to precisely define concurrency at > the engine level. > > To apply the same thing to Python you would at least need : > 1. a way to define a subset of the curr

Re: [Python-Dev] Pythonic concurrency

2005-10-07 Thread Shane Hathaway
Bruce Eckel wrote: > But. I do happen to have contact with a lot of people who are at the > forefront of the threading world, and *none* of them (many of whom > have written the concurrency libraries for Java 5, for example) ever > imply that threading is easy. In fact, they generally go out of the

Re: [Python-Dev] Pythonic concurrency

2005-09-29 Thread Shane Hathaway
Bruce Eckel wrote: > I'd like to restart this discussion; I didn't mean to put forth active > objects as "the" solution, only that it seems to be one of the better, > more OO solutions that I've seen so far. > > What I'd really like to figure out is the "pythonic" solution for > concurrency. Guido

Re: [Python-Dev] Replacement for print in Python 3.0

2005-09-01 Thread Shane Hathaway
Guido van Rossum wrote: > On 9/1/05, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > >>string.Template is a bit too simplified. But perhaps it can be adapted. >>We still want some way to express %r, %6.2f, etc.Since string >>formatting has been around since Tim was in diapers, we should probab

Re: [Python-Dev] Proof of the pudding: str.partition()

2005-08-31 Thread Shane Hathaway
Greg Ewing wrote: > LD "Gus" Landis wrote: > >>.piece() can be both a verb and a noun > > > Er, pardon? I don't think I've ever heard 'piece' used > as a verb in English. Can you supply an example sentence? "After Java splintered in 20XX, diehard fans desperately pieced together the remaining

Re: [Python-Dev] Proof of the pudding: str.partition()

2005-08-30 Thread Shane Hathaway
Terry Reedy wrote: > "Shane Hathaway" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>You can do both: make partition() return a sequence with attributes, >>similar to os.stat(). However, I would call the attributes "before", >

Re: [Python-Dev] Proof of the pudding: str.partition()

2005-08-30 Thread Shane Hathaway
Ron Adam wrote: > For cases where single values are desired, attribues could work. > > Slicing: > line = line.partition(';').head > line = line.partition('#').head > > But it gets awkward as soon as you want more than one. > > sep, port = host.partition(':').head, host.pa

Re: [Python-Dev] partition() (was: Remove str.find in 3.0?)

2005-08-30 Thread Shane Hathaway
Pierre Barbier de Reuille wrote: > > Shane Hathaway a écrit : >>Are you sure? I would instead expect to find a .partition method on a >>regexp object: >> >> head, sep, tail = re.compile(sep+'.'*offset).partition(some_str) > > > Well, to be cons

Re: [Python-Dev] partition() (was: Remove str.find in 3.0?)

2005-08-30 Thread Shane Hathaway
Eric Nieuwland wrote: > Pierre Barbier de Reuille wrote: > >>Or you want to have some "partition" method which accept regular >>expressions: >> >>head, sep, tail = some_str.partition(re.compile(sep+'.'*offset)) > > > Neat! > +1 on regexps as an argument to partition(). Are you sure? I would in

Re: [Python-Dev] partition() (was: Remove str.find in 3.0?)

2005-08-29 Thread Shane Hathaway
Delaney, Timothy (Tim) wrote: > I think that one of the things I have against it is that most times I > type it, I get a typo. If this function is accepted, I think it will > (and should!) become one of the most used string functions around. As > such, the name should be *very* easy to type. FWIW,

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-24 Thread Shane Hathaway
Niko Matsakis wrote: >> >> txn = new_transaction() >> try: >> txn.begin() >> rtn = do_work() >> finally: >> if exception_occurred(): >> txn.abort() >> else: >> txn.commit() >> return rtn >> > > Couldn't you just do: > > txn = new_transaction () > try

Re: [Python-Dev] Bare except clauses in PEP 348

2005-08-24 Thread Shane Hathaway
Barry Warsaw wrote: > I agree about bare except, but there is a very valid use case for an > except clause that catches every possible exception. We need to make > sure we don't overlook this use case. As an example, say I'm building a > transaction-aware system, I'm going to want to write code l

Re: [Python-Dev] PEP 309: Partial method application

2005-08-18 Thread Shane Hathaway
Martin v. Löwis wrote: > So I would propose the syntax > > lst.sort(key=virtual.lower) # where virtual is functional.virtual Ooh, may I say that idea is interesting! It's easy to implement, too: class virtual: def __getattr__(self, name): return lambda obj: getattr(obj, name)()

Re: [Python-Dev] Is PEP 237 final -- Unifying Long Integers and Integers

2005-06-21 Thread Shane Hathaway
Keith Dart wrote: > I guess I just clarify this more. My "unsigned" type really is an object > that represents a type of number from the external system. Previously, > there was a nice, clean mapping between external types and Python types. > Now there is not so clean a mapping. Not that that makes

Re: [Python-Dev] Summer of Code: Developing complete SSL support for Python

2005-06-04 Thread Shane Hathaway
Florencio Cano Gabarda wrote: > I would like to do the new SSL module as good as possible. A piece of > art and efficiency if possible and obviusly having in mind all > programming standards. Guido and much of the community would certainly be appreciative of a new SSL module, especially if you can

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-16 Thread Shane Hathaway
Guido van Rossum wrote: > [Ron Adam] > >>with opening(file1,m),opening(file2,m),opening(file3,m) as f1,f2,f3: >> # do stuff with files >> > > I'm -0 on this, if only because it complicates things a fair bit for a > very minor improvement in functionality. [...] > It's always something we can

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-16 Thread Shane Hathaway
Greg Ewing wrote: > Brett C. wrote: > > >>Nick's was obviously directly against looping, but, with no offense to Nick, >>how many other people were against it looping? It never felt like it was a >>screaming mass with pitchforks but more of a "I don't love it, but I can deal" >>crowd. > > > My

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-15 Thread Shane Hathaway
Ka-Ping Yee wrote: > On Sun, 15 May 2005, Shane Hathaway wrote: > >>You might add to the PEP the following example, which could really >>improve the process of building GUIs in Python: >> >>class MyFrame(Frame): >>def __init__(self): >>

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-15 Thread Shane Hathaway
Nick Coghlan wrote: > That would be good, in my opinion. I updated PEP 3XX to use this idea: > http://members.iinet.net.au/~ncoghlan/public/pep-3XX.html > > With that update (to version 1.6), PEP 3XX is basically PEP 343, but > injecting > exceptions that occur into the template generator's inte

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-14 Thread Shane Hathaway
Brett C. wrote: > Guido van Rossum wrote: >>PEP 340 is still my favorite, but it seems there's too much opposition >>to it, so I'm trying to explore alternatives; at the same time I >>*really* dislike the complexities of some of the non-looping >>counterproposals (e.g. Nick Coghlan's PEP 3XX or the

Re: [Python-Dev] PEP 343 - Abstract Block Redux

2005-05-14 Thread Shane Hathaway
Guido van Rossum wrote: > [Nick Coghlan] > >>Also, the call to __enter__() needs to be before the try/finally block (as it >>is >>in PEP 310). Otherwise we get the "releasing a lock you failed to acquire" >>problem. > > > I did that on purpose. There's a separate object ('abc' in the > pseudo-

Re: [Python-Dev] Python's Unicode width default (New Py_UNICODE doc)

2005-05-14 Thread Shane Hathaway
M.-A. Lemburg wrote: > It is important to be able to rely on a default that > is used when no special options are given. The decision > to use UCS2 or UCS4 is much too important to be > left to a configure script. Should the choice be a runtime decision? I think it should be. That could mean two

Re: [Python-Dev] Merging PEP 310 and PEP 340-redux?

2005-05-12 Thread Shane Hathaway
Guido van Rossum wrote: > Going for all-out simplicity, I would like to be able to write these examples: > > class locking: > def __init__(self, lock): self.lock = lock > def __enter__(self): self.lock.acquire() > def __exit__(self, *args): self.lock.release() > > class opening: >

Re: [Python-Dev] Merging PEP 310 and PEP 340-redux?

2005-05-11 Thread Shane Hathaway
Phillip J. Eby wrote: > FYI, there are still use cases for clearing the exception state in an > __exit__ method, that might justify allowing a true return from __exit__ to > suppress the error. e.g.: Maybe __exit__ could suppress exceptions using a new idiom: def __exit__(self,*exc):

Re: [Python-Dev] New Py_UNICODE doc

2005-05-08 Thread Shane Hathaway
M.-A. Lemburg wrote: > All this talk about UTF-16 vs. UCS-2 is not very useful > and strikes me a purely academic. > > The reference to possibly breakage by slicing a Unicode and > breaking a surrogate pair is valid, the idea of UCS-4 being > less prone to breakage is a myth: Fair enough. The or

Re: [Python-Dev] New Py_UNICODE doc

2005-05-07 Thread Shane Hathaway
Martin v. Löwis wrote: > Shane Hathaway wrote: > >>I agree that UCS4 is needed. There is a balancing act here; UTF-16 is >>widely used and takes less space, while UCS4 is easier to treat as an >>array of characters. Maybe we can have both: unicode objects start with >

Re: [Python-Dev] New Py_UNICODE doc

2005-05-07 Thread Shane Hathaway
Martin v. Löwis wrote: > Shane Hathaway wrote: >>More generally, how should a non-unicode-expert writing Python extension >>code find out the minimum they need to know about unicode to use the >>Python unicode API? The API reference [1] ought to at least have a list >>

Re: [Python-Dev] New Py_UNICODE doc

2005-05-07 Thread Shane Hathaway
Martin v. Löwis wrote: > Define correctly. Python, in ucs2 mode, will allow to address individual > surrogate codes, e.g. in indexing. So you get > > u"\U00012345"[0] When Python encodes characters internally in UCS-2, I would expect u"\U00012345" to produce a UnicodeError("character can not

Re: [Python-Dev] New Py_UNICODE doc

2005-05-06 Thread Shane Hathaway
Nicholas Bastin wrote: > > On May 6, 2005, at 5:21 PM, Shane Hathaway wrote: >> Wait... are you saying a Py_UNICODE array contains either UTF-16 or >> UTF-32 characters, but never UCS-2? That's a big surprise to me. I may >> need to change my PyXPCOM patch to f

Re: [Python-Dev] New Py_UNICODE doc

2005-05-06 Thread Shane Hathaway
Nicholas Bastin wrote: > On May 6, 2005, at 3:42 PM, James Y Knight wrote: >>It means all the string operations treat strings as if they were >>UCS-2, but that in actuality, they are UTF-16. Same as the case in the >>windows APIs and Java. That is, all string operations are essentially >>broken,

Re: [Python-Dev] New Py_UNICODE doc

2005-05-05 Thread Shane Hathaway
Nicholas Bastin wrote: > > On May 4, 2005, at 6:20 PM, Shane Hathaway wrote: >> On a related note, it would be help if the documentation provided a >> little more background on unicode encoding. Specifically, that UCS-2 is >> not the same as UTF-16, even though they&#x

[Python-Dev] [OT] Re: PEP 340 -- Clayton's keyword?

2005-05-04 Thread Shane Hathaway
Just a little offtopic note to Jeff Bone: Jeff, every time I send a message to Python-Dev, your "Mail.app 2.0" sends me a nasty auto-reply that I can't quote in public. Please stop. Since I can't seem to reach you by email, I'm trying to reach you through this mailing list. The note refers to so

Re: [Python-Dev] PEP 340 -- loose ends

2005-05-04 Thread Shane Hathaway
Greg Ewing wrote: > Shane Hathaway wrote: > >>For each block statement, it is necessary to create a *new* iterator, >>since iterators that have stopped are required to stay stopped. So at a >>minimum, used-defined statements will need to call something, and thus

Re: [Python-Dev] PEP 340 -- loose ends

2005-05-04 Thread Shane Hathaway
Shane Holloway (IEEE) wrote: > Another thing. In the specification of the Anonymous Block function, is > there a reason that "itr = EXPR1" instead of "itr = iter(EXPR1)"? It > seems to be a dis-symmetry with the 'for' loop specification. Hmm... yeah. That's strange. In fact, if it gets chang

Re: [Python-Dev] New Py_UNICODE doc

2005-05-04 Thread Shane Hathaway
Martin v. Löwis wrote: > Nicholas Bastin wrote: > >>"This type represents the storage type which is used by Python >>internally as the basis for holding Unicode ordinals. Extension module >>developers should make no assumptions about the size of this type on >>any given platform." > > > But

Re: [Python-Dev] PEP 340 -- loose ends

2005-05-04 Thread Shane Hathaway
Reinhold Birkenfeld wrote: > Shane Hathaway wrote: > > >>For each block statement, it is necessary to create a *new* iterator, > > > Right. > > >>since iterators that have stopped are required to stay stopped. So at a >>minimum, used-defined statem

Re: [Python-Dev] PEP 340 -- loose ends

2005-05-04 Thread Shane Hathaway
Reinhold Birkenfeld wrote: > Noam Raphael wrote: > >>On 5/4/05, Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote: >>>resource = opening("file.txt") >>>resource: >>>(...) >>> >>>The latter would have to be forbidden. >> >>Can you explain why it would have to be forbidden please? > > > Well, with

Re: [Python-Dev] PEP 340: Breaking out.

2005-05-04 Thread Shane Hathaway
Ka-Ping Yee wrote: > On Wed, 4 May 2005, Shane Hathaway wrote: >> >>for name in filenames: >>opening(name) as f: >>if f.read(2) == 0xFEB0: >>break for > > > This is very elegant. Thanks. > It works bea

Re: [Python-Dev] PEP 340: propose to get rid of 'as' keyword

2005-05-04 Thread Shane Hathaway
Shane Hathaway wrote: > Gustavo J. A. M. Carneiro wrote: > >> In PEP 340 I read: >> >>block EXPR1 as VAR1: >>BLOCK1 >> >> I think it would be much clearer this (plus you save one keyword): >> >>block

Re: [Python-Dev] PEP 340: propose to get rid of 'as' keyword

2005-05-04 Thread Shane Hathaway
Gustavo J. A. M. Carneiro wrote: > In PEP 340 I read: > > block EXPR1 as VAR1: > BLOCK1 > > I think it would be much clearer this (plus you save one keyword): > > block VAR1 = EXPR1: > BLOCK1 I think you misunderstood the statement. EXPR1 creates an

Re: [Python-Dev] PEP 340: Breaking out.

2005-05-04 Thread Shane Hathaway
Alex Martelli wrote: > Looking for a file with a certain magicnumber in its 1st two bytes...? > > for name in filenames: > opening(name) as f: > if f.read(2) == 0xFEB0: break > > This does seem to make real-life sense to me... I'd like to suggest a small language enhancement that w

Re: [Python-Dev] PEP 340: Else clause for block statements

2005-05-02 Thread Shane Hathaway
Anders J. Munch wrote: > in opening('file1') as f1: > ... > in opening('file2') as f2: > ... > except IOError: > print "file1 not available, I'll try again later" > > I rather like this version, because it is patently clear what should > happen if there

Re: [Python-Dev] Re: anonymous blocks

2005-04-29 Thread Shane Hathaway
Luis P Caamano wrote: > I've been skipping most of the anonymous block discussion and thus, > I only had a very vague idea of what it was about until I read this > explanation. > > Yes, it is understandable -- assuming it's correct :-) To my surprise, the explanation is now in the PEP. (Thanks,

Re: [Python-Dev] Re: anonymous blocks

2005-04-28 Thread Shane Hathaway
Guido van Rossum wrote: > I don't know. What exactly is the audience supposed to be of this > high-level statement? It would be pretty darn impossible to explain > even the for-statement to people who are new to programming, let alone > generators. And yet explaining the block-statement *must* invo

Re: [Python-Dev] Re: switch statement

2005-04-27 Thread Shane Hathaway
Michael Chermside wrote: > if x == 1:|if condition_1: > do_1() |y = 1 > elif x == 2: |elif condition_2: > do_2() |y = 2 > elif x == 3: |elif condition_3: > do_3() |y = 3 > else:

Re: [Python-Dev] Re: [Pythonmac-SIG] zipfile still has 2GB boundary bug

2005-04-26 Thread Shane Hathaway
Bob Ippolito wrote: > The zipfile module is good enough to create input files for zipimport.. > which is well tested and generally works -- barring the fact that > zipimport has quite a few rough edges of its own. I certainly wouldn't > recommend it for any heavy duty tasks in its current state.

Re: [Python-Dev] defmacro (was: Anonymous blocks)

2005-04-25 Thread Shane Hathaway
Robert Brewer wrote: > I still prefer more methods, because my actual use-cases are more > complicated. Your solution would work for the specific case I gave, but > try factoring in: > > * A subclass which needs to share locals between begin and post, instead > of pre and post. > > or > > * A se

Re: [Python-Dev] defmacro (was: Anonymous blocks)

2005-04-25 Thread Shane Hathaway
Robert Brewer wrote: > So currently, all subclasses just override __set__, which leads to a > *lot* of duplication of code. If I could write the base class' __set__ > to call "macros" like this: > > def __set__(self, unit, value): > self.begin() > if self.coerce: >

Re: [Python-Dev] defmacro (was: Anonymous blocks)

2005-04-25 Thread Shane Hathaway
Michael Chermside wrote: > In other words, rather than hearing what we'd like to be able to DO > with blocks, I'd like to hear what we want to PROHIBIT DOING with > blocks. I think this might be a fruitful way of thinking about the > problem which might make it easier to evaluate syntax suggestions

Re: [Python-Dev] defmacro (was: Anonymous blocks)

2005-04-25 Thread Shane Hathaway
Paul Moore wrote: > I think the key difference with macros is that they act at compile > time, not at run time. There is no intention here to provide any form > of compile-time processing, and that makes all the difference. > > What I feel is the key concept here is that of "injecting" code into a

Re: [Python-Dev] PEP 310 and exceptions

2005-04-23 Thread Shane Hathaway
Nick Coghlan wrote: > Which means finding a different name for '__else__'. Two possibilities > that occur to me are '__ok__' or '__no_except__'. The latter makes a > fair amount of sense, since I can't think of a way to refer to the thing > other than as a 'no exception' handler. While we're on th

Re: [Python-Dev] anonymous blocks

2005-04-23 Thread Shane Hathaway
Nick Coghlan wrote: > An alternative would be to replace the 'yield None' with a 'break' or > 'continue', and create an object which supports the resource protocol > and NOT the iterator protocol. Something like: > > def my_resource(): > print "Hi!" # Do entrance code > continue # Go on

Re: [Python-Dev] Re: anonymous blocks

2005-04-19 Thread Shane Hathaway
Fredrik Lundh wrote: > Brian Sabbey wrote: >> doFoo(**): >> def func1(a, b): >> return a + b >> def func2(c, d): >> return c + d >> >> That is, a suite can be used to define keyword arguments. > > > umm. isn't that just an incredibly obscure way to write > >def func1