I'm curious, is there a standard approach to dealing with long lists in the Python community, and in particular, is there any antipathy toward doing blank lines followed by comments to break up a particularly long list, e.g. of tuples, or in a dict, etc.?
For example, I'm developing a GUI application in wxPython, and am defining the keyboard shortcut mappings to . Is this fairly Pythonic?
accelerator_table = wx.AcceleratorTable([
# Case accelerators
(CTRL, ord('S'), EventIds.SAVE_CASE),
(CTRL_SHIFT, ord('S'), EventIds.RENAME_CASE),
(CTRL, wx.WXK_DELETE, EventIds.REMOVE_CASE),
(CTRL_SHIFT, wx.WXK_DELETE, EventIds.DELETE_CASE),
# Project accelerators
(CTRL_ALT_SHIFT, ord('S'), EventIds.RENAME_PROJECT),
(ALT, wx.WXK_DELETE, EventIds.REMOVE_PROJECT),
(ALT_SHIFT, wx.WXK_DELETE, EventIds.DELETE_PROJECT),
# Help accelerators
(NORMAL, wx.WXK_F1, EventIds.HELP),
(NORMAL, wx.WXK_F2, EventIds.LAUNCH_MANUAL),
(NORMAL, wx.WXK_F12, EventIds.ABOUT),
...
])
The details aren't particularly important, but I'd like to write in a style that will not annoy other programmers along the way, and therefore to decide right now whether this pattern is worth keeping around.
Edit: Just to clarify: I'm not intending to put anything beyond that single blank line between sections in the list. That seems like it should minimize any confusion on the part of someone reading through the code.