Re: [Python-Dev] Aware datetime from naive local time Was: Status on PEP-431 Timezones

2015-04-17 Thread Akira Li
On Thu, Apr 16, 2015 at 1:14 AM, Alexander Belopolsky < alexander.belopol...@gmail.com> wrote: > > On Wed, Apr 15, 2015 at 4:46 PM, Akira Li <4kir4...@gmail.com> wrote: > >> > Look what happened on July 1, 1990. At 2 AM, the clocks in Ukraine were >> > mo

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

2015-04-15 Thread Akira Li
Isaac Schwabacher writes: > 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('Americ

Re: [Python-Dev] Aware datetime from naive local time Was: Status on PEP-431 Timezones

2015-04-15 Thread Akira Li
Alexander Belopolsky writes: > ... > For most world locations past discontinuities are fairly well documented > for at least a century and future changes are published with at least 6 > months lead time. It is important to note that the different versions of the tz database may lead to different

Re: [Python-Dev] Aware datetime from naive local time Was: Status on PEP-431 Timezones

2015-04-15 Thread Akira Li
Alexander Belopolsky writes: > Sorry for a truncated message. Please scroll past the quoted portion. > > On Thu, Apr 9, 2015 at 10:21 PM, Alexander Belopolsky < > alexander.belopol...@gmail.com> wrote: > >> >> On Thu, Apr 9, 2015 at 4:51 PM, Isaac Schwabacher >> wrote: >> >>> > > > Well, you ar

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

2015-04-15 Thread Akira Li
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 add a time zone to an existing naive datetime is painful (and > strptime doesn't even let you pass in a time zone)

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

2015-04-15 Thread Akira Li
Lennart Regebro writes: > OK, so I realized another thing today, and that is that arithmetic > doesn't necessarily round trip. > > For example, 2002-10-27 01:00 US/Eastern comes both in DST and STD. > > But 2002-10-27 01:00 US/Eastern STD minus two days is 2002-10-25 01:00 > US/Eastern DST "two

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

2015-04-15 Thread Akira Li
Alexander Belopolsky writes: > On Wed, Apr 8, 2015 at 3:57 PM, Isaac Schwabacher > wrote: >> >> On 15-04-08, Alexander Belopolsky wrote: >> > With datetime, we also have a problem that POSIX APIs don't have to > deal with: local time >> > arithmetics. What is t + timedelta(1) when t falls on the

Re: [Python-Dev] PEP 481 - Migrate Some Supporting Repositories to Git and Github

2014-11-30 Thread Akira Li
Larry Hastings writes: > On 11/29/2014 04:37 PM, Donald Stufft wrote: >> On Nov 29, 2014, at 7:15 PM, Alex Gaynor wrote: >>> Despite being a regular hg >>> user for years, I have no idea how to create a local-only branch, or a >>> branch >>> which is pushed to a remote (to use the git term). >>

Re: [Python-Dev] Multilingual programming article on the Red Hat Developer blog

2014-09-16 Thread Akira Li
Steven D'Aprano writes: > On Wed, Sep 17, 2014 at 11:14:15AM +1000, Chris Angelico wrote: >> On Wed, Sep 17, 2014 at 5:29 AM, R. David Murray >> wrote: > >> > Basically, we are pretending that the each smuggled >> > byte is single character for string parsing purposes...but they don't >> > matc

Re: [Python-Dev] Multiline with statement line continuation

2014-08-13 Thread Akira Li
Nick Coghlan writes: > On 12 August 2014 22:15, Steven D'Aprano wrote: >> Compare the natural way of writing this: >> >> with open("spam") as spam, open("eggs", "w") as eggs, frobulate("cheese") as >> cheese: >> # do stuff with spam, eggs, cheese >> >> versus the dynamic way: >> >> with Exi

Re: [Python-Dev] os.walk() is going to be *fast* with scandir

2014-08-11 Thread Akira Li
Armin Rigo writes: > On 10 August 2014 08:11, Larry Hastings wrote: >>> A small tip from my bzr days - cd into the directory before scanning it >> >> I doubt that's permissible for a library function like os.scandir(). > > Indeed, chdir() is notably not compatible with multithreading. There > w

Re: [Python-Dev] python2.7 infinite recursion when loading pickled object

2014-08-11 Thread Akira Li
"Schmitt Uwe (ID SIS)" writes: > I discovered a problem using cPickle.loads from CPython 2.7.6. > > The last line in the following code raises an infinite recursion > > class T(object): > > def __init__(self): > self.item = list() > > def __getattr__(self, name):

Re: [Python-Dev] Exposing the Android platform existence to Python modules

2014-08-03 Thread Akira Li
Shiz writes: > The most obvious change would be to subprocess.Popen(). The reason a > generic approach there won't work is also the reason I expect more > changes might be needed: the Android file system doesn't abide by any > POSIX file system standards. Its shell isn't located at /bin/sh, but a

Re: [Python-Dev] Exposing the Android platform existence to Python modules

2014-08-03 Thread Akira Li
Guido van Rossum writes: > Well, it really does look like checking for the presence of those ANDROID_* > environment variables it the best way to recognize the Android platform. > Anyone can do that without waiting for a ruling on whether Android is Linux > or not (which would be necessary becaus

Re: [Python-Dev] Exposing the Android platform existence to Python modules

2014-08-01 Thread Akira Li
Shiz writes: > Hi folks, > > I’m working on porting CPython to the Android platform, and while > making decent progress, I’m currently stuck at a higher-level issue > than adding #ifdefs for __ANDROID__ to C extension modules. > > The idea is, not only CPython extension modules have some assumpti

Re: [Python-Dev] PEP 471 "scandir" accepted

2014-07-22 Thread Akira Li
Ben Hoyt writes: >> Note: listdir() accepts an integer path (an open file descriptor that >> refers to a directory) that is passed to fdopendir() on POSIX [4] i.e., >> *you can't use scandir() to replace listdir() in this case* (as I've >> already mentioned in [1]). See the corresponding tests fr

Re: [Python-Dev] PEP 471 "scandir" accepted

2014-07-22 Thread Akira Li
Ben Hoyt writes: > I think if I were doing this from scratch I'd reimplement listdir() in > Python as "return [e.name for e in scandir(path)]". ... > So my basic plan is to have an internal helper function in > posixmodule.c that either yields DirEntry objects or strings. And then > listdir() wou

Re: [Python-Dev] Remaining decisions on PEP 471 -- os.scandir()

2014-07-14 Thread Akira Li
Nick Coghlan writes: > On 13 Jul 2014 20:54, "Tim Delaney" wrote: >> >> On 14 July 2014 10:33, Ben Hoyt wrote: >>> >>> >>> >>> If we go with Victor's link-following .is_dir() and .is_file(), then >>> we probably need to add his suggestion of a follow_symlinks=False >>> parameter (defaults to Tr

Re: [Python-Dev] == on object tests identity in 3.x - list delegation to members?

2014-07-13 Thread Akira Li
Nick Coghlan writes: ... > definition of floats and the definition of container invariants like > "assert x in [x]") > > The current approach means that the lack of reflexivity of NaN's stays > confined to floats and similar types - it doesn't leak out and infect > the behaviour of the container t

Re: [Python-Dev] Updates to PEP 471, the os.scandir() proposal

2014-07-09 Thread Akira Li
Ben Hoyt writes: ... > ``scandir()`` yields a ``DirEntry`` object for each file and directory > in ``path``. Just like ``listdir``, the ``'.'`` and ``'..'`` > pseudo-directories are skipped, and the entries are yielded in > system-dependent order. Each ``DirEntry`` object has the following > attri

Re: [Python-Dev] PEP 471: scandir(fd) and pathlib.Path(name, dir_fd=None)

2014-07-01 Thread Akira Li
Ben Hoyt writes: > Thanks, Victor. > > I don't have any experience with dir_fd handling, so unfortunately > can't really comment here. > > What advantages does it bring? I notice that even os.listdir() on > Python 3.4 doesn't have anything related to file descriptors, so I'd > be in favour of not

Re: [Python-Dev] PEP 471 -- os.scandir() function -- a better and faster directory iterator

2014-06-29 Thread Akira Li
Chris Angelico writes: > On Sat, Jun 28, 2014 at 11:05 PM, Akira Li <4kir4...@gmail.com> wrote: >> Have you considered adding support for paths relative to directory >> descriptors [1] via keyword only dir_fd=None parameter if it may lead to >> more efficient implem

Re: [Python-Dev] PEP 471 -- os.scandir() function -- a better and faster directory iterator

2014-06-28 Thread Akira Li
Ben Hoyt writes: > Hi Python dev folks, > > I've written a PEP proposing a specific os.scandir() API for a > directory iterator that returns the stat-like info from the OS, *the > main advantage of which is to speed up os.walk() and similar > operations between 4-20x, depending on your OS and fil

Re: [Python-Dev] subprocess shell=True on Windows doesn't escape ^ character

2014-06-13 Thread Akira Li
Florian Bruhin writes: > * Nikolaus Rath [2014-06-12 19:11:07 -0700]: >> "R. David Murray" writes: >> > Also notice that using a list with shell=True is using the API >> > incorrectly. It wouldn't even work on Linux, so that torpedoes >> > the cross-platform concern already :) >> > >> > This k

Re: [Python-Dev] should tests be thread-safe?

2014-05-11 Thread Akira Li
Victor Stinner writes: > If you need a well defined environement, run your test in a subprocess. > Depending on the random function, your test may be run with more threads. > On BSD, it changes for example which thread receives a signal. Importing > the tkinter module creates a "hidden" C thread