This reads like sales speak. My experience is the opposite. Some people take to concepts like a duck to water, some people are dopey and forget things you told them an hour ago, some people (most people) want you to hold their hand every step of the way and will actively try to avoid figuring things out independently.
I want to say it's enthusiasm that matters, but a lazy smart person takes less time to train than an enthusiastic moron, in my experience.
If you're paid to train people it's healthy to take responsibility for that but IMO it's not realistic or true. Training someone with poor aptitude is like swimming through tar. It's palpably different.
I am not a sales person. I have been training people as a volunteer for decades. I have never made a dime (in fact, I am usually out-of-pocket by a fair amount). I am not a professional trainer or orator (or even a particularly good one), but I am an experienced one.
The people I have trained have faced enormous challenges in life, and are trying to get back up, after having been knocked down. I have not had the luxury of an eager, high-functioning audience. In fact, the audience has sometimes been actively hostile, and my training has not been effective (more often than I’d like).
Their enthusiasm is often unlike anything many folks will ever encounter; born of desperation, but so are the challenges. Many are folks with “knee-jerk” reactions to authority figures, which means I have needed to approach them carefully, and my personal demeanor and attitude could have a huge impact on my effectiveness.
The stakes have often been quite high (life and death). It’s been important for me to ensure that people get the help; not that I feel proud.
I simply wrote about my personal experience. This was not a typical “Internet armchair expert” post. Please note that I made a point of stating this was my experience.
"Good judgment comes from experience. Experience comes from bad judgment." –Attributed to Nasrudin, but made famous by Will Rogers.
I understand that your experience is different. I appreciate and honor that. I only ask that you provide me the same courtesy.
Please have some compassion. The world needs as much of that as possible, and I feel that social media has been highly corrosive to empathy.
Hey, thanks for whatever you're trying to do out there. I grew up among a bunch of kids with pretty poor prospects, and we all started building invisible barbed wire fences around ourselves from an early age. It takes guts to try to do any improve-the-world work pro bono, and even more so when you're working with people who don't shower you with praise for it.
I'm sure that even when you seemed to get nowhere or worse, occasionally some of those expressionless faces across from you squirreled something important away that helped them later on. Make sure you get the rest you need so you don't burn out too quick.
Thanks. I’m not exactly tilting at windmills. I’m part of a much larger organization.
I’m also tough as nails. I’ve been doing this for nearly 40 years.
I have, in the aggregate, made significant inroads, but there’s plenty more needs doing, and one of my more important capabilities, is the ability to step aside, and let the next generation take the reins.
I am now actually looking at doing training of software developers. It’s a different venue, but I also have a great deal of experience in that arena.
In my experience pushy parenting works. Kids tend to come out of it kinda awkward but broadly academically successful and morally upstanding. No way in hell I'd do that to my kid, but it's not a strategy doomed to failure.
I think mythology is an important metaphorical tool, but I'm inclined to agree with you. Disney movies are engineered to sell, usually by indulging kids' fantasies. One of the big numbers in The Little Mermaid is literally, "I have so many toys, and now I'm in love." It's kid-crack. Kids like candy.
I like Mulan though, and The Lion King. I think those are some very cool movies with very good life lessons.
Mulan is great! The Lion King though, The evil dark skinned lion and his dark skinned underlings with immigrant accents take over and the world goes to shit. Only the light colored royal lineage can be in charge if you want a nice world.
Ehh, that reads like shoehorning in a political agenda to me. The hyenas aren't dangerous because they're foreign, they're foreign because they're dangerous. Their actions make them a threat - they're sneaky, mean and evil. That's why the lions don't accept them.
Timone is also foreign.
But like, if you want a parable they already gave you one: they aren't immigrants, they're Nazis.
They’re only dangerous because they’re excluded from the kingdom and are given little chance to survive. The entire narrative of Scar having control over them is based on him providing them with food, because their lands contain none. In the scene where they’re introduced, Scar brings them meat and his entire promise to them is “stick with me and you’ll never go hungry again”
Scar is evil and seeking power, but the hyenas are only following him because they’re looking for a better life, because what they have at the start is meagre.
At the end, when they turn on Scar, the threat seems to end, so it seems that only Scar has an agenda and the hyenas just want to live their lives. With Scar remover, the lands return to normal despite the hyenas still existing (although we’re not shown what happened to them, iirc).
Sure, they’re ruthless, but that’s at least somewhat understandable given their situation.
I don't think this is accurate. The hyenas are fundamentally sadistic and difficult to satiate. That's why they're poor - it's what got them banished. They make them hyenas to reinforce it's not brought on by the situation, they're just like that. You run the risk of a racial analogy whenever you use species to articulate personality but i don't think it's intended, even subconsciously.
I think it's actually a very deep analogy to real fascist regimes. Recruit the type of poor who beat people up in bars via rhetoric that implies the rich are responsible for both their situation, and that behaviour. One implication is that the rich are the only ones who are exploitative, and the leader of the revolution in particular is not. "When we win, I will be good to you." Then you end up with a dictator.
At a meta-level the point is that the hyenas are the type of people who are insatiable, which is why they're persuaded by empty promises of power and why everything turns to wasteland once they're in charge.
But even then, conflict is a fact of life. If the hyenas hate you, allowing them to take charge will suck for you, even if it's nice for them. It's not a nice point but IMO it's an important life lesson.
> The hyenas are fundamentally sadistic and difficult to satiate. That's why they're poor - it's what got them banished.
Based on what? I’m only basing what I said on the original movie as I never saw any other content. I see the lions portraying them that way, but I see no obvious reasons to believe it’s true from the content of the movie. Maybe I’m misremembering, it’s been a while, but from what I remember they were a bit extreme but that just seemed like desperation.
> They make them hyenas to reinforce it's not brought on by the situation, they're just like that.
Except real Hyenas aren’t just like that which is why the movie got criticised by hyena conservationists.
I haven't seen the movie since I was a kid, but don't the hyenas live among the bones of elephants? That gives me the impression of insatiability. They gorged themselves on elephants yet they're still hungry.
Or maybe they were driven out of the fertile food-rich lands by the lions? Why is it presumed that they must be evil, their motivations were only ever shown to be that they were hungry.
Won't work if you're already in a string, or if there are escaped quotes in the string. Also won't work if you have two or more double quoted strings that both contain an apostrophe.
Escaping isn't an intrinsic property of all quoted strings (e.g. single quoted strings in bash), but even so one can work around them without backreferences, by searching for anything that's not a quote or a backslash, _or_ any escaped character:
/"([^"\\]|\\.)*"/
Now double that up with a single quote version if you wish.
What you can't match without backreferences, however, is strings with customisable terminators, e.g. the behaviour in sed that whatever character you use after `s` is the regex terminator (it doesn't have to be `/`), or raw strings in C++.
Backreferences don't really help with those problems.
> Won't work if you're already in a string
This doesn't make sense. How can you search for a string if you're already in a string? I can't think of a realistic situation where that would be useful or even really possible.
> or if there are escaped quotes in the string.
Solvable:
'(\'|\\|[^\'])*'|"(\"|\\|[^\"])*"
> Also won't work if you have two or more double quoted strings that both contain an apostrophe.
Interesting, thanks for pointing out a use case. But I don't think backreferences will help with that, it needs to be parsed by something more powerful than a regex.
And that example reminds me that Bash can do something similar:
The Rakudo implementation actually uses Raku regexes to parse Raku. To be fair though it is a lot easier to do that with the redesigned regexes that Raku has.
Basically you can use backreferences for that if you also allow the regex to be recursive.
my $regex = /
:ratchet
$<q> = (<["']>) # the beginning quote
{}:my $q = ~$<q>; # put it into a more normal lexical var
# capture between " and {
$<l> = ( [ <!before $q> <-[{}]> ]* )
[
[
:sigspace
「{」
<self=&?BLOCK>? # recurse
「}」
]
{$q = ~$<q>}
# capture between } and "
$<r> = ( [ <!before $q> <-[{}]> ]* )
]?
"$q" # match the end quote
# pass the combined string parts upwards
{ make ($<l> // '') ~ ($<self>.ast // '') ~ ($<r> // '') }
/;
「'a{ "b{ "c{ "d{ 'e{ "f" }g' }h" }i" }j" }k'」 ~~ /^ <r=$regex> $ { make $<r>.ast }/;
say $/.ast;
# abcdefghijk
Note that `Regex` is a subtype of `Block`. That is why `&?BLOCK` can be used as a reference to the regex itself.
`<foo=bar>` is a way to call `bar`, but also save it under the name of `foo`.
`$<foo> = …` is a way to capture `…` and save it under the name of `foo`.
---
It is a lot nicer and modular when you use regexes as part of a grammar:
# use Grammar::Tracer;
grammar String::Grammar {
token TOP { <strings> }
rule strings {
# at least one string
# if there are more than one they are separated by ~
<string> + % 「~」
}
token string {
$<q> = <["']>
# set a dynamic variable to the quote character
{}:my $*quote = ~$<q>;
<string-part>*
"$<q>"
}
# multiple tokens that act like one
# which is nicer than using |
proto token string-part {*}
multi token string-part:<non> {
[ <-[{}]> <!after $*quote> ]+
}
multi token string-part:<block> {
<block>
}
rule block {
「{」 ~ 「}」 <strings>?
}
}
class String::Actions {
method TOP ($/) { make $<strings>.ast }
method strings ($/) { make [~] @<string>».ast }
method string ($/) { make [~] @<string-part>».ast }
method block ($/) { make $<strings>.ast }
method string-part:<non> ($/) { make ~$/ }
method string-part:<block> ($/) { make $<block>.ast }
}
say String::Grammar.parse(
「"a{ "b{ "c{ "d{ "e{ "f" }g" ~ "zz" }h" }i" }j" }k"」,
:actions( String::Actions ),
).ast;
# abcdefgzzhijk
A `token` is just a `regex` with `:ratchet` mode turned on. (prevents backtracking)
A `rule` is just a `token` with `:sigspace` also turned on. (makes it easier to deal with optional whitespace.)
Every instance of `<foo>` is basically a method call.
`make` is about generating an `.ast` to pass up and out of the parse.
In this case the only thing the actions class does is return what would be the resulting string if it were compiled in Raku.
Re: already in a string, one of the primary uses of regex is to search from point in a text editor. So, cursor is in a string and you want to find the next string. Regex won't work on its own, you generally need more semantic information to differentiate opening & closing quotes (unless you can use local context from that particular language to infer it).
But more broadly, any situation where you search from a non-zero index has this problem.
I'm surprised your example works in Python. Is that a property of Python's parser, or all regex matchers?
> Regex won't work on its own, you generally need more semantic information
Yeah, I agree. My point was that regex won't work, regardless of if you have backreferences or not. So backreferences won't help.
> But more broadly, any situation where you search from a non-zero index has this problem.
I'm not sure I understand that. A lot of regex libraries let you specify a start index. It won't take into account data from before the start index though (regex doesn't really do that, regardless of backreferences). If your regex library doesn't support passing in a start index, you can just take a substring starting at that index, then search the substring.
I don't think Python is really special. Python's findall() is just a convenience function that does a loop finding a match, then finding another match that starts after the first match, etc. Most languages provide a way to find the end point of the most recent match, and then you can just write the loop yourself to start the next search at that point.
> This doesn't make sense. How can you search for a string if you're already in a string? I can't think of a realistic situation where that would be useful or even really possible.
query = "select * from table where name like \"%foo\""
Interesting. Although in that situation I think it would be easier to find the outer string, then unescape it, then find the inner string.
Although if you want to do it with pure regex, it can be done without backreferences too, although it would be exponentially large as you get more and more levels of nesting, whereas with backreferences I think it would only get quadratically large.
As some other replies pointed out, there are straightforward modifications to handle all those scenarios if those are your requirements instead. A place where regex _does_ fail is in arbitrarily nested string interpolations (the key being _arbitrary_ nesting because with enough time anyone can come up with a convoluted enough regex to handle a bounded degree of recursion).
I want to say it's enthusiasm that matters, but a lazy smart person takes less time to train than an enthusiastic moron, in my experience.
If you're paid to train people it's healthy to take responsibility for that but IMO it's not realistic or true. Training someone with poor aptitude is like swimming through tar. It's palpably different.