Re: [Python-Dev] PEP 372 -- Adding an ordered directory to collections ready for pronouncement

2009-03-04 Thread Steven D'Aprano
Gisle Aas wrote: Instead of introducing a sorteddict I would instead suggest that the future should bring an odict with a sort method; possibly also keys_sorted and items_sorted methods. Instead of odict.sorted(), that can be spelled: sorted(odict) # sort the keys sorted(odict.values()) #

Re: [Python-Dev] PEP 372 -- Adding an ordered directory to collections ready for pronouncement

2009-03-04 Thread Steven D'Aprano
Glenn Linderman wrote: FIFOdict ? Yeah, that blows the capitalization scheme, way, way out. [...] It is suggestive of queue behavior, and the items are a queue if looked at from insertion, and traversal perspectives, if I understand correctly. Why is this relevant? Insertion and traversal

Re: [Python-Dev] PEP 372 -- Adding an ordered directory to collections ready for pronouncement

2009-03-04 Thread Steven D'Aprano
Leif Walsh wrote: On Wed, Mar 4, 2009 at 7:53 AM, wrote: I actually like StableDict best. When I hear that I think, "ah, the key order is stable in the face of insertions, unlike a regular dict". Nor can I at the moment think of an alternative explanation of what a "StableDict" might be. Hm

Re: [Python-Dev] Ext4 data loss

2009-03-11 Thread Steven D'Aprano
hat means classes instead of magic constants. Would there be interest in a filetools module? Replies and discussion to python-ideas please. -- Steven D'Aprano ___ 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] Ext4 data loss

2009-03-12 Thread Steven D'Aprano
ore. Konquorer does much the same, except it can only recover from application crashes, not system crashes. I can't tell you how many times such features have saved my hide! -- Steven D'Aprano ___ Python-Dev mailing list Python-Dev@pyt

Re: [Python-Dev] wait time [was: Ext4 data loss]

2009-03-12 Thread Steven D'Aprano
loper to choose the subclass she wants: from filetools import SyncOnWrite as open f = open('mydata.txt', 'w') f.write(data) The choice of which subclass gets used is up to the application, but naturally that might be specified by a user-configurable setting. -- Steven D

Re: [Python-Dev] wait time [was: Ext4 data loss]

2009-03-12 Thread Steven D'Aprano
expect the app to honour whatever setting they put in regarding HDD behaviour, and Linux users may expect more fine control over application behaviour and be willing to edit config files to get it. -- Steven D'Aprano ___ Python-Dev mailing lis

Re: [Python-Dev] wait time [was: Ext4 data loss]

2009-03-12 Thread Steven D'Aprano
is that these are *application* decisions, not *language* decisions. Python shouldn't be making those decisions, but should be enabling application developers to make them. -- Steven D'Aprano ___ Python-Dev mailing list Python-Dev@python.or

Re: [Python-Dev] Python-Dev] wait time [was: Ext4 data loss

2009-03-12 Thread Steven D'Aprano
mplexity of writing the code, and the increased number of paths that need to be tested, may lead to bugs which cause data loss. This may be more risky than the original strategy above (whatever that happens to be.) Complexity is not cost-free, and insisting that the

Re: [Python-Dev] Integrate BeautifulSoup into stdlib?

2009-03-13 Thread Steven D'Aprano
Tres, for some reason every time you reply to the list, you send TWO copies instead of one: To: python-dev@python.org CC: Python Dev Could you please fix that? -- Steven D'Aprano ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] Getting values stored inside sets

2009-04-03 Thread Steven D'Aprano
dict, thus saving one pointer per item, but of course that would rely on a change on set behaviour. -- Steven D'Aprano ___ 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] Getting values stored inside sets

2009-04-03 Thread Steven D'Aprano
f_odd_numbers: ... print alist[Decimal('3')] ... Traceback (most recent call last): File "", line 2, in TypeError: list indices must be integers Python does not promise that if x == y, you can use y anywhere you can use x. Nor should it. Paul'

Re: [Python-Dev] pyc files, constant folding and bor derline portability issues

2009-04-06 Thread Steven D'Aprano
0.5 on any such optimizations which change the semantics of a f.p. operation. The only reason it's -0.5 rather than -1 is that (presumably) anyone who cares about floating point correctness already knows to never trust the compiler. -- Steven D'Aprano __

Re: [Python-Dev] Mercurial?

2009-04-07 Thread Steven D'Aprano
st name, or that a first name and last name is sufficient to legally identify them. Those from Spanish and Portuguese cultures usually have two family names as well as a personal name; people from Indonesian, Burmese and Malaysian cultures often only use a single name. -- Steven D'Aprano

Re: [Python-Dev] [Email-SIG] headers api for email package

2009-04-13 Thread Steven D'Aprano
5335 defines an experimental approach to allowing full Unicode in mail headers, but surely it's going to be a while before that's common, let alone standard. http://tools.ietf.org/html/rfc5335 -- Steven D'Aprano ___ 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] Issue5434: datetime.monthdelta

2009-04-16 Thread Steven D'Aprano
1 month to a day will be defined as adding days_in_month days (if given), and if not given, adding 31 days but truncating the result to the last day of the next month. Thoughts? -- Steven D'Aprano ___ Python-Dev mailing list Python-Dev@py

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Steven D'Aprano
On Fri, 17 Apr 2009 12:29:11 pm Steven D'Aprano wrote: > Adding one month to 31st January could mean: > > 1: raise an exception > 2: return 28th February (last day of February) > 3: return 3rd April (1 month = 31 days) > 4: return 2nd April (1 month = 30 days) > 5: ret

Re: [Python-Dev] Issue5434: datetime.monthdelta

2009-04-16 Thread Steven D'Aprano
common expectation, possibly the most common. I just asked the missus, who is a non-programmer, what date is one month after 31st January and her answer was "2rd of March on leap years, otherwise 3rd of March". -- Steven D'Aprano _

Re: [Python-Dev] Python-Dev Digest, Vol 69, Issue 143

2009-04-16 Thread Steven D'Aprano
off error: >>> x = 0.0 >>> step = 0.001 >>> for i in xrange(1000): ... x += step ... >>> x 1.0007 The solution isn't to add a "goal" to the plus operator, but to fix your code to use a bet

Re: [Python-Dev] [Python-ideas] Proposed addtion to urllib.parse in 3.1 (and urlparse in 2.7)

2009-04-19 Thread Steven D'Aprano
r convenience when they don't care about order or duplicates, and (name,value) pairs, or an OrderedDict, when they do. I suppose you could force people to write params.items() if params is a dict, but it seems wrong to force an order on input data when it doesn't require one. -- Ste

Re: [Python-Dev] Something like PEP-0304 - suppress *.pyc generation

2009-04-20 Thread Steven D'Aprano
thon. You would probably be better off on comp.lang.python or python-l...@python.org. However, I believe that the normal way to prevent the generation of .pyc files is to remove write access to the directory where the .py files are. -- Steven D'Aprano

Re: [Python-Dev] Two proposed changes to float formatting

2009-04-26 Thread Steven D'Aprano
es to '%g' > formatting for numbers larger than 1e50. ... > I propose removing this feature for 3.1 No objections from me. +1 > I propose changing the complex str and repr to behave like the > float version. That is, repr(4. + 10.j) should be "(4.0 + 10.0j)" &g

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-27 Thread Steven D'Aprano
em uses bytes for filenames? If I write a piece of Python code: filename = 'some path/some name' I might call it a filename, I might think of it as a filename, but it *isn't*, it's a string in a Python program. It isn't a filename until

Re: [Python-Dev] a suggestion ... Re: PEP 383 (again)

2009-04-29 Thread Steven D'Aprano
of malformed file names, and this is what happens when you try to work with them. Please, let's see some code we can run, not more words. -- Steven D'Aprano ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/list

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-30 Thread Steven D'Aprano
gt;> import os >>> os.remove(chr(255)) >>> Given that chr(255) is a valid filename on my file system, I would consider it a bug if Python couldn't deal with a file with that name. -- Steven D'Aprano ___ 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] ctime: I don't think that word means what you think it means.

2009-06-14 Thread Steven D'Aprano
for my > liking. People who think that the "c" in "ctime" > means "creation" are still likely to confuse them. > > Why not give it a more explicit name, such > as "st_creationtime"? Speaking as somebody who t

Re: [Python-Dev] Avoiding file descriptors leakage in subprocess.Popen()

2009-06-16 Thread Steven D'Aprano
On Tue, 16 Jun 2009 01:20:53 pm Cameron Simpson wrote: > I don't think all > pythons do immediate ref-counted GC. Jython and IronPython don't. I don't know about PyPy, CLPython, Unladen Swallow, etc. -- Steven D'Aprano _

Re: [Python-Dev] PEP 376

2009-06-30 Thread Steven D'Aprano
h because they are automatically produced from py files." What if your distribution is not a source distribution and only provides pyc and pyo files? -- Steven D'Aprano ___ 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] Mercurial migration: progress report (PEP 385)

2009-07-03 Thread Steven D'Aprano
nd wondering what the "k" means. Alpha, beta, kappa version? -- Steven D'Aprano ___ 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] PEP 376 - Open questions

2009-07-08 Thread Steven D'Aprano
ing a bunch of mysterious executable files on your system that you don't remember installing, and then spending a few paranoid hours trying to determine whether you've stumbled across a root kit or virus or whether they have a legitimate reason to be there. -- Steven D'Aprano _

Re: [Python-Dev] Update to Python Documentation Website Request

2009-07-26 Thread Steven D'Aprano
ng regular announcements to the Python community (e.g. on comp.lang.python) will be a good way to publicise the tool, and if does meet a need, people will use it, and then, if it's good enough and popular enough and supported, it may be blessed by inclusion in the standard librar

Re: [Python-Dev] Implementing File Modes

2009-07-27 Thread Steven D'Aprano
t modes, but that you are reading from different files. -- Steven D'Aprano ___ 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 File Modes

2009-07-27 Thread Steven D'Aprano
r2() # read from mixed stdout and stderr I don't like a function to toggle between one and the other: that smacks of relying on a global setting in a bad way. I suppose you could add an optional argument to ProcessIOWrapper() to select between stdout, st

Re: [Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)

2009-08-07 Thread Steven D'Aprano
nfusing by adding var parameters, so you could get results back from a procedure and have side-effects in a function... oh well.) -- Steven D'Aprano ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Un

Re: [Python-Dev] (try-except) conditional expression similar to (if-else) conditional (PEP 308)

2009-08-10 Thread Steven D'Aprano
str(e) if ValueError as e # Option 1 func(obj) except ValueError as e: str(e) # Option 2 func(obj) except ValueError as e else str(e) # Option 3 Justify your choice please. -- Steven D'Aprano ___ Python-Dev mailing list Pyt

Re: [Python-Dev] functools.compose to chain functions together

2009-08-16 Thread Steven D'Aprano
functional tools, and would like to give a +0.5 to compose(). +1 if anyone can come up with additional use-cases. -- Steven D'Aprano ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubsc

Re: [Python-Dev] functools.compose to chain functions together

2009-08-17 Thread Steven D'Aprano
d, Haskell makes compose a built-in operator: http://www.haskell.org/haskellwiki/Function_composition It doesn't appear to be standard in Ruby, but it seems to be commonly requested, and a version is on Facets: http://facets.rubyforge.org/apidoc/api/core/classes/Proc.html#M000161 -- S

Re: [Python-Dev] functools.compose to chain functions together

2009-08-18 Thread Steven D'Aprano
one thing compose() or partial() could do, whereas a lambda is so general it could do anything. Contrast: compose(f, g, h) lambda x: f(g(h(x))) You need to read virtually the entire lambda before you can distinguish it from some other arbitrary lambda: lambda x: f(

Re: [Python-Dev] Problems with events in a numeric keyboard

2009-08-25 Thread Steven D'Aprano
o available as a mailing list: http://www.python.org/mailman/listinfo/python-list Good luck. -- Steven D'Aprano ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.py

Re: [Python-Dev] Fast Implementation for ZIP decryption

2009-08-30 Thread Steven D'Aprano
already supports ZIP decryption (as it should), are there any reasons to prefer the current pure-Python implementation over a faster version? -- Steven D'Aprano ___ Python-Dev mailing list Python-Dev@python.org http://mail.python

Re: [Python-Dev] default of returning None hurts performance?

2009-09-01 Thread Steven D'Aprano
, it will most likely be insignificant: for comparison's sake, urllib2.Request('http://example.com') takes around 150μs on my machine, and math.sin(1.1) around 90μs. For any procedure which does non-trivial amounts of work, saving 0.1μs is insignificant, no matter how many t

Re: [Python-Dev] PEP 3144 review.

2009-09-16 Thread Steven D'Aprano
such users, even at the risk of sometimes accepting invalid input. Or is it to have a module which is strict and forces the user to Do The Right Thing, even at the cost of being less easy to use? For what it's worth, it seems to me that it would be better to have a strict module in the sta

Re: [Python-Dev] Fwd: PEP 3144 review.

2009-09-17 Thread Steven D'Aprano
ses an exception. obj.broadcast() always returns something which is not a broadcast address. I would hope the third option isn't being seriously considered! Are there any reasons to consider the first two? -- Steven D'Aprano ___

Re: [Python-Dev] PEP 3144 review.

2009-09-17 Thread Steven D'Aprano
adcast_address = my_net[-1] > > The only way the network address could match the number of characters > in the indexing method is if you just called it the network id (i.e. > my_net.id). For the broadcast address, there is no name that even > comes close to matching the indexing approa

Re: [Python-Dev] PEP 3144 review.

2009-09-17 Thread Steven D'Aprano
dr_a in addr_b.network > > As the module stands, you write that as: > > addr_a in addr_b > > I don't think the intent is as clear with the later. I would find the later completely unclear and disturbing -- how can one address contain another address? --

Re: [Python-Dev] PEP 3144 review.

2009-09-17 Thread Steven D'Aprano
;re not suggesting the older notation be unsupported? I would expect to be able to use a mask like 255.255.255.192 without having to count bits myself. -- Steven D'Aprano ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/

Re: [Python-Dev] PEP 3144 review.

2009-09-17 Thread Steven D'Aprano
ss in the network with the network's netmask 4 Host address -- the part of the IP address that is not masked by the netmask 5 Broadcast address -- the highest address in a IPv4 network Containers: 6 Network -- a range of IP address Have I missed anything or got anything wrong? -- Steve

Re: [Python-Dev] conceptual clarity

2009-09-17 Thread Steven D'Aprano
silent mentors. > > So, while I am not suggesting we build a bondage and discipline > machine, I am suggesting that partitioning the functionality > differently will result in a better outcome all round. As one of those non-expert users, can I give a big T

Re: [Python-Dev] conceptual clarity

2009-09-17 Thread Steven D'Aprano
posed. Please excuse my skepticism, but I find that hard to believe. Given the current API, to test if an address is in the same network as another address, you write: addr_a in addr_b Can you please give a use-case where that makes more sense than the suggested a

Re: [Python-Dev] POSIX [Fuzziness in io module specs]

2009-09-19 Thread Steven D'Aprano
to act accordingly). I do. Please don't throw away useful information. -- Steven D'Aprano ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mail

Re: [Python-Dev] Fuzziness in io module specs

2009-09-19 Thread Steven D'Aprano
er increase it. To increase it, you have to explicitly write to the file. http://java.sun.com/j2se/1.4.2/docs/api/java/nio/channels/FileChannel.html#truncate(long) In any case, some platforms don't allow the file pointer to exceed the size of the file, so it's not clear that the POSI

Re: [Python-Dev] unsubscriptable vs object does not support indexing

2009-09-23 Thread Steven D'Aprano
m at subscript i -- the term "subscript" in this context seems to be rare to non-existent except for the error message. -- Steven D'Aprano ___ 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] PEP 3144 review.

2009-09-26 Thread Steven D'Aprano
d only support netmasks of the form (say) '255.255.255.224' (equivalent to "/27"), and reject those like "255.3.255.255". It currently accepts them. Many applications still display netmasks in dot-quad form, and I would be terribly annoyed if I had to count th

Re: [Python-Dev] PEP 3144 review.

2009-09-26 Thread Steven D'Aprano
tly the same range of addresses, but they don't compare equal. I'm not convinced that netw1 should even be allowed, but if it is, surely it should be turned into canonical form netw2? E.g. I would expect this: >>> ipaddr.IPv4Network('192.168.1.1/24') IPv4Network('1

Re: [Python-Dev] PEP 3144 review.

2009-09-27 Thread Steven D'Aprano
you explain what benefit there is for allowing the user to create network objects that don't represent networks? Is there a use-case where these networks-that-aren't-networks are something other than a typo? Under what circumstances would I want to specify a network as 192.168.1.1/24 i

Re: [Python-Dev] PEP 3144 review.

2009-09-27 Thread Steven D'Aprano
dress and netmask, and you've been hostile to the idea. But it seems to me that your API does exactly that. I'm not the only person who thinks your API conflates two different concepts into a single class, and I'm trying to see your side of the argument. But your h

Re: [Python-Dev] PEP 389: argparse - new command line parsing module

2009-09-28 Thread Steven D'Aprano
ne parsing, which I think is important. Assuming argparse is added to the std lib, I'm -0.5 on deprecating getopt, 0 on deprecating optparse. -- Steven D'Aprano ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailma

Re: [Python-Dev] PEP 3144 review.

2009-09-28 Thread Steven D'Aprano
o RFCs. For example, ipaddr accepts '192.168.1.1/24' as a network definition because this is a very common way of describing an address + netmask despite the fact that 192.168.1.1 is actually an IP address on the network 192.168.1.0/24. ..." which nicely explains why (3) is not used,

Re: [Python-Dev] PEP 389: argparse - new command line parsing module

2009-09-28 Thread Steven D'Aprano
of the learning curve. Using it is as simple as: getopt.getopt(sys.argv[1:], "a:b", ["alpha=", "beta"]) Does argparse allow anything as simple as that? -- Steven D'Aprano ___ Python-Dev mailing list Python-Dev@pyt

Re: [Python-Dev] PEP 3144 review, and the inclusion process

2009-09-28 Thread Steven D'Aprano
egatives and don't remember to give credit where credit is due. Hopefully we can reach consensus, or at least understanding, on the remaining issue(s). -- Steven D'Aprano ___ Python-Dev mailing list Python-Dev@python.org http://mail.pytho

[Python-Dev] [OT] Denormalized fractions [was Re: PEP 3144 review.]

2009-09-29 Thread Steven D'Aprano
udies into a single comparison paradoxically shows that treatment B is better! The mediant is fascinating (to maths geeks at least) and important, and you need denormalized fractions. -- Steven D'Aprano ___ Python-Dev mailing list Python-Dev@pytho

Re: [Python-Dev] transitioning from % to {} formatting

2009-09-30 Thread Steven D'Aprano
API. If the external API depends on the caller using % explicitly, then this approach may not work.) > 2) A long time later...deprecate str.__mod__; How long? I hope that's not until I'm dead and buried. -- Steven D'Aprano ___ 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] PEP 389: argparse - new command line parsing module

2009-10-03 Thread Steven D'Aprano
There's no reason to treat SystemExit as special in this regard. optparse, for example, calls sys.exit(), which operates by raising SystemExit. Ordinary SystemExit, not a special module-specific subclass. -- Steven D'Aprano ___ Python-Dev mai

Re: [Python-Dev] summary of transitioning from % to {} formatting

2009-10-03 Thread Steven D'Aprano
dditional benefit: they would enable modules to completely decouple the API they offer from their internal implementation, without paying a runtime cost on every call, just a single once-off translation at initialisation time. In theory, this could mean that modules could, if they choose, conti

Re: [Python-Dev] PEP 389: argparse - new command line parsing module

2009-10-03 Thread Steven D'Aprano
tion raises ValueError. The fact that you are catching an exception implies that the function might raise that exception. A comment like: "Catching SystemExit because parse_args() throws SystemExit on parser errors." is up them with comments like thi

Re: [Python-Dev] PEP 389: argparse - new command line parsing module

2009-10-03 Thread Steven D'Aprano
On Sun, 4 Oct 2009 05:35:04 am André Malo wrote: > * Steven D'Aprano wrote: > > You don't need a comment warning that you are catching SystemExit > > because parse_args raises SystemExit, any more than you need a > > comment saying that you are catching ValueError b

Re: [Python-Dev] PEP 389: argparse - new command line parsing module

2009-10-03 Thread Steven D'Aprano
t in case someday in the indefinite future there comes a need to add extra information to the exception falls foul of You Ain't Gonna Need It. Keep it simple -- if, someday, such a need becomes apparent, then subclass. -- Steven D'Aprano ___

[Python-Dev] [OT] Re: Top-posting on this list

2009-10-11 Thread Steven D'Aprano
ight be hard on a PDA or mobile phone, but on a PC with a keyboard and mouse? (I have a vague recollection that Lotus Notes inserts the quoted message *after* you've done editing your reply, so Notes users should be forgiven. Not to mention pitied.) -- Steven D'Aprano

Re: [Python-Dev] readonly __doc__

2009-10-22 Thread Steven D'Aprano
s the Rule of Least Astonishment. I thought I understood Python's object model and it's rules of inheritance, but not only do double-underscore attributes follow a different rule for inheritance than other attributes, but __doc__ follo

Re: [Python-Dev] Retrieve an arbitrary element from a set without removing it

2009-10-23 Thread Steven D'Aprano
x = some_set.pop(False) > > and am thinking about providing a patch against setobject.c > (preferring the .get() solution being a stripped down pop()). -1 on .pop(flag) +0 on .get() -- Steven D'Aprano ___ Python-Dev mailing list Pyt

Re: [Python-Dev] First shot at some_set.get()

2009-10-23 Thread Steven D'Aprano
o 3.1, and with the overwhelming approval for a moratorium on changes to built-ins, it is likely to just sit in the tracker, forgotten, until 2013 or later. How likely is it that the patch will still be applicable? -- Steven D'Aprano ___ Python-De

Re: [Python-Dev] Retrieve an arbitrary element from a set without removing it

2009-10-23 Thread Steven D'Aprano
ONST 0 (None) 20 RETURN_VALUE The difference is likely to be this: for x in s: break retrieves the first (only) element of the set, then immediately breaks out of the loop. This is very different from: for x in s: pass which retrieves t

Re: [Python-Dev] Retrieve an arbitrary element from a set without removing it

2009-10-23 Thread Steven D'Aprano
ack of get() in sets and frozensets is sounding more and more to me like the victory of purity over practicality. -- Steven D'Aprano ___ 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] Retrieve an arbitrary element from a set without removing it

2009-10-23 Thread Steven D'Aprano
tand that conclusion. According to your tests, your implementation of get() is as fast as "for x in set: break", and it's certainly much, much more readable and straightforward. -- Steven D'Aprano ___ Python-Dev mailing list Python-Dev@p

Re: [Python-Dev] First shot at some_set.get()

2009-10-23 Thread Steven D'Aprano
On Fri, 23 Oct 2009 11:47:22 pm Nick Coghlan wrote: > Yuvgoog Greenle wrote: > > On Fri, Oct 23, 2009 at 1:09 PM, Steven D'Aprano wrote: > >> Is there any point? Even if accepted, it's too late to make it > >> into 3.1, and with the overwhelming approval for

Re: [Python-Dev] Retrieve an arbitrary element from a set without removing it

2009-10-23 Thread Steven D'Aprano
On Sat, 24 Oct 2009 10:26:27 am Ben Finney wrote: > Steven D'Aprano writes: > > On Sat, 24 Oct 2009 06:04:12 am Terry Reedy wrote: > > > fwiw, I think the use case for this is sufficiently rare that it > > > does not need a separate method just for this purpose. &g

Re: [Python-Dev] Retrieve an arbitrary element from a set without removing it

2009-10-23 Thread Steven D'Aprano
On Sat, 24 Oct 2009 02:02:48 pm Ben Finney wrote: > Steven D'Aprano writes: > > On Sat, 24 Oct 2009 10:26:27 am Ben Finney wrote: > > > Steven D'Aprano writes: > > > > The lack of get() in sets and frozensets is sounding more and > > > > mor

Re: [Python-Dev] First shot at some_set.get()

2009-10-24 Thread Steven D'Aprano
On Sat, 24 Oct 2009 05:04:33 pm Stephen J. Turnbull wrote: > Steven D'Aprano writes: > >  > I'm not being tongue-in-cheek or sarcastic. My question was > serious -- > if there is a moratorium, is there any reason to bother > submitting > patches for functi

Re: [Python-Dev] Retrieve an arbitrary element from a set without removing it

2009-10-24 Thread Steven D'Aprano
could be O(1). (2) The second one is apparently a common need (although I personally have never needed it), forcing people to re-invent the wheel, sometimes incorrectly or inefficiently, e.g.: def get(aset): for element in aset: pass return element -- Steven D'Apran

Re: [Python-Dev] Retrieve an arbitrary element from a set without removing it

2009-10-25 Thread Steven D'Aprano
ufficiently pure. As soon as you allow iteration over sets, you have allowed retrieval. -- Steven D'Aprano ___ 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] Set methods for mapping views

2009-10-26 Thread Steven D'Aprano
moratorium. How would the addition of `yield from` delay or prevent people using set methods on mapping views? If a proposed feature directly competes with a feature in 3.x, then it might delay usage of the 3.x feature -- but if that were the case, the proposal would almost certainly be rejected

Re: [Python-Dev] Set methods for mapping views

2009-10-26 Thread Steven D'Aprano
On Tue, 27 Oct 2009 10:09:14 am Guido van Rossum wrote: > On Mon, Oct 26, 2009 at 4:06 PM, Antoine Pitrou wrote: > > Steven D'Aprano pearwood.info> writes: > >> I don't understand that rationale. Let's take a concrete example. > >> The new `yield fro

Re: [Python-Dev] Retrieve an arbitrary element from a set withoutremoving it

2009-10-29 Thread Steven D'Aprano
Willi Richart implemented these behaviours. http://bugs.python.org/issue7212 -- Steven D'Aprano ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options

Re: [Python-Dev] Retrieve an arbitrary element from a setwithoutremoving it

2009-10-30 Thread Steven D'Aprano
-calls > semantics is self-evident and non-magical as compared to a straight > for-loop or next(it)? I'm going to sit on the fence on that and say "maybe". > ISTM, that when streams have non-destructive getters with > self-advancing pointers, they also have a seek() funct

Re: [Python-Dev] Retrieve an arbitrary element from a set withoutremoving it

2009-10-30 Thread Steven D'Aprano
rpose is to return an arbitrary item each time it is called. If two threads get the same element, that's not a problem; if one thread misses an element because another thread grabbed it first, that's not a problem either. If people prefer a random element instead,

Re: [Python-Dev] Retrieve an arbitrary element from a setwithoutremoving it

2009-11-01 Thread Steven D'Aprano
is not a problem that needs solving. >  > No. Since sets are unordered, there's no way to seek to a specific >  > element. > > I think people will realize that in fact *these* sets are ordered and > they will demand a seek function for various practical purposes. We can

Re: [Python-Dev] Retrieve an arbitrary element from a set withoutremoving it

2009-11-03 Thread Steven D'Aprano
bviously there is disagreement on whether or not pick() is a fundamental operation or not. As Raymond points out, it is uncommon in other languages. But Wikipedia lists it as fundamental, and it is not just Python users who ask for it: http://st

Re: [Python-Dev] Retrieve an arbitrary element from a set withoutremoving it

2009-11-04 Thread Steven D'Aprano
On Wed, 4 Nov 2009 10:10:30 am Guido van Rossum wrote: > On Tue, Nov 3, 2009 at 2:46 PM, Steven D'Aprano wrote: > > Since I was the person who decided that "arbitrary" meant "give a > > different result each time", I should answer that. > You're

Re: [Python-Dev] Retrieve an arbitrary element from a set withoutremoving it

2009-11-04 Thread Steven D'Aprano
On Wed, 4 Nov 2009 11:54:47 am Greg Ewing wrote: > Steven D'Aprano wrote: > > I don't know how expensive it is to create a set iterator, > > Not expensive enough to justify burdening the set type with > extra functionality that will be extremely rarely used. As my

Re: [Python-Dev] PEP 3003 - Python Language Moratorium

2009-11-05 Thread Steven D'Aprano
n Unladen Swallow is a fork (sorry - I mean branch) of > CPython rather than a separate implementation. I don't know how mature or active it is, so it may not count as either major or complete, but there's also CLPython: http://common-lisp.net/projec

Re: [Python-Dev] Retrieve an arbitrary element from a setwithoutremoving it

2009-11-05 Thread Steven D'Aprano
rator. If another thread modifies the original set after the set_iterator is created but before the return, you would get a mysterious and almost impossible to debug RuntimeError. -- Steven D'Aprano ___ Python-Dev mailing list Python-Dev

Re: [Python-Dev] PEP 3003 - Python Language Moratorium

2009-11-07 Thread Steven D'Aprano
-- that's effectively just 3.2. But Guido has suggested it could last to 3.3. Could it last beyond that? 3.4? Until some distant future Python-4000? At the very least, I believe, any moratorium should have a clear end date. A clear end date will be a powerful counter to the impressio

Re: [Python-Dev] PEP 3003 - Python Language Moratorium

2009-11-07 Thread Steven D'Aprano
ationale for this PEP is to give alternative implementations the chance to catch up with CPython. Given your statement that CLPython is quite complete on the language level, but missing standard library features, how do you think the moratorium will help

Re: [Python-Dev] PEP 3003 - Python Language Moratorium

2009-11-08 Thread Steven D'Aprano
On Sun, 8 Nov 2009 11:14:59 am Steven D'Aprano wrote: > At the very least, I believe, any moratorium should have a clear end > date. A clear end date will be a powerful counter to the impression > that Python the language is moribund. It says, this is an exceptional > pause, not

Re: [Python-Dev] Retrieve an arbitrary element from asetwithoutremoving it

2009-11-09 Thread Steven D'Aprano
ORE_FAST 0 (value) 3 13 LOAD_FAST0 (value) 16 RETURN_VALUE >> 17 POP_BLOCK >> 18 LOAD_CONST 0 (None) 21 RETURN_VALUE Is it possible for another thread to be called between the GET_ITE

Re: [Python-Dev] PyPI comments and ratings, *really*?

2009-11-12 Thread Steven D'Aprano
somehow gives you the right to demand control over what others say about your software. I don't suppose that this rant of yours has something to do with the comment posted today? http://pypi.python.org/pypi/spypam/1.0 -- Steven D'Aprano __

Re: [Python-Dev] PyPI comments and ratings, *really*?

2009-11-12 Thread Steven D'Aprano
might not trust a module that has no reviews or ratings. As a user, I'd be more likely to trust a module with no reviews/ratings than one where the author disabled reviews/ratings. The first says "nobody hated it enough to complain", the second one says "the author is try

Re: [Python-Dev] PyPI comments and ratings, *really*?

2009-11-12 Thread Steven D'Aprano
On Fri, 13 Nov 2009 04:27:48 am Ludvig Ericson wrote: > On 12 nov 2009, at 14:38, Steven D'Aprano wrote: > > On Thu, 12 Nov 2009 08:44:32 pm Ludvig Ericson wrote: > >> Why are there comments on PyPI? Moreso, why are there comments > >> which I cannot control as

Re: [Python-Dev] PyPI comments and ratings, *really*?

2009-11-12 Thread Steven D'Aprano
g Ericson, had (as of last night) two comments, one positive, one negative. This admittedly tiny sample doesn't suggest to me that PyPI is suffering from the problem of biased ratings. -- Steven D'Aprano ___ Python-Dev mailing list Python-

Re: [Python-Dev] PyPI comments and ratings, *really*?

2009-11-12 Thread Steven D'Aprano
can't even agree on the validity of benchmarks! This is open source. The power of the bazaar, remember? I'm amazed at how many people are not just disinterested in, but actively hostile, to even *useful* comments from users. That's fine. If you, the package author, don't care

<    6   7   8   9   10   11   12   13   14   15   >