%-formatting depracation

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

%-formatting depracation

Ethan Furman-2
Greetings!

According to these release notes in Python 3.0, %-formatting will be
going away.

http://docs.python.org/release/3.0.1/whatsnew/3.0.html#pep-3101-a-new-approach-to-string-formatting


However, I was unable to find any further evidence of actual deprecation
in 3.1 or 3.2...  does anybody know the status of this?

~Ethan~
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: %-formatting depracation

Brett Cannon-2
On Tue, Feb 22, 2011 at 10:43, Ethan Furman <[hidden email]> wrote:
Greetings!

According to these release notes in Python 3.0, %-formatting will be going away.

http://docs.python.org/release/3.0.1/whatsnew/3.0.html#pep-3101-a-new-approach-to-string-formatting


However, I was unable to find any further evidence of actual deprecation in 3.1 or 3.2...  does anybody know the status of this?

There isn't one. =)

The very long term view is for %-formatting to go away, but that's as far as the thinking has gone. There are currently no plans to introduce any deprecation warning, and I highly doubt we will even remove the feature in Python 3, giving you probably at least another decade of use at our current major version release schedule. =)

_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: %-formatting depracation

Eric V. Smith
In reply to this post by Ethan Furman-2
On 02/22/2011 01:43 PM, Ethan Furman wrote:

> Greetings!
>
> According to these release notes in Python 3.0, %-formatting will be
> going away.
>
> http://docs.python.org/release/3.0.1/whatsnew/3.0.html#pep-3101-a-new-approach-to-string-formatting
>
>
>
> However, I was unable to find any further evidence of actual deprecation
> in 3.1 or 3.2... does anybody know the status of this?

The last thread on this I have a reference to was in September 2009. I
think was basically the outcome:
http://mail.python.org/pipermail/python-dev/2009-September/092399.html

So there will be no deprecation, just a gradual shift to PEP 3101
formatting.

Eric.
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: %-formatting depracation

Nick Coghlan
In reply to this post by Brett Cannon-2
On Wed, Feb 23, 2011 at 4:51 AM, Brett Cannon <[hidden email]> wrote:
> The very long term view is for %-formatting to go away, but that's as far as
> the thinking has gone. There are currently no plans to introduce any
> deprecation warning, and I highly doubt we will even remove the feature in
> Python 3, giving you probably at least another decade of use at our current
> major version release schedule. =)

This. Without a systematic way to detect and convert %-style to
{}-style formatting, enforcing the switch in the 3.x series just isn't
practical. Heck, we still haven't figured out how to convert a lot of
higher level APIs to the new scheme in a backwards compatible way
(that's why modules like logging still default to %-style, with
{}-style only available via options and wrapper objects).

Cheers,
Nick.

--
Nick Coghlan   |   [hidden email]   |   Brisbane, Australia
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: %-formatting depracation

Antoine Pitrou
On Wed, 23 Feb 2011 07:52:23 +1000
Nick Coghlan <[hidden email]> wrote:

> On Wed, Feb 23, 2011 at 4:51 AM, Brett Cannon <[hidden email]> wrote:
> > The very long term view is for %-formatting to go away, but that's as far as
> > the thinking has gone. There are currently no plans to introduce any
> > deprecation warning, and I highly doubt we will even remove the feature in
> > Python 3, giving you probably at least another decade of use at our current
> > major version release schedule. =)
>
> This. Without a systematic way to detect and convert %-style to
> {}-style formatting, enforcing the switch in the 3.x series just isn't
> practical. Heck, we still haven't figured out how to convert a lot of
> higher level APIs to the new scheme in a backwards compatible way
> (that's why modules like logging still default to %-style, with
> {}-style only available via options and wrapper objects).

I think there are many people still finding %-style more practical for
simple uses, so this might be a case of "practicality beats purity"
over "there should be one obvious way to do it".

Regards

Antoine.


_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: %-formatting depracation

"Martin v. Löwis"
In reply to this post by Brett Cannon-2
> The very long term view is for %-formatting to go away

Add to that that this view isn't universally shared among contributors.
Many of us would rather see % formatting stay indefinitely. I regularly
use it for new code.

Regards,
Martin
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: %-formatting depracation

Nick Coghlan
In reply to this post by Antoine Pitrou
On Wed, Feb 23, 2011 at 8:03 AM, Antoine Pitrou <[hidden email]> wrote:
> I think there are many people still finding %-style more practical for
> simple uses,

A lot of the sting went out of that objection when field autonumbering
was added to new-style formatting ("'%s' % (obj,)" vs
"'{}'.format(obj)" as the minimal case that correctly handles tuples).
The addition of format_map() reduces it even further.

> so this might be a case of "practicality beats purity"
> over "there should be one obvious way to do it".

I agree with that part though, just for historical reasons rather than
seeing much in the way in the way of inherent advantages with %-style
formatting.

Cheers,
Nick.

--
Nick Coghlan   |   [hidden email]   |   Brisbane, Australia
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: %-formatting depracation

Westley Martínez
In reply to this post by Antoine Pitrou
On Tue, 2011-02-22 at 23:03 +0100, Antoine Pitrou wrote:

> On Wed, 23 Feb 2011 07:52:23 +1000
> Nick Coghlan <[hidden email]> wrote:
>
> > On Wed, Feb 23, 2011 at 4:51 AM, Brett Cannon <[hidden email]> wrote:
> > > The very long term view is for %-formatting to go away, but that's as far as
> > > the thinking has gone. There are currently no plans to introduce any
> > > deprecation warning, and I highly doubt we will even remove the feature in
> > > Python 3, giving you probably at least another decade of use at our current
> > > major version release schedule. =)
> >
> > This. Without a systematic way to detect and convert %-style to
> > {}-style formatting, enforcing the switch in the 3.x series just isn't
> > practical. Heck, we still haven't figured out how to convert a lot of
> > higher level APIs to the new scheme in a backwards compatible way
> > (that's why modules like logging still default to %-style, with
> > {}-style only available via options and wrapper objects).
>
> I think there are many people still finding %-style more practical for
> simple uses, so this might be a case of "practicality beats purity"
> over "there should be one obvious way to do it".
>
> Regards
>
> Antoine.
>
>
> _______________________________________________
> Python-Dev mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/anikom15%40gmail.com

I tried to use the format method, but I found the syntax was getting on
my nerves and have since gone back to %-formatting. So I don't think
it's going away anytime soon.

_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: %-formatting depracation

Hrvoje Niksic-2
In reply to this post by Antoine Pitrou
On 02/22/2011 11:03 PM, Antoine Pitrou wrote:
> I think there are many people still finding %-style more practical for
> simple uses,

It's also a clash of cultures. People coming from a C/Unix background
typically find %-style format obvious and self-explanatory, while people
coming from Java/DotNET background feel the same way about {}-style formats.
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: %-formatting depracation

Xavier Morel-4
On 2011-02-23, at 12:30 , Hrvoje Niksic wrote:
> On 02/22/2011 11:03 PM, Antoine Pitrou wrote:
>> I think there are many people still finding %-style more practical for
>> simple uses,
>
> It's also a clash of cultures. People coming from a C/Unix background typically find %-style format obvious and self-explanatory, while people coming from Java/DotNET background feel the same way about {}-style formats.
For Java it's debatable: the Java 5 string formatting APIs are all printf-style (java.io.PrintStream#printf[0], String#format[1], java.util.Formatter[2]).

The older java.text.MessageFormat[3] (still used a lot for property lists as it's built for localization among other things) does use {}-style, though one quite different than Python's.

[0] http://download.oracle.com/javase/1.5.0/docs/api/java/io/PrintStream.html#printf(java.lang.String,%20java.lang.Object...)
[1] http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html#format(java.lang.String,%20java.lang.Object…)
[2] http://download.oracle.com/javase/1.5.0/docs/api/java/util/Formatter.html
[3] http://download.oracle.com/javase/1.5.0/docs/api/java/text/MessageFormat.html
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com