Re: [Python-Dev] [Python-checkins] r87980 - in python/branches/py3k/Lib/importlib: _bootstrap.py abc.py

2011-01-13 Thread Jim Jewett
Why?

Are annotations being deprecated in general?  Or are these particular
annotations no longer accurate?

-jJ

On Wed, Jan 12, 2011 at 9:31 PM, raymond.hettinger
 wrote:
> Author: raymond.hettinger
> Date: Thu Jan 13 03:31:25 2011
> New Revision: 87980
>
> Log:
> Issue 10899: Remove function type annotations from the stdlib
>
> Modified:
>   python/branches/py3k/Lib/importlib/_bootstrap.py
>   python/branches/py3k/Lib/importlib/abc.py
>
> Modified: python/branches/py3k/Lib/importlib/_bootstrap.py
> ==
> --- python/branches/py3k/Lib/importlib/_bootstrap.py    (original)
> +++ python/branches/py3k/Lib/importlib/_bootstrap.py    Thu Jan 13 03:31:25 
> 2011
> @@ -345,7 +345,7 @@
>
>  class SourceLoader(_LoaderBasics):
>
> -    def path_mtime(self, path:str) -> int:
> +    def path_mtime(self, path):
>         """Optional method that returns the modification time for the 
> specified
>         path.
>
> @@ -354,7 +354,7 @@
>         """
>         raise NotImplementedError
>
> -    def set_data(self, path:str, data:bytes) -> None:
> +    def set_data(self, path, data):
>         """Optional method which writes data to a file path.
>
>         Implementing this method allows for the writing of bytecode files.
>
> Modified: python/branches/py3k/Lib/importlib/abc.py
> ==
> --- python/branches/py3k/Lib/importlib/abc.py   (original)
> +++ python/branches/py3k/Lib/importlib/abc.py   Thu Jan 13 03:31:25 2011
> @@ -18,7 +18,7 @@
>     """Abstract base class for import loaders."""
>
>     @abc.abstractmethod
> -    def load_module(self, fullname:str) -> types.ModuleType:
> +    def load_module(self, fullname):
>         """Abstract method which when implemented should load a module."""
>         raise NotImplementedError
>
> @@ -28,7 +28,7 @@
>     """Abstract base class for import finders."""
>
>     @abc.abstractmethod
> -    def find_module(self, fullname:str, path:[str]=None) -> Loader:
> +    def find_module(self, fullname, path=None):
>         """Abstract method which when implemented should find a module."""
>         raise NotImplementedError
>
> @@ -47,7 +47,7 @@
>     """
>
>     @abc.abstractmethod
> -    def get_data(self, path:str) -> bytes:
> +    def get_data(self, path):
>         """Abstract method which when implemented should return the bytes for
>         the specified path."""
>         raise NotImplementedError
> @@ -63,19 +63,19 @@
>     """
>
>     @abc.abstractmethod
> -    def is_package(self, fullname:str) -> bool:
> +    def is_package(self, fullname):
>         """Abstract method which when implemented should return whether the
>         module is a package."""
>         raise NotImplementedError
>
>     @abc.abstractmethod
> -    def get_code(self, fullname:str) -> types.CodeType:
> +    def get_code(self, fullname):
>         """Abstract method which when implemented should return the code 
> object
>         for the module"""
>         raise NotImplementedError
>
>     @abc.abstractmethod
> -    def get_source(self, fullname:str) -> str:
> +    def get_source(self, fullname):
>         """Abstract method which should return the source code for the
>         module."""
>         raise NotImplementedError
> @@ -94,7 +94,7 @@
>     """
>
>     @abc.abstractmethod
> -    def get_filename(self, fullname:str) -> str:
> +    def get_filename(self, fullname):
>         """Abstract method which should return the value that __file__ is to 
> be
>         set to."""
>         raise NotImplementedError
> @@ -117,11 +117,11 @@
>
>     """
>
> -    def path_mtime(self, path:str) -> int:
> +    def path_mtime(self, path):
>         """Return the modification time for the path."""
>         raise NotImplementedError
>
> -    def set_data(self, path:str, data:bytes) -> None:
> +    def set_data(self, path, data):
>         """Write the bytes to the path (if possible).
>
>         Any needed intermediary directories are to be created. If for some
> @@ -170,7 +170,7 @@
>         raise NotImplementedError
>
>     @abc.abstractmethod
> -    def source_path(self, fullname:str) -> object:
> +    def source_path(self, fullname):
>         """Abstract method which when implemented should return the path to 
> the
>         source code for the module."""
>         raise NotImplementedError
> @@ -279,19 +279,19 @@
>         return code_object
>
>     @abc.abstractmethod
> -    def source_mtime(self, fullname:str) -> int:
> +    def source_mtime(self, fullname):
>         """Abstract method which when implemented should return the
>         modification time for the source of the module."""
>         raise NotImplementedError
>
>     @abc.abstractmethod
> -    def bytecode_path(self, fullname:str) -> object:
> +    def bytecode_path(self, fullname):
>         """Abstract method which when implemented should return the path to 
> the
>         bytecode for the modu

Re: [Python-Dev] [Python-checkins] r87980 - in python/branches/py3k/Lib/importlib: _bootstrap.py abc.py

2011-01-13 Thread Michael Foord

On 13/01/2011 13:21, Jim Jewett wrote:

Why?

Are annotations being deprecated in general?  Or are these particular
annotations no longer accurate?


See issue 10899.

http://bugs.python.org/issue10899

Annotations are not deprecated but there is no accepted convention on 
their use (plus third party developers are free to create whatever use 
cases they want for annotations) so annotations are being kept out of 
the standard library. Particularly given that they were untested and unused.


All the best,

Michael Foord


-jJ

On Wed, Jan 12, 2011 at 9:31 PM, raymond.hettinger
  wrote:

Author: raymond.hettinger
Date: Thu Jan 13 03:31:25 2011
New Revision: 87980

Log:
Issue 10899: Remove function type annotations from the stdlib

Modified:
   python/branches/py3k/Lib/importlib/_bootstrap.py
   python/branches/py3k/Lib/importlib/abc.py

Modified: python/branches/py3k/Lib/importlib/_bootstrap.py
==
--- python/branches/py3k/Lib/importlib/_bootstrap.py(original)
+++ python/branches/py3k/Lib/importlib/_bootstrap.pyThu Jan 13 03:31:25 2011
@@ -345,7 +345,7 @@

  class SourceLoader(_LoaderBasics):

-def path_mtime(self, path:str) ->  int:
+def path_mtime(self, path):
 """Optional method that returns the modification time for the specified
 path.

@@ -354,7 +354,7 @@
 """
 raise NotImplementedError

-def set_data(self, path:str, data:bytes) ->  None:
+def set_data(self, path, data):
 """Optional method which writes data to a file path.

 Implementing this method allows for the writing of bytecode files.

Modified: python/branches/py3k/Lib/importlib/abc.py
==
--- python/branches/py3k/Lib/importlib/abc.py   (original)
+++ python/branches/py3k/Lib/importlib/abc.py   Thu Jan 13 03:31:25 2011
@@ -18,7 +18,7 @@
 """Abstract base class for import loaders."""

 @abc.abstractmethod
-def load_module(self, fullname:str) ->  types.ModuleType:
+def load_module(self, fullname):
 """Abstract method which when implemented should load a module."""
 raise NotImplementedError

@@ -28,7 +28,7 @@
 """Abstract base class for import finders."""

 @abc.abstractmethod
-def find_module(self, fullname:str, path:[str]=None) ->  Loader:
+def find_module(self, fullname, path=None):
 """Abstract method which when implemented should find a module."""
 raise NotImplementedError

@@ -47,7 +47,7 @@
 """

 @abc.abstractmethod
-def get_data(self, path:str) ->  bytes:
+def get_data(self, path):
 """Abstract method which when implemented should return the bytes for
 the specified path."""
 raise NotImplementedError
@@ -63,19 +63,19 @@
 """

 @abc.abstractmethod
-def is_package(self, fullname:str) ->  bool:
+def is_package(self, fullname):
 """Abstract method which when implemented should return whether the
 module is a package."""
 raise NotImplementedError

 @abc.abstractmethod
-def get_code(self, fullname:str) ->  types.CodeType:
+def get_code(self, fullname):
 """Abstract method which when implemented should return the code object
 for the module"""
 raise NotImplementedError

 @abc.abstractmethod
-def get_source(self, fullname:str) ->  str:
+def get_source(self, fullname):
 """Abstract method which should return the source code for the
 module."""
 raise NotImplementedError
@@ -94,7 +94,7 @@
 """

 @abc.abstractmethod
-def get_filename(self, fullname:str) ->  str:
+def get_filename(self, fullname):
 """Abstract method which should return the value that __file__ is to be
 set to."""
 raise NotImplementedError
@@ -117,11 +117,11 @@

 """

-def path_mtime(self, path:str) ->  int:
+def path_mtime(self, path):
 """Return the modification time for the path."""
 raise NotImplementedError

-def set_data(self, path:str, data:bytes) ->  None:
+def set_data(self, path, data):
 """Write the bytes to the path (if possible).

 Any needed intermediary directories are to be created. If for some
@@ -170,7 +170,7 @@
 raise NotImplementedError

 @abc.abstractmethod
-def source_path(self, fullname:str) ->  object:
+def source_path(self, fullname):
 """Abstract method which when implemented should return the path to the
 source code for the module."""
 raise NotImplementedError
@@ -279,19 +279,19 @@
 return code_object

 @abc.abstractmethod
-def source_mtime(self, fullname:str) ->  int:
+def source_mtime(self, fullname):
 """Abstract method which when implemented should return the
 modification time for the source of the module."""
 raise NotImplementedError

 

[Python-Dev] Get current UTC offset in crossplatform way

2011-01-13 Thread anatoly techtonik
Hello,

It is already 2011. I didn't monitor the issue closely, but judging by
the face that http://bugs.python.org/issue9527 is still open, Python
still doesn't have a method to extract current timezone information
from system. Can anybody recap what are we going to do with that in
Python 3?

Probably related - http://bugs.python.org/issue762963

It is very cumbersome to work with distributed time data with plain Python.
--
anatoly t.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Approach for constructing Global Variables for Python

2011-01-13 Thread Ben Finney
ali musa  writes:

> [a large non-text document]

Please don't paste documents here. If you want to share some information
with us, please post a plain text message.

-- 
 \ “Of all classes the rich are the most noticed and the least |
  `\  studied.” —John Kenneth Galbraith, _The Age of Uncertainty_, |
_o__) 1977 |
Ben Finney

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Get current UTC offset in crossplatform way

2011-01-13 Thread Victor Stinner
Le vendredi 14 janvier 2011 à 02:32 +0200, anatoly techtonik a écrit :
> It is already 2011. I didn't monitor the issue closely, but judging by
> the face that http://bugs.python.org/issue9527 is still open, Python
> still doesn't have a method to extract current timezone information
> from system. Can anybody recap what are we going to do with that in
> Python 3?

The status of #9527 is that Alexander waits for an initial review. So if
you would like to help, you can start with a review.

The status of #762963 is that the patch doesn't work: "It changes the
behaviour of time.asctime(time.gmtime(time.time()))". "A proper fix
would be to use tm_gmtoff explicitly (...)".

#1647654 has such patch (written by Alexander). Alexander is waiting for
an approval (and maybe a review?): "The patch needs documentation
updates which I will add if the idea is well received." If you want like
to help, you can also comment this issue.

Victor

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Approach for constructing Global Variables for Python

2011-01-13 Thread Nick Coghlan
a) This is somewhat off-topic for this list (it is more suitable to
python-ideas, at best)
b) Defining process global singletons and other heap data structures in C
and C++ programs is hardly a new idea
c) Defining head data structures isn't the hard part, the hard part is
accessing them in a reasonably efficient thread-safe manner.

Given point c), an article on process global variables were the letter
sequence "thread" appears only twice, and the letter sequence "sync" never
appears at all and the letter sequence "lock" appears only inside the word
"block" doesn't inspire much confidence.

Regards,
Nick.

-- 
Nick Coghlan   |   [email protected]   |   Brisbane, Australia
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Approach for constructing Global Variables for Python

2011-01-13 Thread Nick Coghlan
On Fri, Jan 14, 2011 at 10:50 AM, Nick Coghlan  wrote:
> c) Defining head data structures isn't the hard part, the hard part is
> accessing them in a reasonably efficient thread-safe manner.

s/head/heap/

Cheers,
Nick.

-- 
Nick Coghlan   |   [email protected]   |   Brisbane, Australia
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com