[Python-Dev] pathlib handling of trailing slash (Issue #21039)

2014-08-06 Thread Isaac Schwabacher
le dot character ( > '.' ) were appended to the pathname. Is this important enough to preserve trailing slashes? - Isaac Schwabacher ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

[Python-Dev] pathlib handling of trailing slash (Issue #21039)

2014-08-11 Thread Isaac Schwabacher
I see this as a parallel to the question of `pathlib.PurePath.resolve()`, about which `pathlib` is (rightly!) very opinionated. Just as `foo/../bar` shouldn't resolve to `bar`, `foo/` shouldn't be truncated to `foo`. And if `PurePath` doesn't do this, `Path` shouldn't either, because the differe

Re: [Python-Dev] Please reconsider PEP 479.

2014-11-24 Thread Isaac Schwabacher
On 11/23/14, Guido van Rossum wrote: > It wouldn't be so bad if we had the occasional generator author writing > "raise StopIteration" instead of "return" to exit from a generator. (We could > just add a recommendation against this to the style guide.) But the problem > is that an unguarded ne

Re: [Python-Dev] Please reconsider PEP 479.

2014-11-24 Thread Isaac Schwabacher
On 11/24/14, Guido van Rossum wrote: > On Mon, Nov 24, 2014 at 8:14 AM, Isaac Schwabacher > wrote: > > > On 11/23/14, Guido van Rossum wrote: > > > > > It wouldn't be so bad if we had the occasional generator author writing > > > "raise

Re: [Python-Dev] Please reconsider PEP 479.

2014-11-24 Thread Isaac Schwabacher
On 11/24/14, Guido van Rossum wrote: > On Mon, Nov 24, 2014 at 1:32 PM, Isaac Schwabacher ischwabac...@wisc.edu> wrote: > > > On 11/24/14, Guido van Rossum wrote: > > > On Mon, Nov 24, 2014 at 8:14 AM, Isaac Schwabacher > > > > > 't=ischwabac...

Re: [Python-Dev] PEP 479: Change StopIteration handling inside generators

2014-11-25 Thread Isaac Schwabacher
On 11/25/14, Guido van Rossum wrote: > On Tue, Nov 25, 2014 at 9:49 AM, Chris Angelico ros...@gmail.com> wrote: > > > On Wed, Nov 26, 2014 at 4:45 AM, Isaac Schwabacher > > > 't=ischwabac...@wisc.edu>> wrote: > > > Yield can also raise

Re: [Python-Dev] PEP 479: Change StopIteration handling inside generators

2014-11-25 Thread Isaac Schwabacher
On 11/25/14, Chris Angelico wrote: > On Wed, Nov 26, 2014 at 2:20 AM, Steven D'Aprano wrote: > > I wouldn't interpret it like that. > > > > Calling next() on an empty iterator raises StopIteration. That's not a > > bug indicating a failure, it's the protocol working as expected. Your > > response

Re: [Python-Dev] PEP 479: Change StopIteration handling inside generators

2014-11-26 Thread Isaac Schwabacher
On 11/26/14, Nick Coghlan wrote: > On 26 November 2014 at 04:04, Guido van Rossum wrote: > > On Tue, Nov 25, 2014 at 9:49 AM, Chris Angelico wrote: > >> > >> On Wed, Nov 26, 2014 at 4:45 AM, Isaac Schwabacher > >> wrote: > >> > Yield can also rai

Re: [Python-Dev] PEP 479: Change StopIteration handling inside generators

2014-11-26 Thread Isaac Schwabacher
On 11/26/14, Nick Coghlan wrote: > On 26 November 2014 at 04:04, Guido van Rossum wrote: > > On Tue, Nov 25, 2014 at 9:49 AM, Chris Angelico wrote: > >> > >> On Wed, Nov 26, 2014 at 4:45 AM, Isaac Schwabacher > >> wrote: > >> > Yield can also rai

Re: [Python-Dev] PEP 479: Change StopIteration handling inside generators

2014-11-26 Thread Isaac Schwabacher
On 14-11-26, Guido van Rossum wrote: > On Wed, Nov 26, 2014 at 8:54 AM, Paul Moore wrote: > > > On 26 November 2014 at 16:24, Isaac Schwabacher wrote: > > > This actually leads to a good example of why the PEP is necessary: > > [...] > > > > Oh! If that&#x

Re: [Python-Dev] PEP 479: Change StopIteration handling inside generators

2014-11-26 Thread Isaac Schwabacher
> Can you summarize that in a self-contained form for inclusion in the PEP? > > (That was a rhetorical question. :-) Sure. Is it on GitHub? ;D ijs ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Uns

Re: [Python-Dev] subclassing builtin data structures

2015-02-13 Thread Isaac Schwabacher
On 15-02-13, Guido van Rossum wrote: > Are you willing to wait 10 days for an answer? I'm out of round tuits for > a while. IIUC, the argument is that the Liskov Substitution Principle is a statement about how objects of a subtype behave relative to objects of a supertype, and it doesn't apply

Re: [Python-Dev] subclassing builtin data structures

2015-02-13 Thread Isaac Schwabacher
On 15-02-13, Neil Girdhar wrote: > Interesting:  > http://stackoverflow.com/questions/5490824/should-constructors-comply-with-the-liskov-substitution-principle You'd better believe I read that thread not 20 minutes ago. :) > On Fri, Feb 13, 2015 at 3:37 PM, Isaac Schwabacher

Re: [Python-Dev] subclassing builtin data structures

2015-02-13 Thread Isaac Schwabacher
ethods with this very precisely defined structure: test base against yourself, then any superclasses you care to mimic, then call super. Any antisocial superclass ruins everyone's party. > Best, > Neil > > > On Fri, Feb 13, 2015 at 7:00 PM, Isaac Schwabacher > target="1&q

Re: [Python-Dev] subclassing builtin data structures

2015-02-13 Thread Isaac Schwabacher
On 15-02-13, Neil Girdhar wrote: > I personally don't think this is a big enough issue to warrant any > changes, but I think Serhiy's solution would be the ideal best with one > additional parameter: the caller's type. Something like > > def __make_me__(self, cls, *args, **kwargs) > > > and t

Re: [Python-Dev] subclassing builtin data structures

2015-02-13 Thread Isaac Schwabacher
Hmm... super *is* a problem, because if we super, we can end up asking superclasses that we then won't know how to mimic. So what we really want is to move the superclasses we can mimic to the front of the MRO. If none of those can indirectly mimic the base class, then we try the other classes i

Re: [Python-Dev] Tunning binary insertion sort algorithm in Timsort.

2015-03-09 Thread Isaac Schwabacher
On 15-03-08, nha pham wrote: > > We can optimize the TimSort algorithm by optimizing its binary insertion sort. > > The current version of binary insertion sort use this idea: > > Use binary search to find a final position in sorted list for a new element > X. Then insert X to that location.

Re: [Python-Dev] str.lstrip bug?

2015-03-10 Thread Isaac Schwabacher
On 15-03-10, Ethan Furman wrote: > On 03/10/2015 10:57 AM, Isaac Schwabacher wrote: > > On 15-03-10, Facundo Batista wrote: > >> On Tue, Mar 10, 2015 at 2:27 PM, lou xiao wrote: > >> > >>> tiny➜ ~ python > >>> Python 2.7.5+ (default, Feb 27 201

Re: [Python-Dev] str.lstrip bug?

2015-03-12 Thread Isaac Schwabacher
On 15-03-10, Facundo Batista wrote: > On Tue, Mar 10, 2015 at 2:27 PM, lou xiao wrote: > > > tiny➜ ~ python > > Python 2.7.5+ (default, Feb 27 2014, 19:37:08) > > [GCC 4.8.1] on linux2 > > Type "help", "copyright", "credits" or "license" for more information. > a='device_info' > a.lstr

Re: [Python-Dev] Status on PEP-431 Timezones

2015-04-09 Thread Isaac Schwabacher
On 15-04-09, Alexander Belopolsky wrote: > > On Thu, Apr 9, 2015 at 11:59 AM, Isaac Schwabacher > wrote: > > > > Storing isdst in the datetime object would allow utcoffset(dt) to > > > distinguish between 1:30AM before clock change and 1:30AM after. Where do

Re: [Python-Dev] Status on PEP-431 Timezones

2015-04-08 Thread Isaac Schwabacher
On 15-04-08, Lennart Regebro wrote: > === Stdlib option 2: A datetime _is_dst flag === > > By having a flag on the datetime instance that says "this is in DST or not" > the timezone implementation can be kept simpler. Storing the offset itself instead of a flag makes things conceptually cleaner.

Re: [Python-Dev] Status on PEP-431 Timezones

2015-04-09 Thread Isaac Schwabacher
On 15-04-08, Alexander Belopolsky wrote: > > On Wed, Apr 8, 2015 at 6:52 PM, Isaac Schwabacher > wrote: > > > > > So "storing the offset" and "storing a flag" are not two alternative > > > solutions to the same problem- these > >

Re: [Python-Dev] Status on PEP-431 Timezones

2015-04-09 Thread Isaac Schwabacher
On 15-04-09, Alexander Belopolsky wrote: > > On Thu, Apr 9, 2015 at 11:59 AM, Isaac Schwabacher > wrote: > > > I just looked through the datetime documentation, and it looks like the > > currently blessed way of creating an aware datetime from a naive local >

Re: [Python-Dev] Status on PEP-431 Timezones

2015-04-09 Thread Isaac Schwabacher
On 15-04-09, Alexander Belopolsky wrote: > > On Thu, Apr 9, 2015 at 3:07 PM, Isaac Schwabacher > wrote: > > > > No, it does not. Please read the documentation: "self must be aware > > > (self.tzinfo must not be None, and self.utcoffset() must not return &g

Re: [Python-Dev] Status on PEP-431 Timezones

2015-04-09 Thread Isaac Schwabacher
On 15-04-09, Alexander Belopolsky wrote: > > On Thu, Apr 9, 2015 at 3:39 PM, Isaac Schwabacher > wrote: > > > > Well, you are right, but at least we do have a localtime utility hidden > > > in the email package: > > > > > > >>>

Re: [Python-Dev] Status on PEP-431 Timezones

2015-04-08 Thread Isaac Schwabacher
On 15-04-08, Alexander Belopolsky wrote: > > On Wed, Apr 8, 2015 at 3:57 PM, Isaac Schwabacher > wrote: > > > > On 15-04-08, Lennart Regebro wrote: > > > === Stdlib option 2: A datetime _is_dst flag === > > > > > > By having a flag on th

Re: [Python-Dev] Status on PEP-431 Timezones

2015-04-15 Thread Isaac Schwabacher
On 15-04-15, Lennart Regebro wrote: > On Wed, Apr 15, 2015 at 11:10 AM, Chris Angelico wrote: > > Bikeshed: Would arithmetic be based on UTC time or Unix time? It'd be > > more logical to describe it as "adding six hours means adding six > > hours to the UTC time", but it'd look extremely odd whe

Re: [Python-Dev] Status on PEP-431 Timezones

2015-04-15 Thread Isaac Schwabacher
On 15-04-15, Lennart Regebro wrote: > On Wed, Apr 15, 2015 at 12:40 PM, Isaac Schwabacher > wrote: > > I am on the fence about EPOCH + offset as an internal representation. On > > the one hand, it is conceptually cleaner than the horrible byte-packing > > that exists

Re: [Python-Dev] Status on PEP-431 Timezones

2015-04-15 Thread Isaac Schwabacher
On 15-04-15, Akira Li <4kir4...@gmail.com> wrote: > Isaac Schwabacher writes: > > ... > > > > I know that you can do datetime.now(tz), and you can do datetime(2013, > > 11, 3, 1, 30, tzinfo=zoneinfo('America/Chicago')), but not being able > > to

Re: [Python-Dev] Status on PEP-431 Timezones

2015-04-15 Thread Isaac Schwabacher
On 15-04-15, Akira Li <4kir4...@gmail.com> wrote: > Isaac Schwabacher writes: > > > On 15-04-15, Akira Li <4kir4...@gmail.com> wrote: > >> Isaac Schwabacher writes: > >> > ... > >> > > >> > I know that you can do dateti

Re: [Python-Dev] PEP 492 vs. PEP 3152, new round

2015-04-30 Thread Isaac Schwabacher
On 15-04-29, Yury Selivanov wrote: > Hi Ethan, > > On 2015-04-29 2:32 PM, Ethan Furman wrote: > >On 04/29, Yury Selivanov wrote: > >>On 2015-04-29 1:25 PM, Ethan Furman wrote: > >>>cannot also just work and be the same as the parenthesized > >>>version. > >>Because it does not make any sense. > >

Re: [Python-Dev] PEP 492 vs. PEP 3152, new round

2015-04-30 Thread Isaac Schwabacher
On 15-04-29, Yury Selivanov wrote: > > > On 2015-04-29 3:24 PM, Isaac Schwabacher wrote: > >On 15-04-29, Yury Selivanov wrote: > >>Hi Ethan, > [..] > >>So I want to make this syntactically incorrect: > >Does this need to be a syntax error? -"hello