Spread a statement over various lines
On Thu, Sep 19, 2019 at 6:20 AM Ralf M. <Ralf_M at t-online.de> wrote:
> Am 17.09.2019 um 20:59 schrieb Manfred Lotz:
> > I have a function like follows
> > def regex_from_filepat(fpat):
> > rfpat = fpat.replace('.', '\\.') \
> > .replace('%', '.') \
> > .replace('*', '.*')
> > return '^' + rfpat + '$'
> > As I don't want to have the replace() functions in one line my
> > question is if it is ok to spread the statement over various lines as
> > shown above, or if there is a better way?
> > Thanks.
> Not related to your question, but:
> You seem to try to convert a Windows wildcard pattern to a regex
> pattern. However, wildcards sometimes behave a bit different than what
> you assume. I know for instance that *.* matches any filename, even if
> the filename doesn't contain a dot.
Hmm, why do you assume it's a Windows wildcard pattern specifically?