On Thu, Mar 3, 2022 at 9:58 AM Kevin Mills wrote:
> I actually initially was going to suggest a `strict` flag get added, but I
> figured that would be impractical. I was mostly concerned about classes
> that mimic file objects, because (obviously) their read methods wouldn't
> include a `strict`
+0.1?
> The code I'm currently working on involves parsing binary data. If I
> ask for, say, 4 bytes, it's because I actually need 4 bytes and if the
> file doesn't have 4 bytes for me, it's malformed. Because `f.read(4)`
> can silently return less than 4 bytes and I don't want to have to
>
I actually initially was going to suggest a `strict` flag get added, but I
figured that would be impractical. I was mostly concerned about classes that
mimic file objects, because (obviously) their read methods wouldn't include a
`strict` flag and you couldn't pass such objects to functions
On Fri, 4 Mar 2022 at 02:48, Steven D'Aprano wrote:
>
> On Thu, Mar 03, 2022 at 10:30:32PM +1100, Chris Angelico wrote:
> > On Thu, 3 Mar 2022 at 21:14, Steven D'Aprano wrote:
> > > What did I say that made you think I denied the existence of filtered
> > > iteration? Was it the post where I
Rather than a new function, maybe a flag?
read(n, strict=True)
(Not sure if a block flag would also be useful, but maybe)
-CHB
--
Christopher Barker, PhD (Chris)
Python Language Consulting
- Teaching
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython,
On Thu, Mar 03, 2022 at 10:30:32PM +1100, Chris Angelico wrote:
> On Thu, 3 Mar 2022 at 21:14, Steven D'Aprano wrote:
> > What did I say that made you think I denied the existence of filtered
> > iteration? Was it the post where I pointed out we've been able to do
> > filtered iteration going
What I said:
"Python, for good or ill, is an opinionated language regarding
indentation and statements."
And then Greg refuted something I never said:
> So if Python is opinionated about line lengths, it's rather
> selectively opinionated.
The Python language isn't opinionated about line
On Thu, 3 Mar 2022 at 20:28, Steven D'Aprano wrote:
>
> On Thu, Mar 03, 2022 at 08:27:50AM -, Kevin Mills wrote:
>
> > The code I'm currently working on involves parsing binary data. If I
> > ask for, say, 4 bytes, it's because I actually need 4 bytes and if the
> > file doesn't have 4 bytes
On Thu, 3 Mar 2022 at 21:14, Steven D'Aprano wrote:
> What did I say that made you think I denied the existence of filtered
> iteration? Was it the post where I pointed out we've been able to do
> filtered iteration going back to Python 1.x days?
ANYTHING can be done by composing concepts. We
On 3/03/22 9:50 pm, Steven D'Aprano wrote:
While you can put the block on the same line as the colon using
semicolons:
if condition: print(1); print(2) # Legal.
and there's nothing to stop you from making arbitrarily long
lines using this feature...
if condition: print(1);
On Thu, Mar 03, 2022 at 08:04:57PM +1100, Chris Angelico wrote:
> Python has a history of making conceptual actions shorter than the
> mere combination of their parts. For instance, we don't have this
> construct:
>
> for i in range(len(stuff)) using thing = stuff[i]:
Rather than inventing new
On Thu, Mar 03, 2022 at 08:27:50AM -, Kevin Mills wrote:
> The code I'm currently working on involves parsing binary data. If I
> ask for, say, 4 bytes, it's because I actually need 4 bytes and if the
> file doesn't have 4 bytes for me, it's malformed. Because `f.read(4)`
> can silently
On Thu, 3 Mar 2022 at 19:54, Steven D'Aprano wrote:
>
> On Thu, Mar 03, 2022 at 02:32:25AM +, Rob Cliffe via Python-ideas wrote:
>
> > But the proposal would give people the choice of
> > Saving a level of indentation at the cost of having two
> > suite-introductions on the same line.
> >
On Thu, Mar 03, 2022 at 02:32:25AM +, Rob Cliffe via Python-ideas wrote:
> But the proposal would give people the choice of
> Saving a level of indentation at the cost of having two
> suite-introductions on the same line.
> Keeping the two suit-introductions on separate lines (as
The code I'm currently working on involves parsing binary data. If I ask for,
say, 4 bytes, it's because I actually need 4 bytes and if the file doesn't have
4 bytes for me, it's malformed. Because `f.read(4)` can silently return less
than 4 bytes and I don't want to have to explicitly double
15 matches
Mail list logo