how to determine an 'open' string?

Terry Reedy tjreedy at udel.edu
Thu May 16 14:53:05 EDT 2002


"holger krekel" <pyth at devel.trillke.net> wrote in message
news:mailman.1021560087.23138.python-list at python.org...
> with my replacement rlcompleter module i'd like to
> have a *correct* check if a string is 'open'.
> examples:
>
>     asd"""askdjalsdk      # open
>     aksdjasd              # closed
>     asjdkk"kajsd''''      # open
>     "'asdasd"             # closed
>     """dontcountoneven"   # open
>
> so i need a function which takes these strings as
> an argument and return 1 for 'open', 0 for a 'closed' string.
>
> Any working ideas?

What means 'open'?  A few examples do not a definition make.  Write a
complete definition (one that applies to all strings) that *you*
regard as correct and think you are willing to live with.  Then
translate to code (probably the easier part).

Terry J. Reedy






More information about the Python-list mailing list