[Python-Dev] Re: PEP 622: Structural Pattern Matching -- followup

2020-07-07 Thread Steven Barker
On Sun, Jun 28, 2020 at 8:44 AM Jim J. Jewett wrote: > I actually like that it looks like instantiation; it seems to be saying > "Do we have the sort of object we would get from this instantiation?" > > Unfortunately, this does aggravate the confusion over whether a variable > is being used as a

[Python-Dev] Re: Python is the only language with lack of const'ness in core, also affects: Re: PEP 622: Structural Pattern Matching

2020-07-08 Thread Steven D'Aprano
against constantness, but only pointing out that Python is in good company when it comes to lack of constants. -- Steven ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.

[Python-Dev] Re: Python is the only language with lack of const'ness in core, also affects: Re: PEP 622: Structural Pattern Matching

2020-07-08 Thread Steven D'Aprano
On Thu, Jul 09, 2020 at 01:22:48AM +1000, Steven D'Aprano wrote: > Whenever someone says "Python is the only language..." it really turns > out to be the case. Python is very rarely as unusual as people often > make out. Gah, embarrasing typo! That was meant to be *rar

[Python-Dev] Re: PEP 622 idea: "match case object" to represent match patterns

2020-07-18 Thread Steven D'Aprano
. And even experienced developers sometimes forget to put parentheses after file.close, or at least we used to before context managers. (I know I did. I don't think I'm alone.) -- Steven ___ Python-Dev mailing list -- python-dev@python.org T

[Python-Dev] Re: PEP 622 version 2 (Structural Pattern Matching)

2020-07-18 Thread Steven D'Aprano
unctional languages like Haskell, F# and ML are not the only languages with pattern matching. Non-FP languages like C#, Swift, Rust and Scala have it, and even Java has an extension providing pattern matching: http://tom.loria.fr/wiki/index.php/Main_Page -- Steven

[Python-Dev] Re: Memory address vs serial number in reprs

2020-07-19 Thread Steven D'Aprano
s implemented in > Python, for which size and creation time are not critical. I want to > start with synchronization objects in threading and multiprocessing > which did not have custom reprs, than change reprs of locks and asyncio > o

[Python-Dev] Re: Memory address vs serial number in reprs

2020-07-25 Thread Steven D'Aprano
On Sat, Jul 25, 2020 at 12:03:55PM +0300, Serhiy Storchaka wrote: > 19.07.20 19:33, Steven D'Aprano пише: > No, I do not propose to change object IDs. I proposed only to use serial > numbers instead of IDs in reprs of some classes. Yes, I understood that you were only talking ab

[Python-Dev] Re: Function suggestion: itertools.one()

2020-07-27 Thread Steven Barker
A single-name unpacking assignment can do exactly what you want, albeit with slightly less helpful exception messages: jack, = (p for p in people if p.id == '1234') # note comma after the name jack If no value is yielded by the generator expression, you'll get "ValueError: not enough values t

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-14 Thread Steven D'Aprano
x27;ve lost count... is the number of emails in this discussion more or less than a googolplex? *wink* -- Steven ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mai

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-15 Thread Steven D'Aprano
les). Oh, I'm sorry, I based my comment on Chris' comment that Mark was repeating everyone else's arguments. My bad :-( I guess at some point I shall have to read the entire thread if I want to have an opinion on this feature. (Other than "pattern matching sounds great, but

[Python-Dev] Resurrecting PEP-472

2020-08-27 Thread Steven D'Aprano
Hi all, On the Python-Ideas mailing list, there has been a long debate about resurrecting PEP 472, "Support for indexing with keyword arguments". https://www.python.org/dev/peps/pep-0472/ One of the existing authors, Stefano Borini, is interested in updating the PEP with a new strategy that ha

[Python-Dev] Re: Resurrecting PEP-472

2020-08-29 Thread Steven D'Aprano
Okay, thanks everyone who answered. In hindsight you are all correct, writing a new PEP is the best solution and I was being over-optimistic (and a little lazy) to think otherwise. I think that, technically, I still have core dev permissions, even though I haven't used them for quite some time.

[Python-Dev] Python 4 FAQ

2020-09-15 Thread Steven D'Aprano
There's still a lot of community angst over the possibility that some hypothetical Python 4 will be like the 2/3 transition. Some people even imagine that the version after 3.9 could be that transition. I know we're not responsible for the ravings of people on social media, but do you think we

[Python-Dev] Understanding why object defines rich comparison methods

2020-09-22 Thread Steven D'Aprano
Why does `object` define rich comparison dunders `__lt__` etc? As far as I can tell, `object.__lt__` etc always return NotImplemented. Merely inheriting from object isn't enough to have comparisons work. So why do they exist at all? Other "do nothing" dunders such as `__add__` aren't defined.

[Python-Dev] Re: Understanding why object defines rich comparison methods

2020-09-22 Thread Steven D'Aprano
On Tue, Sep 22, 2020 at 02:13:46PM +0300, Serhiy Storchaka wrote: > 22.09.20 12:48, Steven D'Aprano пише: > > Why does `object` define rich comparison dunders `__lt__` etc? > Because object.__eq__ and object.__ne__ exist. If you define slot > tp_richcompare in C, it is exposed

[Python-Dev] Re: Do we still need a support of non-type objects in issubclass()?

2020-10-03 Thread Steven D'Aprano
On Sat, Oct 03, 2020 at 11:41:16AM +0300, Serhiy Storchaka wrote: > issubclass() accept types (extension types and new-style classes), > classic classes and arbitrary objects with the __bases__ attribute as > its arguments. I didn't think classic classes were still possible in Python 3. How do yo

[Python-Dev] Re: [python-committers] Resignation from Stefan Krah

2020-10-13 Thread Steven D'Aprano
On Tue, Oct 13, 2020 at 11:17:33AM +0100, Steve Holden wrote: > Full marks to the SC for transparency. That's a healthy sign that the > community acknowledges its disciplinary processes must also be open to > scrutiny, and rather better than dealing with matters in a Star Council. The SC didn't sa

[Python-Dev] Re: Changing Python's string search algorithms

2020-10-14 Thread Steven D'Aprano
Perhaps this is a silly suggestion, but could we offer this as an external function in the stdlib rather than a string method? Leave it up to the user to decide whether or not their data best suits the find method or the new search function. It sounds like we can offer some rough heuristics, bu

Re: [Python-Dev] Duck-typing self

2009-02-18 Thread Steven Bethard
On Wed, Feb 18, 2009 at 2:32 PM, Sebastian Rittau wrote: > Hi! > > I am curious why the following will not work in Python: > > class foo(object): > def bar(self): > print self.attr > > class duck(object): > attr = 3.14 > > foo.bar(duck()) > > Is it a design decision that duck

Re: [Python-Dev] IO implementation: in C and Python?

2009-02-19 Thread Steven D'Aprano
ess the Python versions without black magic or hacks? -- Steven ___ 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] IO implementation: in C and Python?

2009-02-20 Thread Steven D'Aprano
worth, I like that naming convention better than the current conventions Foo/cFoo, Foo/_Foo. -- Steven ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/ma

Re: [Python-Dev] Attention Bazaar mirror users

2009-02-21 Thread Steven Bethard
On Sat, Feb 21, 2009 at 1:11 PM, Paul Moore wrote: > PS Just for my own information, am I correct in thinking that it is > *only* Bazaar in the (D)VCS world that has this problem, to any real > extent? I know old Mercurial clients can interact with newer servers > (ie, the wire protocol hasn't cha

Re: [Python-Dev] Choosing a best practice solution for Python/extension modules

2009-02-22 Thread Steven Bethard
On Fri, Feb 20, 2009 at 1:45 PM, Brett Cannon wrote: > But there is another issue with this: the pure Python code will never call > the extension code because the globals will be bound to _pypickle and not > _pickle. So if you have something like:: > > # _pypickle > def A(): return _B() > de

Re: [Python-Dev] Choosing a best practice solution for Python/extension modules

2009-02-23 Thread Steven Bethard
On Mon, Feb 23, 2009 at 04:02, Nick Coghlan wrote: > For example, a version that allows any number of extension modules to be > suppressed when importing a module (defaulting to the Foo/_Foo naming): > > import sys > def import_python_only(mod_name, *ext_names): >if not ext_names: >e

Re: [Python-Dev] Challenge: Please break this! (was: Reviving restricted mode)

2009-02-23 Thread Steven Bethard
On Mon, Feb 23, 2009 at 12:10 PM, tav wrote: > Hey all, > > As an attempt to convince everyone of the merits of my functions-based > approach to security, I've come up with a simple challenge. I've > attached it as safelite.py > > The challenge is simple: > > * Open a fresh Python interpreter > *

Re: [Python-Dev] Allow __enter__() methods to skip the with statement body?

2009-02-25 Thread Steven Bethard
On Wed, Feb 25, 2009 at 4:24 AM, Nick Coghlan wrote: > An interesting discrepancy [1] has been noted when comparing > contextlib.nested (and contextlib.contextmanager) with the equivalent > nested with statements. > > Specifically, the following examples behave differently if > cmB().__enter__() r

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

2009-03-04 Thread Steven D'Aprano
s that an ordered dictionary feels like a fundamental data structure like str, list and dict rather than a specialist class like HTTPBasicAuthHandler. (I realise that "fundamental data structure" is not a well-defined category.) I look forward to the day OrderedDict becomes a built-in

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

2009-03-04 Thread Steven D'Aprano
es, but if so I don't know what they are. -- Steven ___ 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 372 -- Adding an ordered directory to collections ready for pronouncement

2009-03-04 Thread Steven D'Aprano
atives: OrderedDict and odict, or as Raymond puts it, green with pink polka dots versus pink with green polka dots. I don't think there's much point in suggesting fluorescent orange with brown and grey stripes as well. -- Steven ___ Python-D

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

2009-03-04 Thread Steven D'Aprano
ught to be horribly inefficient and slow. I also can't think of an alternative explanation, so thus far, it's resistant to false positive semantics. "The keys don't expire with time." "It's stable against accidental deletions." "It's stable ag

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] PEP 377 - allow __enter__() methods to skip the statement body

2009-03-15 Thread Steven Bethard
On Sun, Mar 15, 2009 at 10:50 AM, Michael Foord wrote: > Brett Cannon wrote: >> >> Without knowing what StatementSkipped is (just some singleton? If so why >> not just used SkipStatement instance that was raised?) and wondering if we >> are just going to continue to adding control flow exceptions

Re: [Python-Dev] PEP 377 - allow __enter__() methods to skip the statement body

2009-03-16 Thread Steven Bethard
On Mon, Mar 16, 2009 at 11:06 AM, Guido van Rossum wrote: > Moreover, since the main use case seems to be fixing a corner case of > the nested() context manager, perhaps the effort towards changing the > language would be better directed towards supporting "with a, b:" as a > shorthand for "with a

Re: [Python-Dev] "setuptools has divided the Python community"

2009-03-25 Thread Steven Bethard
On Wed, Mar 25, 2009 at 7:08 AM, Paul Moore wrote: > I use Python for systems admin scripts, Windows services, and database > management. In my experience (and I agree, it's only one, limited, use > case) availability of download-and-run bdist_wininst installers for > every package I used was the

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] [Python-ideas] Proposed addtion to urllib.parse in 3.1 (and urlparse in 2.7)

2009-04-13 Thread Steven Bethard
On Mon, Apr 13, 2009 at 2:29 AM, Mart Sõmermaa wrote: > > > On Mon, Apr 13, 2009 at 12:56 AM, Antoine Pitrou > wrote: >> >> Mart Sõmermaa gmail.com> writes: >> > >> > Proposal: add add_query_params() for appending query parameters to an >> > URL to >> urllib.parse and urlparse. >> >> Is there an

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] [Python-ideas] Proposed addtion to urllib.parse in 3.1 (and urlparse in 2.7)

2009-04-13 Thread Steven Bethard
On Mon, Apr 13, 2009 at 1:14 PM, Mart Sõmermaa wrote: > On Mon, Apr 13, 2009 at 8:23 PM, Steven Bethard > wrote: >> On Mon, Apr 13, 2009 at 2:29 AM, Mart Sõmermaa wrote: >> > As for the duplicate handling, I've implemented a threefold strategy that >> >

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] #!/usr/bin/env python --> python3 where applicable

2009-04-18 Thread Steven Bethard
On Sat, Apr 18, 2009 at 8:14 PM, Benjamin Peterson wrote: > 2009/4/18 Nick Coghlan : >> I see a few options: >> 1. Abandon the "python" name for the 3.x series and commit to calling it >> "python3" now and forever (i.e. actually make the decision that Mitchell >> refers to). > > I believe this was

Re: [Python-Dev] #!/usr/bin/env python --> python3 where applicable

2009-04-18 Thread Steven Bethard
On Sat, Apr 18, 2009 at 9:37 PM, Nick Coghlan wrote: > Steven Bethard wrote: >> On Sat, Apr 18, 2009 at 8:14 PM, Benjamin Peterson >> wrote: >>> 2009/4/18 Nick Coghlan : >>>> I see a few options: >>>> 1. Abandon the "python" name for

Re: [Python-Dev] #!/usr/bin/env python --> python3 where applicable

2009-04-18 Thread Steven Bethard
On Sat, Apr 18, 2009 at 10:04 PM, Nick Coghlan wrote: > Steven Bethard wrote: >> On Sat, Apr 18, 2009 at 9:37 PM, Nick Coghlan wrote: >>> Note that such an approach would then require an altaltinstall command >>> in order to be able to install a specific ve

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

2009-04-19 Thread Steven Bethard
On Sun, Apr 19, 2009 at 1:38 AM, Mart Sõmermaa wrote: > On Sun, Apr 19, 2009 at 2:06 AM, Nick Coghlan wrote: >> That said, I'm starting to wonder if an even better option may be to >> just drop the kwargs support from the function and require people to >> always supply a parameters dictionary. Th

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] Binary Operator for New-Style String Formatting

2009-06-21 Thread Steven Bethard
On Sun, Jun 21, 2009 at 1:36 PM, Jerry Chen wrote: > QUICK EXAMPLES > >    >>> "{} {} {}" @ (1, 2, 3) >    '1 2 3' > >    >>> "foo {qux} baz" @ {"qux": "bar"} >    'foo bar baz' > > One of the main complaints of a binary operator in PEP 3101 was the > inability to mix named and unnamed arguments: >

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

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

2009-09-27 Thread Steven Bethard
/ -- PEP: 389 Title: argparse - new command line parsing module Version: $Revision: 75097 $ Last-Modified: $Date: 2009-09-27 12:42:40 -0700 (Sun, 27 Sep 2009) $ Author: Steven Bethard Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 25-Sep-2009 Python-Version: 2.7 and 3.2

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-27 Thread Steven Bethard
On Sun, Sep 27, 2009 at 5:51 PM, Antoine Pitrou wrote: > I am neutral on the idea of adding argparse. However, I'm -1 on deprecating > optparse. It is very widely used (tons of scripts use it), and ok for many > uses; > deprecating it is totally unhelpful and gratuitous. Could you elaborate? If

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

2009-09-27 Thread Steven Bethard
On Sun, Sep 27, 2009 at 8:08 PM, Benjamin Peterson wrote: > 2009/9/27 Steven Bethard : >> If you think getopt and optparse should stick around in 3.X, why is >> that? If you think there are things that getopt and optparse do better >> than argparse, could you plea

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

2009-09-27 Thread Steven Bethard
On Sun, Sep 27, 2009 at 8:41 PM, Benjamin Peterson wrote: > 2009/9/27 Steven Bethard : >> The first release where any real deprecation message would show up is >> Python 3.4, more than 3 years away. If you think 3 years isn't long >> enough for people to be over the

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

2009-09-27 Thread Steven Bethard
On Sun, Sep 27, 2009 at 9:09 PM, "Martin v. Löwis" wrote: >> If you think getopt and optparse should stick around in 3.X, why is >> that? If you think there are things that getopt and optparse do better >> than argparse, could you please give some examples? > > I personally consider getopt superio

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

2009-09-27 Thread Steven Bethard
On Sun, Sep 27, 2009 at 8:49 PM, Benjamin Peterson wrote: > 2009/9/27 Steven Bethard : >> On Sun, Sep 27, 2009 at 8:41 PM, Benjamin Peterson >> wrote: >>> 2009/9/27 Steven Bethard : >>>> The first release where any real deprecation message would show up i

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

2009-09-28 Thread Steven Bethard
On Mon, Sep 28, 2009 at 6:03 AM, Jon Ribbens wrote: > On Mon, Sep 28, 2009 at 09:38:20AM +0100, Floris Bruynooghe wrote: >> On Mon, Sep 28, 2009 at 06:59:45AM +0300, Yuvgoog Greenle wrote: >> > -1 for deprecating getopt. getopt is super-simple and especially useful for >> > c programmers learning

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