On 14/11/2022 12.12, DFS wrote:
On 11/13/2022 5:20 PM, Jon Ribbens wrote:
On 2022-11-13, DFS wrote:
In code, list.clear is just ignored.
At the terminal, list.clear shows
in code:
x = [1,2,3]
x.clear
print(len(x))
3
at terminal:
x = [1,2,3]
x.clear
print(len(x))
3
Caused me an hour of f
On Mon, 14 Nov 2022 at 18:00, Greg Ewing wrote:
>
> On 14/11/22 3:13 pm, MRAB wrote:
> > But if it's an expression where it's expecting a statement and it's not
> > a call, then it's probably a bug.
>
> The key word there is "probably". If there's any chance it
> could be not a bug, it can't be an
On 14/11/22 3:13 pm, MRAB wrote:
But if it's an expression where it's expecting a statement and it's not
a call, then it's probably a bug.
The key word there is "probably". If there's any chance it
could be not a bug, it can't be an error. At most it should
be a warning, and that's what linters
Python doesn't care what an expression returns.
You've written an expression that returns the value of the 'clear' function
that is bound to that particular list.
The interpreter doesn't know or care if accessing that 'clear' attribute on
the class returns a function or for some reason triggers a
On 11/13/2022 9:11 PM, Chris Angelico wrote:
On Mon, 14 Nov 2022 at 11:53, DFS wrote:
On 11/13/2022 5:20 PM, Jon Ribbens wrote:
On 2022-11-13, DFS wrote:
In code, list.clear is just ignored.
At the terminal, list.clear shows
in code:
x = [1,2,3]
x.clear
print(len(x))
3
at terminal:
x =
On 2022-11-14, Greg Ewing wrote:
> On 14/11/22 1:31 pm, Jon Ribbens wrote:
>> On 2022-11-13, DFS wrote:
>>> But why is it allowed in the first place?
>>
>> Because it's an expression, and you're allowed to execute expressions.
>
> To put it a bit more clearly, you're allowed to evaluate
> an exp
On Mon, 14 Nov 2022 at 13:18, MRAB wrote:
>
> On 2022-11-14 00:55, Greg Ewing wrote:
> > On 14/11/22 1:31 pm, Jon Ribbens wrote:
> >> On 2022-11-13, DFS wrote:
> >>> But why is it allowed in the first place?
> >>
> >> Because it's an expression, and you're allowed to execute expressions.
> >
> >
On 2022-11-14 00:55, Greg Ewing wrote:
On 14/11/22 1:31 pm, Jon Ribbens wrote:
On 2022-11-13, DFS wrote:
But why is it allowed in the first place?
Because it's an expression, and you're allowed to execute expressions.
To put it a bit more clearly, you're allowed to evaluate
an expression a
On Mon, 14 Nov 2022 at 11:53, DFS wrote:
>
> On 11/13/2022 5:20 PM, Jon Ribbens wrote:
> > On 2022-11-13, DFS wrote:
> >> In code, list.clear is just ignored.
> >> At the terminal, list.clear shows
> >>
> >>
> >>
> >> in code:
> >> x = [1,2,3]
> >> x.clear
> >> print(len(x))
> >> 3
> >>
> >> at
On 14/11/22 1:31 pm, Jon Ribbens wrote:
On 2022-11-13, DFS wrote:
But why is it allowed in the first place?
Because it's an expression, and you're allowed to execute expressions.
To put it a bit more clearly, you're allowed to evaluate
an expression and ignore the result.
--
Greg
--
https
On 2022-11-13, DFS wrote:
> On 11/13/2022 5:20 PM, Jon Ribbens wrote:
>> On 2022-11-13, DFS wrote:
>>> In code, list.clear is just ignored.
>>> At the terminal, list.clear shows
>>>
>>>
>>>
>>> in code:
>>> x = [1,2,3]
>>> x.clear
>>> print(len(x))
>>> 3
>>>
>>> at terminal:
>>> x = [1,2,3]
>>>
On 11/13/2022 5:20 PM, Jon Ribbens wrote:
On 2022-11-13, DFS wrote:
In code, list.clear is just ignored.
At the terminal, list.clear shows
in code:
x = [1,2,3]
x.clear
print(len(x))
3
at terminal:
x = [1,2,3]
x.clear
print(len(x))
3
Caused me an hour of frustration before I noticed list.
On 2022-11-13, DFS wrote:
> In code, list.clear is just ignored.
> At the terminal, list.clear shows
>
>
>
> in code:
> x = [1,2,3]
> x.clear
> print(len(x))
> 3
>
> at terminal:
> x = [1,2,3]
> x.clear
>
> print(len(x))
> 3
>
>
> Caused me an hour of frustration before I noticed list.clear() was
In code, list.clear is just ignored.
At the terminal, list.clear shows
in code:
x = [1,2,3]
x.clear
print(len(x))
3
at terminal:
x = [1,2,3]
x.clear
print(len(x))
3
Caused me an hour of frustration before I noticed list.clear() was what
I needed.
x = [1,2,3]
x.clear()
print(len(x))
0
--
On 11/13/22, Jessica Smith <12jessicasmit...@gmail.com> wrote:
> Consider the following code ran in Powershell or cmd.exe:
>
> $ python -c "print('└')"
> └
>
> $ python -c "print('└')" > test_file.txt
> Traceback (most recent call last):
> File "", line 1, in
> File "C:\Program Files\Python38\
On 11/13/2022 7:37 AM, Pancho wrote:
On 11/11/2022 19:56, DFS wrote:
Edit: found a solution online:
-
x = [(11,1,1),(1,41,2),(9,3,12)]
maxvals = [0]*len(x[0])
for e in x:
maxvals = [max(w,int(c)) for w,c in zip(maxvals,e)]
pri
On 11/11/2022 19:56, DFS wrote:
Edit: found a solution online:
-
x = [(11,1,1),(1,41,2),(9,3,12)]
maxvals = [0]*len(x[0])
for e in x:
maxvals = [max(w,int(c)) for w,c in zip(maxvals,e)]
print(maxvals)
[11,41,12]
---
On Fri, Nov 11, 2022 at 8:16 PM Eryk Sun wrote:
> If sys.std* are console files, then in Python 3.6+, sys.std*.buffer.raw will
> be _io._WindowsConsoleIO
> io.TextIOWrapper uses locale.getpreferredencoding(False) as the default
> encoding
Thank you for your replies - checking the sys.stdout.buf
On 11/13/2022 9:49 AM, Jessica Smith wrote:
Consider the following code ran in Powershell or cmd.exe:
$ python -c "print('└')"
└
$ python -c "print('└')" > test_file.txt
Traceback (most recent call last):
File "", line 1, in
File "C:\Program Files\Python38\lib\encodings\cp1252.py", line
> On 13 Nov 2022, at 14:52, Jessica Smith <12jessicasmit...@gmail.com> wrote:
>
> Consider the following code ran in Powershell or cmd.exe:
>
> $ python -c "print('└')"
> └
>
> $ python -c "print('└')" > test_file.txt
> Traceback (most recent call last):
> File "", line 1, in
> File "C:\Pr
Consider the following code ran in Powershell or cmd.exe:
$ python -c "print('└')"
└
$ python -c "print('└')" > test_file.txt
Traceback (most recent call last):
File "", line 1, in
File "C:\Program Files\Python38\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(i
On 11/11/2022 16:21, Ian Pilcher wrote:
Is it possible to access the name of a superclass static method, when
defining a subclass attribute, without specifically naming the super-
class?
Contrived example:
class SuperClass(object):
@staticmethod
def foo():
pass
class
22 matches
Mail list logo