Re: recommended __future__ imports for 2.5?

2008-11-25 Thread greg

Dennis Lee Bieber wrote:


I'm still waiting to hear that

from __past__ import division


Well, *I'm* waiting for the time machine technology to
be declassified, so we'll be able to do

  from __future__ import *

and get all the features that are ever going to be
added to Python!

--
Greg
--
http://mail.python.org/mailman/listinfo/python-list


Re: recommended __future__ imports for 2.5?

2008-11-25 Thread Nick Craig-Wood
Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
>  On Mon, 24 Nov 2008 13:36:32 -0700, Joe Strout <[EMAIL PROTECTED]>
>  declaimed the following in comp.lang.python:
> 
> > older versions of Python with "from __future__ import division".  Once  
> > I stumbled across that, I was able to find the relevant PEP (#238) and  
> > read more about it.  So now that import has become part of our  
> > standard boilerplate at the top of each file, along with the path to  
> > Python and the UTF-8 encoding declaration.
> >
>   I'm still waiting to hear that
> 
>   from __past__ import division
> 
>  will become a reality...

;-)

I think that is called using // instead of / which works without any
from __future__ import from python 2.2 onwards.

-- 
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
--
http://mail.python.org/mailman/listinfo/python-list


Re: recommended __future__ imports for 2.5?

2008-11-24 Thread Terry Reedy

Joe Strout wrote:
OK, this will probably be placed into the "stupid question" category by 
some, but I really am in need of a bit of guidance here.


I just rediscovered the "gotcha" of integer division in 2.5 and below, 
and found (to my delight) that this is fixed in 3.0, and fixable in 
older versions of Python with "from __future__ import division".  Once I 
stumbled across that, I was able to find the relevant PEP (#238) and 
read more about it.  So now that import has become part of our standard 
boilerplate at the top of each file, along with the path to Python and 
the UTF-8 encoding declaration.


Now I'm wondering what other boilerplate I should be using.  I'm not yet 
ready to upgrade to Python 2.6 -- parts of our business model rely on 
using the standard Python installed with Mac OS X (which is currently 
2.5.1).  But I would like our code to be as future-proof as possible, 
especially in cases like this where we're talking about changes to 
existing behavior, rather than the introduction of entirely new features 
(like the "with" statement).


I found , which lists 
the available future imports, but doesn't link to any documentation on 
them.  Searching for each one on google turns up some probably-relevant 
PEPs, but it's hard for a relative newbie to tell for sure exactly what 
was implemented when and which is merely a summary of discussion.


So... besides "division", are there any other imports you would 
recommend as standard for any new code written in 2.5?  And what else do 
you experienced gurus put at the top of every Python file?


2.5 (and 2.3 and 2.2) already has 'generators' and 'nested_scopes', so 
forget those unless programming for 2.2-.

"with_statement" is needed if and only if you use a with statement.
"absolute_import" ? I don't know what difference that makes. The doc on 
the import statement might say.


tjr

--
http://mail.python.org/mailman/listinfo/python-list


recommended __future__ imports for 2.5?

2008-11-24 Thread Joe Strout
OK, this will probably be placed into the "stupid question" category  
by some, but I really am in need of a bit of guidance here.


I just rediscovered the "gotcha" of integer division in 2.5 and below,  
and found (to my delight) that this is fixed in 3.0, and fixable in  
older versions of Python with "from __future__ import division".  Once  
I stumbled across that, I was able to find the relevant PEP (#238) and  
read more about it.  So now that import has become part of our  
standard boilerplate at the top of each file, along with the path to  
Python and the UTF-8 encoding declaration.


Now I'm wondering what other boilerplate I should be using.  I'm not  
yet ready to upgrade to Python 2.6 -- parts of our business model rely  
on using the standard Python installed with Mac OS X (which is  
currently 2.5.1).  But I would like our code to be as future-proof as  
possible, especially in cases like this where we're talking about  
changes to existing behavior, rather than the introduction of entirely  
new features (like the "with" statement).


I found , which lists  
the available future imports, but doesn't link to any documentation on  
them.  Searching for each one on google turns up some probably- 
relevant PEPs, but it's hard for a relative newbie to tell for sure  
exactly what was implemented when and which is merely a summary of  
discussion.


So... besides "division", are there any other imports you would  
recommend as standard for any new code written in 2.5?  And what else  
do you experienced gurus put at the top of every Python file?


Thanks,
- Joe



--
http://mail.python.org/mailman/listinfo/python-list