On 06/01/14 13:24, Victor Stinner wrote:
Hi,
bytes % args and bytes.format(args) are requested by Mercurial and
[snip]
I'm opposed to adding methods to bytes for this, as I think it goes
against the reason for the separation of str and bytes in the first place.
str objects are pieces of
On 06.01.2014 14:24, Victor Stinner wrote:
Hi,
bytes % args and bytes.format(args) are requested by Mercurial and
Twisted projects. The issue #3982 was stuck because nobody proposed a
complete definition of the new features. Here is a try as a PEP.
The PEP is a draft with open questions.
Hi,
2014/1/8 Mark Shannon m...@hotpy.org:
I'm opposed to adding methods to bytes for this, as I think it goes against
the reason for the separation of str and bytes in the first place.
Well, sometimes practicability beats purity. Many developers
complained that Python 3 is too string. The
Hi,
2014/1/8 M.-A. Lemburg m...@egenix.com:
I'd simply copy over the Python 2 PyString code and start working
from there.
It's not possible to reuse directly all Python 2 code because some
helpers have been modified to work on Unicode. The PEP 460 adds also
more work to other implementations
On Wed, Jan 8, 2014 at 9:12 PM, Victor Stinner victor.stin...@gmail.com wrote:
IMO some formatting commands must not be implemented. For example,
alignment is used to display something on screen, not in network
protocols or binary file formats.
Must not, or need not? I can understand that
On Wed, 08 Jan 2014 13:51:36 +0900
Stephen J. Turnbull step...@xemacs.org wrote:
Benjamin Peterson writes:
I agree. This is a very important, much-requested feature for low-level
networking code.
I hear it's much-requested, but is there any description of typical
use cases? The ones
On Wed, 8 Jan 2014 11:02:19 +0100
Victor Stinner victor.stin...@gmail.com wrote:
What does b'%s' % 7 do?
See Examples of the PEP:
b'a%sc%s' % (b'b', 4) gives b'abc4'
[...]
And then what? Use the default encoding? ASCII?
Bytes have no encoding. There are just bytes :-)
Therefore you
Hi Victor,
On Mon, 6 Jan 2014 14:24:50 +0100
Victor Stinner victor.stin...@gmail.com wrote:
Hi,
bytes % args and bytes.format(args) are requested by Mercurial and
Twisted projects. The issue #3982 was stuck because nobody proposed a
complete definition of the new features. Here is a try as
On Tue, Jan 7, 2014 at 10:36 AM, Stephen J. Turnbull step...@xemacs.org wrote:
Daniel Holth writes:
Isn't it true that if you have bytes 127 or surrogate escapes then
encoding to latin1 is no longer as fast as memcpy?
Be careful. As phrased, the question makes no sense. You don't have
[Top-post fixed (use-case is an exception to the GvR rule ;-) )
and some attributions restored with my additional comments
following for the ease of future readers.]
TL;DR: Outbound-connection attempts seem to be happening only to
me, therefore, most likely not a Python problem -- but some
On 9 January 2014 00:43, Bob Hanson d2mp...@newsguy.com wrote:
When I read this comment of yours, Guido, I immediately started
wondering about this. You may well be right -- indeed, I have a
very old install (c.2007) which has not been updated (other than
one or three new MS drivers).
On Jan 07, 2014, at 10:39 PM, Serhiy Storchaka wrote:
Only this option will solve all my issues.
How hard would it be to put together some sample branches that provide
concrete examples of the various options?
My own opinion could easily be influenced by having some hands-on time with
actual
On 01/08/2014 07:08 AM, Barry Warsaw wrote:
On Jan 07, 2014, at 10:39 PM, Serhiy Storchaka wrote:
Only this option will solve all my issues.
How hard would it be to put together some sample branches that provide
concrete examples of the various options?
My own opinion could easily be
On Tue, Jan 7, 2014 at 7:07 PM, Larry Hastings la...@hastings.org wrote:
On 01/07/2014 03:38 PM, Brett Cannon wrote:
On Tue, Jan 7, 2014 at 6:24 PM, Larry Hastings la...@hastings.org wrote:
For what it's worth, if we use the accumulator approach I propose
that the generated code doesn't
On 01/08/2014 07:33 AM, Brett Cannon wrote:
So let's make this idea concrete to focus a possible discussion. Using
the example from the Clinic HOWTO and converting to how I see it working:
[...]
Yep. And what I was proposing is much the same, except there are a
couple extra lines in the
On Wed, Jan 8, 2014 at 10:46 AM, Larry Hastings la...@hastings.org wrote:
On 01/08/2014 07:33 AM, Brett Cannon wrote:
So let's make this idea concrete to focus a possible discussion. Using the
example from the Clinic HOWTO and converting to how I see it working:
[...]
Yep. And what I
On 01/08/2014 08:04 AM, Brett Cannon wrote:
On Wed, Jan 8, 2014 at 10:46 AM, Larry Hastings la...@hastings.org
mailto:la...@hastings.org wrote:
Yep. And what I was proposing is much the same, except there are
a couple extra lines in the generated code section. I'd keep
the
On 01/08/2014 02:28 AM, Antoine Pitrou wrote:
On Wed, 8 Jan 2014 11:02:19 +0100
Victor Stinner victor.stin...@gmail.com wrote:
What does b'%s' % 7 do?
See Examples of the PEP:
b'a%sc%s' % (b'b', 4) gives b'abc4'
[...]
And then what? Use the default encoding? ASCII?
Bytes have no
2014/1/8 Ethan Furman et...@stoneleaf.us:
Therefore you shouldn't accept integers. It does not make sense to
format 4 as b'4'.
Agreed. I would have that it would result in b'\x04'.
The PEP proposes b'%c' % 4 = b'\x04.
Antoine gave me a good argument against supporting b'%s' % int: how
would
Victor Stinner, 07.01.2014 19:14:
2014/1/7 Stefan Behnel:
Victor Stinner, 06.01.2014 14:24:
``struct.pack()`` is incomplete. For example, a number cannot be
formatted as decimal and it does not support padding bytes string.
Then what about extending the struct module in a way that makes it
On Wed, Jan 8, 2014 at 3:40 AM, M.-A. Lemburg m...@egenix.com wrote:
PS: The PEP mentions having to code for Python 3.0-3.4 as well,
which would don't support the new methods. I think it's perfectly
fine to have newly ported code to require Python 2.7/3.5+. After
all, the porting effort will
On Wed, 8 Jan 2014 11:16:49 -0700
Eric Snow ericsnowcurren...@gmail.com wrote:
It boils down to 3.5 being *the* target for porting from 2.7.
No. Please let's stop being self-deprecating. 3.3 is fine as a porting
target, as the many high-profile libraries which have already been
ported can
On Mon, Jan 6, 2014 at 6:24 AM, Victor Stinner victor.stin...@gmail.com wrote:
Abstract
Add ``bytes % args`` operator and ``bytes.format(args)`` method to
Python 3.5.
Rationale
=
``bytes % args`` and ``bytes.format(args)`` have been removed in Python
2. This operator
On Wed, 8 Jan 2014 11:59:51 -0700
Eric Snow ericsnowcurren...@gmail.com wrote:
As others have opined,
formatting a bytes object is out of place.
However, interpolating a bytes object isn't out of place, and it is
what a minimal formatting primitive could do.
Regards
Antoine.
Victor Stinner, 06.01.2014 14:24:
Abstract
Add ``bytes % args`` operator and ``bytes.format(args)`` method to
Python 3.5.
Here is a counterproposal. Let someone who needs this feature write a
library that does byte string formatting. That properly handles it, a full
featured tool
On Wed, Jan 08, 2014 at 07:12:06PM +0100, Stefan Behnel wrote:
Why can't someone write a third-party library that does what these projects
need, and that works in both Py2 and Py3, so that these projects can be
modified to use that library and thus get on with their porting to Py3?
Apologies
Hi,
Another remark about the PEP: it should define bytearray % args and
bytearray.format(args) as well.
Regards
Antoine.
On Mon, 6 Jan 2014 14:24:50 +0100
Victor Stinner victor.stin...@gmail.com wrote:
Hi,
bytes % args and bytes.format(args) are requested by Mercurial and
Twisted
On Wed, 08 Jan 2014 19:22:08 +, Matt Billenstein m...@vazor.com wrote:
I started in Python blissfully unaware of unicode - it was a different time
for
sure, but what I knew from C worked pretty much the same in Python - I could
read some binary data out of a file, twiddle some bits, and
Hi,
With Victor's consent, I overhauled PEP 460 and made the feature set
more restricted and consistent with the bytes/str separation. However, I
also added bytearray into the mix, as bytearray objects should
generally support the same operations as bytes (and they can be useful
*especially* for
Believe it or not, sometimes you really don't care about encodings.
Sometimes you just want to parse text files. Python 3 forces you to think
about abstract concepts like encodings when all you want is to open that .txt
file on the drive and extract some phone numbers and merge in some email
On 8 January 2014 20:04, Kristján Valur Jónsson krist...@ccpgames.com wrote:
Believe it or not, sometimes you really don't care about encodings.
Sometimes you just want to parse text files. Python 3 forces you to think
about abstract concepts like encodings when all you want is to open that
Hi,
Python 3 forces you to think about abstract concepts like encodings when all
you want is to open that .txt file on the drive and extract some phone
numbers and merge in some email addresses.
You can open a text file using ascii + surrogateescape, or just open
the file in binary.
On Wed, 08 Jan 2014 22:04:56 +, krist...@ccpgames.com wrote:
Believe it or not, sometimes you really don't care about encodings.
Sometimes you just want to parse text files. Python 3 forces you to
think about abstract concepts like encodings when all you want is to
open that .txt file on
Kristján Valur Jónsson krist...@ccpgames.com writes:
Believe it or not, sometimes you really don't care about encodings.
Sometimes you just want to parse text files.
Files don't contain text, they contain bytes. Bytes only become text
when filtered through the correct encoding.
Python should
On 2014-01-09 00:07, Ben Finney wrote:
Kristján Valur Jónsson krist...@ccpgames.com writes:
Believe it or not, sometimes you really don't care about encodings.
Sometimes you just want to parse text files.
Files don't contain text, they contain bytes. Bytes only become text
when filtered
On Wed, 8 Jan 2014, Kristján Valur Jónsson wrote:
Believe it or not, sometimes you really don't care about encodings.
Sometimes you just want to parse text files. Python 3 forces you to
think about abstract concepts like encodings when all you want is to
open that .txt file on the drive
On 09/01/2014 00:21, MRAB wrote:
I need a new battery.
What kind of battery?
I don't care!
A neat summary of the draft requirements specification for Python 2.8.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Still playing the devil's advocate:
I didn't used to must. Why must I must now? Did the universe just shift when
I fired up python3?
Things were demonstatably working just fine before without doing so.
K
From: Python-Dev
MRAB pyt...@mrabarnett.plus.com writes:
On 2014-01-09 00:07, Ben Finney wrote:
Kristján Valur Jónsson krist...@ccpgames.com writes:
Python 3 forces you to think about abstract concepts like encodings
when all you want is to open that .txt file on the drive and
extract some phone numbers
Just to avoid confusion, let me state up front that I am very well aware of
encodings and all that, having internationalized one largish app in python 2.x.
I know the problems that 2.x had with tracking down the source of errors and
understand the beautiful concept of encodings on the
Kristján Valur Jónsson krist...@ccpgames.com writes:
I didn't used to must. Why must I must now? Did the universe just
shift when I fired up python3?
In a sense, yes. The world of software has been shifting for decades, as
a reasult of broader changes in how different segments of humanity
On 09/01/2014 00:12, Kristján Valur Jónsson wrote:
Just to avoid confusion, let me state up front that I am very well aware of
encodings and all that, having internationalized one largish app in python 2.x.
I know the problems that 2.x had with tracking down the source of errors and
On Thu, 09 Jan 2014 00:12:57 +, krist...@ccpgames.com wrote:
I think there might be a different analogy: Having to specify an
encoding is like having strong typing. In Python 2.7, we _can_ forego
that and just duck-type our strings :)
Python is a strongly typed language.
Saying that
On 1/8/2014 5:04 PM, Kristján Valur Jónsson wrote:
Believe it or not, sometimes you really don't care about encodings.
Sometimes you just want to parse text files. Python 3 forces you to
think about abstract concepts like encodings when all you want is to
open that .txt file on the drive and
On Thu, Jan 9, 2014 at 11:21 AM, MRAB pyt...@mrabarnett.plus.com wrote:
On the other hand:
I need a new battery.
What kind of battery?
I don't care!
Or, bringing it back to Python: How do you write a set out to a file?
foo = {1, 2, 4, 8, 16, 32}
open(foo.txt,w).write(foo) #
And I think everyone was well intentioned - and python3 covers most of the
bases, but working with binary data is not only a wire-protocol
programmer's
problem. Needing a library to wrap bytesthing.format('ascii',
'surrogateescape')
or some such thing makes python3 less approachable for
On 2014-01-06 13:24, Victor Stinner wrote:
Hi,
bytes % args and bytes.format(args) are requested by Mercurial and
Twisted projects. The issue #3982 was stuck because nobody proposed a
complete definition of the new features. Here is a try as a PEP.
The PEP is a draft with open questions.
On Wed, Jan 8, 2014 at 2:04 PM, Kristján Valur Jónsson
krist...@ccpgames.com wrote:
Believe it or not, sometimes you really don't care about encodings.
Sometimes you just want to parse text files. Python 3 forces you to think
about abstract concepts like encodings when all you want is to
Antoine Pitrou writes:
However, interpolating a bytes object isn't out of place, and it is
what a minimal formatting primitive could do.
Something like this?
# VERY incomplete pseudo-code
class str:
# new method
# fmtstring has syntax of .format method's spec, maybe
Kristján Valur Jónsson wrote:
all you want is to open that .txt
file on the drive and extract some phone numbers and merge in some email
addresses. What encoding does the file have? Do I care? Must I care?
To some extent, yes. If the encoding happens to be an
ascii-compatible one, such as
Kristján Valur Jónsson writes:
Still playing the devil's advocate:
I didn't used to must. Why must I must now? Did the universe just
shift when I fired up python3?
No. Go look at the Economist's tag cloud and notice how big China
and India are most days. The universe has been shifting
Ben Finney writes:
That's a much better analogy. The customer may not care, but the
question is essential and must be answered; if the supplier guesses what
the customer wants, they are doing the customer a disservice.
It is a much better analogy for me on my desktop, and for programmers
On Thu, Jan 9, 2014 at 1:07 AM, Ben Finney ben+pyt...@benfinney.id.au wrote:
Kristján Valur Jónsson krist...@ccpgames.com writes:
Believe it or not, sometimes you really don't care about encodings.
Sometimes you just want to parse text files.
Files don't contain text, they contain bytes.
On 09/01/2014 06:50, Lennart Regebro wrote:
On Thu, Jan 9, 2014 at 1:07 AM, Ben Finney ben+pyt...@benfinney.id.au wrote:
Kristján Valur Jónsson krist...@ccpgames.com writes:
Believe it or not, sometimes you really don't care about encodings.
Sometimes you just want to parse text files.
On 9 January 2014 10:07, Ben Finney ben+pyt...@benfinney.id.au wrote:
Kristján Valur Jónsson krist...@ccpgames.com writes:
Believe it or not, sometimes you really don't care about encodings.
Sometimes you just want to parse text files.
Files don't contain text, they contain bytes. Bytes only
On 9 January 2014 10:22, Kristján Valur Jónsson krist...@ccpgames.com wrote:
Still playing the devil's advocate:
I didn't used to must. Why must I must now? Did the universe just shift
when I fired up python3?
Things were demonstatably working just fine before without doing so.
They were
Nick Coghlan ncogh...@gmail.com writes:
On 9 January 2014 10:07, Ben Finney ben+pyt...@benfinney.id.au wrote:
Kristján Valur Jónsson krist...@ccpgames.com writes:
Believe it or not, sometimes you really don't care about encodings.
Sometimes you just want to parse text files.
Files
On 9 January 2014 15:22, Greg Ewing greg.ew...@canterbury.ac.nz wrote:
Kristján Valur Jónsson wrote:
all you want is to open that .txt
file on the drive and extract some phone numbers and merge in some email
addresses. What encoding does the file have? Do I care? Must I care?
To some
58 matches
Mail list logo