A few days ago, Terry J. Reedy created the issue about the formatter module.
(https://bugs.python.org/issue42299)
The issue is mainly about testing code but also discussing the removal of
the module.
I noticed that the formatter module was deprecated in 3.4 and it was
originally scheduled to be re
On 11/23/2020 4:49 PM, David Mertz wrote:
On Mon, Nov 23, 2020, 4:32 PM Eric V. Smith
I just commented on Steve's post over on Discourse. The problem
with this is that the called function (m.case, here) needs to have
access to the caller's namespace in order to resolve the
expre
On 11/23/2020 3:44 PM, 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
On 11/23/2020 5:44 PM, David Mertz wrote:
I'd put the question this way: assuming Matcher can be written
(with a bit of stack magic), and assuming that the strings inside
m.case() calls are exactly the same mini-languague PEP 634
proposes, would you want a syntax change?
N
>
> I'd put the question this way: assuming Matcher can be written (with a bit
> of stack magic), and assuming that the strings inside m.case() calls are
> exactly the same mini-languague PEP 634 proposes, would you want a syntax
> change?
>
> No, I wouldn't!
>
Is one of us mixing up negations? Are
On 24/11/20 9:44 am, David Mertz wrote:
m = Matcher(arbitrary_expression)
if m.case("StringNode(s)"):
process_string(m.val)
elif m.case("[a, 5, 6, b]"):
process_two_free_vars(*m.values)
elif m.case("PairNone(a, b)"):
a, b = m.values
process_pair(a, b)
elif m.case("DictNode"):
On 24/11/20 9:31 am, Brian Coleman wrote:
In my opinion, the object oriented solution to this problem is to use the
visitor pattern.
Which is a good thing only if you believe that OO solutions are
always better than non-OO ones.
IMO, the visitor pattern is a workaround for when your language
On 11/23/20 1:49 PM, David Mertz wrote:
On Mon, Nov 23, 2020, 4:32 PM Eric V. Smith
I just commented on Steve's post over on Discourse. The problem with this is
that the called function (m.case, here)
needs to have access to the caller's namespace in order to resolve the
expressions, such as
On Mon, Nov 23, 2020 at 08:44:21PM +, David Mertz 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 require
> a language change. For example, I could create a library to allow this:
>
> m =
On Mon, Nov 23, 2020, 4:32 PM Eric V. Smith
> I just commented on Steve's post over on Discourse. The problem with this
> is that the called function (m.case, here) needs to have access to the
> caller's namespace in order to resolve the expressions, such as StringNode
> and PairNone. This is one
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
> > require
> > a language change. For examp
On Mon, Nov 23, 2020 at 9:02 PM Brian Coleman
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
> require
> > a language change. For example, I could create a library to allow this:
>
>
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
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 is than a library that does
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.
> > Regular
> > expressions, in a similar way to patt
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, NumberNode):
> > return float(n
On 11/23/20 12:05 PM, Chris Angelico wrote:
On Tue, Nov 24, 2020 at 7:00 AM Ethan Furman wrote:
On 11/23/20 11:06 AM, 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,
On Mon, Nov 23, 2020, 2:58 PM Ethan Furman
> >> if isinstance(node, StringNode):
> >> return node.value
> >> elif isinstance(node, NumberNode):
> >> return float(node.value)
> >> elif isinstance(node, ListNode):
> >> return [p
On Tue, Nov 24, 2020 at 7:00 AM Ethan Furman wrote:
>
> On 11/23/20 11:06 AM, 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
On 11/23/20 11:06 AM, 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, NumberNode):
>>
On Mon, 23 Nov 2020 16:15:12 -
"Brian Coleman" wrote:
>
> Furthermore, Python has a regular expression module which implements it's own
> DSL for the purpose of matching string patterns. Regular expressions, in a
> similar way to pattern matching,
> allow string patterns to be expressed i
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, NumberNode):
return float(node.value)
elif isinstance(node, Lis
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
Hi,
Le 23/11/2020 à 01:41, Greg Ewing a écrit :
> 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 '='. […]
This is a
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
25 matches
Mail list logo