On Thu, Aug 13, 2020 at 09:33:46PM -0700, Guido van Rossum wrote:
> That's food for thought. I have to admit that I have forgotten almost
> everything about linear algebra that I was ever taught
In Australia, at least, secondary schools don't spend a lot of time
teaching matrices for linear alge
Many times I want a function parameter that is an iterable but not a
string. Usually I do:
try:
var.__iter__
except AttributeError:
# not an iterable
else:
try:
var.isascii
except AttributeError:
# put yuour code here
or
from collections.abc import Iterable
if
LaTeX for example uses the underscore for subscripts and the ^ for the
superscript. This is not acceptable, since Python (and almost all
languages) uses [] for subscript, and ^ in Python is the XOR logical
operator.
___
Python-ideas mailing list -- pytho
Excuse me, I sent this message from the wrong email address:
On Fri, 14 Aug 2020 at 09:24, Steven D'Aprano wrote:
> Tensors generalise matrices to an arbitrary number of
> dimensions, 3D and above.
>
> https://medium.com/@quantumsteinke/whats-the-difference-between-a-matrix-and-a-tensor-4505fbdc5
On Fri, Aug 14, 2020 at 6:46 PM Marco Sulla
wrote:
>
> Many times I want a function parameter that is an iterable but not a
> string.
> from collections.abc import Iterable
>
> if isinstance(var, Iterable) and not isinstance(var, str):
> # put yuour code here
>
Well, that line of code asks if
On Fri, Aug 14, 2020, 12:05 AM Stephen J. Turnbull <
turnbull.stephen...@u.tsukuba.ac.jp> wrote:
> I cannot speak to engineering uses of matrix computations. If someone
>
produces use cases that fit into the list of operations proposed
> (addition, negation, multiplication, inverse, transposition
I'd like to sound out consensus regarding mapping access, where none of the
keys are positional. In particular, I suggest that PEP 472 allow syntax and
semantics such as
>>> d[x=1, y=2] = 42
>>> d[x=1, y=2]
42
and ask whether the class
>>> X = type(d)
should be part of standard Pyth
On 14/08/20 10:03 pm, Jonathan Fine wrote:
NO POSITIONAL ARGUMENTS
I'd like
>>> d[x=1, y=2]
to be valid syntax. It's not clear to me that all agree with this.
If keywords are to be allowed, it seems reasonable to me
that this should be legal.
>>> d[x=1, y=2] = 42
>>> d[x=1, y=2
Hi Greg
Thank you, for your support for d[x=1, y=2] being valid syntax.
You ask if I have any use cases in mind for a general keyword key class
being part of standard Python. Good question.
Anyone who is experimenting with keyword keys would, I think, appreciate
having something they can use str
It seems very obvious to me that kwd args only should be valid, as Greg
Ewing said, if kwd args are added.
I'm less sure about no arguments, but perhaps.
On Fri, Aug 14, 2020, 8:11 AM Jonathan Fine wrote:
> Storing function call results would be a use case. For this, look at the
> implementatio
On Fri, 14 Aug 2020 at 13:12, Jonathan Fine wrote:
> Anyone who is experimenting with keyword keys would, I think, appreciate
> having something they can use straight away. Thus, I think, any use case for
> PEP 472 is also a use case for the general keyword class I'm suggesting. No
> use cases
In my role as an engineering professor and instructor, I find linear algebra to
be essential. To my knowledge, almost any book on engineering mathematics
contains a large section on linear algebra.
numpy is an extremely useful package, but is overwhelming for some novices
(e.g. dealing with the
Another class of folks who might find something like this useful
is those playing around with computer graphics using pygame,
pyglet, etc. where coordinate transformations are used a lot.
Bringing in numpy for that can seem like massive overkill
for a tiny game.
--
Greg
__
On 14/08/20 9:05 pm, Marco Sulla wrote:
Another big problem with tensors is the covariance and contravariance.
Usually in informatic you denote the covariance with the subscript
operator, that on paper is written as subscript. Contravariant index
on the contrary is a superscript. Not sure how a p
Guido van Rossum writes:
> That's food for thought.
Thank you. Let me confirm to the proponents that "food for thought"
is all I intended. I know a fair amount about statistics, and almost
as much about linear algebra, but nothing about physics or engineering.
> Certainly I trust [Steven D'A
Marco Sulla writes:
> Another big problem with tensors is the covariance and contravariance.
> Usually in informatic you denote the covariance with the subscript
> operator, that on paper is written as subscript. Contravariant index
> on the contrary is a superscript.
You're talking about the
Ricky Teachey writes:
> I'll try to speak to [what would engineers use a matrix library
> for] below.
I don't get it. Among other things, the object uwt_per_ft isn't
defined. I think it's a typo for the one-dimensional array
γ_per_foot, but not sure. I don't see any advantage to numpy or a
m
On Fri, Aug 14, 2020 at 1:32 PM Stephen J. Turnbull <
turnbull.stephen...@u.tsukuba.ac.jp> wrote:
> Ricky Teachey writes:
>
> > I'll try to speak to [what would engineers use a matrix library
> > for] below.
>
> I don't get it. Among other things, the object uwt_per_ft isn't
> defined. I think
My own personal use for this would be for generating anonymous protocols
and dataclasses:
class T(Protocol):
x: int
y: str
# with some abuse of notation obviously these would generate unique
typesassert T == Struct[x=int, y=str]
# similarly @dataclassclass S:
x: int
y: str
assert S =
On Fri, Aug 14, 2020, 7:39 PM Caleb Donovick
> class T(Protocol):
> x: int
> y: str
> # with some abuse of notation obviously these would generate unique
> typesassert T == Struct[x=int, y=str]
>
> I don't see what that can possible get you that `Struct(x=int, y=str)`
doesn't.
I'm +0 on
> I don't see what that can possible get you that `Struct(x=int, y=str)`
doesn't.
Using `Struct(x=int, y=str)` requires a metaclass, where `Struct[x=int,
y=str]` does not.
On Fri, Aug 14, 2020 at 4:45 PM David Mertz wrote:
> On Fri, Aug 14, 2020, 7:39 PM Caleb Donovick
>
>> class T(Protocol):
On Fri, Aug 14, 2020, 7:53 PM Caleb Donovick
wrote:
> > I don't see what that can possible get you that `Struct(x=int, y=str)`
> doesn't.
>
> Using `Struct(x=int, y=str)` requires a metaclass, where `Struct[x=int,
> y=str]` does not.
>
Why would it require a metaclass? Rather than just:
class S
On Fri, Aug 14, 2020, 7:45 PM David Mertz wrote:
> On Fri, Aug 14, 2020, 7:39 PM Caleb Donovick
>
>> class T(Protocol):
>> x: int
>> y: str
>> # with some abuse of notation obviously these would generate unique
>> typesassert T == Struct[x=int, y=str]
>>
>> I don't see what that can poss
On 15/08/20 5:31 am, Stephen J. Turnbull wrote:
It seems to me you could have a Tensor
class whose constructor takes a bool argument 'contravariant' (default
False), and then recommend that users adopt a naming convention to
distinguish covariant Tensors from contravariant Tensors.
You would ne
On Fri, Aug 14, 2020 at 10:43:31AM +0200, Marco Sulla wrote:
> Many times I want a function parameter that is an iterable but not a
> string. Usually I do:
>
> try:
> var.__iter__
> except AttributeError:
> # not an iterable
> else:
> try:
> var.isascii
> except AttributeEr
On Fri, Aug 14, 2020 at 08:45:44AM -0400, Ricky Teachey wrote:
> It seems very obvious to me that kwd args only should be valid, as Greg
> Ewing said, if kwd args are added.
Absolutely. We shouldn't even need to debate this. Would we consider a
language change that forced every single function t
On Fri, Aug 14, 2020 at 04:07:33PM -0700, Caleb Donovick wrote:
> My own personal use for this would be for generating anonymous protocols
> and dataclasses:
>
> class T(Protocol):
> x: int
> y: str
> # with some abuse of notation obviously these would generate unique
> typesassert T == St
On Fri, Aug 14, 2020 at 08:58:36PM -0400, Ricky Teachey wrote:
> One problem is type hint creation has been extended to built-ins in python
> 3.9, so that you do not have to import Dict, List, et al anymore.
>
> Without kwd args inside [ ], you would not be able to do this:
>
> Vector = dict[i=f
28 matches
Mail list logo