Loading ...
Sorry, an error occurred while loading the content.

Python mode & module level functions

Expand Messages
  • Ben Gollmer
    Hi, I have a number of Python files which contain classes as well as module-level functions. Unfortunately the Python mode is unable to distinguish between
    Message 1 of 2 , Nov 5, 2006
    • 0 Attachment
      Hi,

      I have a number of Python files which contain classes as well as
      module-level functions. Unfortunately the Python mode is unable to
      distinguish between functions which are members of a class and those
      that are not. This makes the function popup rather misleading (see
      screenshot 1, rtrim() and the following functions are not members of
      class ZertHd).

      I used Python's whitespace requirements to hack around this. Replace
      the Defs symbol in RegexSymbols.xml with these two symbols:

      <symbol id="Defs" image="SymbolM" indentation="0" ignoreblocks="yes">
      <regex>^def[ \t]+([\w\d_]+)[ \t]*\([^\)]*\)[ \t]*:</regex>
      </symbol>

      <symbol id="Defs" image="SymbolM" indentation="1" ignoreblocks="yes">
      <regex>(?<=[\n\r]|^)[ \t]+def[ \t]+([\w\d_]+)[ \t]*\([^\)]*\)
      [ \t]*:</regex>
      </symbol>

      And you will get something that looks like screenshot 2. It is clear
      that rtrim() and the following functions are not in the ZertHd class.
      This might be too hacky to make in into the regular distribution, but
      hopefully someone will find it useful :)


      Cheers,
      --
      Ben
    • Martin Pittenauer
      ... Thanks a lot! I like it and we might include it in the official distribution. All the best, Martin
      Message 2 of 2 , Nov 8, 2006
      • 0 Attachment
        On 06.11.2006, at 04:17, Ben Gollmer wrote:

        > And you will get something that looks like screenshot 2. It is
        > clear that rtrim() and the following functions are not in the
        > ZertHd class. This might be too hacky to make in into the regular
        > distribution, but hopefully someone will find it useful :)

        Thanks a lot! I like it and we might include it in the official
        distribution.

        All the best,
        Martin
      Your message has been successfully submitted and would be delivered to recipients shortly.