David Mertz wrote:
> On Mon, Nov 23, 2020 at 9:02 PM Brian Coleman brianfcole...@gmail.com
> wrote:
> > Basically, I
> > agree matching/destructuring is a powerful idea. But I also
> > wonder how much genuinely better it is than a library that does not
> > requi
David Mertz wrote:
> On Mon, Nov 23, 2020 at 9:02 PM Brian Coleman brianfcole...@gmail.com
> wrote:
> > Basically, I
> > agree matching/destructuring is a powerful idea. But I also
> > wonder how much genuinely better it is than a library that does not
> > requi
David Mertz wrote:
> I have a little bit of skepticism about the pattern matching syntax, for
> similar reasons to those Larry expresses, and that Steve Dower mentioned on
> Discourse.
> Basically, I agree matching/destructuring is a powerful idea. But I also
> wonder how much genuinely better it
Antoine Pitrou wrote:
> On Mon, 23 Nov 2020 16:15:12 -
> "Brian Coleman" brianfcole...@gmail.com
> wrote:
> > Furthermore, Python has a regular expression module
> > which implements it's own DSL for the purpose of matching string patterns.
> > Re
Larry Hastings wrote:
> On 11/23/20 8:15 AM, Brian Coleman wrote:
> > def process(root_node: Node):
> > def process_node(node: Node):
> > if isinstance(node, StringNode):
> > return node.value
> > elif isinstance(node, NumberNod
Take as an example a function designed to process a tree of nodes similar to
that which might be output by a JSON parser. There are 4 types of node:
- A node representing JSON strings
- A node representing JSON numbers
- A node representing JSON arrays
- A node representing JSON dictionaries
The
Greg Ewing wrote:
> On 23/11/20 7:49 am, Daniel Moisset wrote:
> > Look at the following (non-pattern-matching)
> > snippet:
> > event = datetime.date(x, month=y, day=z)
> >
> > The only names that are treated as lvalues there are to the left
> of an '='. The rules are a lot simpler.
> One of the
Regarding the difficulty which some people have respecting class patterns and
dictionary patterns, I would like to draw attention to a similar feature in
JavaScript, object destructuring. JavaScript does not have pattern matching but
object destructuring is closely related. Take the example of a