Defining URIObjects with a metaclass

Bug #80116 reported by Marius Gedminas
8
Affects Status Importance Assigned to Milestone
SchoolTool
Confirmed
Wishlist
Justas Sadzevičius

Bug Description

Instead of saying

  URIMembership = URIObject(...)

I want to say

  class URIMembership(URIObjectMeta):
     url = '...'
     ...

and get the same result (i.e. URIMembership should be an instance of class
URIObject with the same attributes set).

It would be very nice if I could say 'class URIFoo(URIObject)' and get an
instance, not a subclass, so that I wouldn't have to remember two different names.

The reason for my wish is that exuberant ctags doesn't index global variables in
Python code, so I cannot use jump-to-tag or tag-completion on URIs.

Sane people might veto this request on the grounds that it is too magical.

Revision history for this message
Ignas Mikalajūnas (ignas) wrote :

+1

Changed in schooltool:
assignee: nobody → ignas
status: In Progress → Confirmed
tags: added: api code-cleanup
Changed in schooltool:
assignee: Ignas Mikalajūnas (ignas) → Justas Sadzevičius (justas-pov)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.