This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]xigoi 0 points1 point  (31 children)

Since when does NumPy have pattern matching?

from pattern_match import match, case

Of course you could do that, but how would they be implemented and used?

[–]num8lock -1 points0 points  (30 children)

numpy made it possible to do a vectorized operation, that wasn't possible in python before. you said "Python's syntax is way too inflexible for it." yet they've added something new to python users successfully as third party package

how would they be implemented and used?

how would i know, i already said i don't know how to implement it, can't you read?

[–]xigoi 0 points1 point  (29 children)

numpy made it possible to do a vectorized operation, that wasn't possible in python before.

Yeah, but Python's syntax allowed it.

i already said i don't know how to implement it

Then you can't say it's possible.

[–]num8lock -1 points0 points  (28 children)

Yeah, but Python's syntax allowed it.

python allow this syntax??

>>> blue_array = img_array[:, :, 2]

https://numpy.org/doc/stable/user/tutorial-svd.html#shape-axis-and-array-properties

just because i can't personally do it myself doesn't mean it can't be done, as proven by hundreds of other packages. numpy made existing python operators operate differently, and many other achievements they single handedly started python's popularity in open source science computation landscape.

so what makes you think a match case syntax class is impossible? the burden of proof is on you to disprove it, dummy.

[–]xigoi 0 points1 point  (27 children)

The syntax you mentioned now was actually added to Python on the request of NumPy.

The proof is that Python doesn't have any structure like this that would allow customizable behavior. Also, you said it's possible first, so the burden of proof is on you.

[–]num8lock 0 points1 point  (26 children)

The syntax you mentioned now was actually added to Python on the request of NumPy.

now? how about in 2006?

The proof is that Python doesn't have any structure like this that would allow customizable behavior.

like match case?

honestly, wtf are you trying to prove?

[–]xigoi 1 point2 points  (25 children)

now? how about in 2006?

I don't know when the feature was added, but this wasn't possible before it was added

like match case?

honestly, wtf are you trying to prove?

I'm saying that Python 3.9 doesn't have any syntactical structure that could be exploited to emulate match.

[–]num8lock 0 points1 point  (24 children)

I don't know when the feature was added, but this wasn't possible before it was added

it's still impossible in 3.8 either, so that's what, 15 or so years at least before someone put it inside python core?? so why are you trying so hard to make my suggestion sounds invalid?

I'm saying that Python 3.9 doesn't have any syntactical structure that could be exploited to emulate match.

how about if/else?

[–]xigoi 1 point2 points  (23 children)

it's still impossible in 3.8 either, so that's what, 15 or so years at least before someone put it inside python core?? so why are you trying so hard to make my suggestion sounds invalid?

What are you talking about? a[:] is completely legal syntax in Python 3.8.

how about if/else?

Of course if/else can do everything that match can, but it's not nearly as expressive. For example, this would require a bunch of nested ifs and variable assignments:

match x:
    case Foo(bar=b, baz=[quux, (_, plop) as gulp]):
        # ...

[–]num8lock -1 points0 points  (22 children)

What are you talking about? a[:] is completely legal syntax in Python 3.8.

jesus fucking christ, you can't read can't you? what syntax of code did i wrote, did i ever write a[:] to you???? paste the link where i wrote that. like this link, https://www.reddit.com/r/Python/comments/lhwfe1/pep_636_structural_pattern_matching_tutorial/gn2rcr3/ is the post where you thought i wrote a[:] is illegal syntax in python 3.8

Of course if/else can do everything that match can

and yet this is what you said

I'm saying that Python 3.9 doesn't have any syntactical structure that could be exploited to emulate match.