pdir2 icon indicating copy to clipboard operation
pdir2 copied to clipboard

About unfolding the CATEGORIES

Open iamgodot opened this issue 2 years ago • 4 comments

Proposal(more like a feature request)

Current categories make the result of pdir() a bit confusing, at least for myself. The original dir() doesn't have the problem since it outputs a simple alphabetized list, which is why pdir() could do much better. An idea of mine is to extend categories as different levels, and keep them orthogonal at each level. For example:

  • property
  • function
  • class
    • public
    • private
  • special
    • arithmetic
    • context_manager
    • coroutine
  • more..

iamgodot avatar Mar 05 '22 13:03 iamgodot

Fine with adding more categories to properties and special attributes, the more fine grained categorization actually already exists. The proposal on "class" doesn't make much sense to me, because right now we only show classes' names, and it's not clear what "private" and "public" means.

laike9m avatar Mar 06 '22 21:03 laike9m

Fine with adding more categories to properties and special attributes, the more fine grained categorization actually already exists. The proposal on "class" doesn't make much sense to me, because right now we only show classes' names, and it's not clear what "private" and "public" means.

Thanks for the reply, and let me explain myself clearer:

  1. Yes, I can see from the code that categories are getting layered, while it could also make a difference in the output, e.g. with less/more indents.
  2. The public/private class is only an example so it's totally arguable. What I meaned was those prefixed with _, for classes/functions/variables.

iamgodot avatar Mar 07 '22 08:03 iamgodot

I'm generally ok with supporting 1, though I anticipate the change to be non-trivial, and I may not have enough time to work on it at this moment.

for 2, I'd hold it. It is true that there's convention to treat the _ prefix as private, but it still is not a feature that we have in the language.

laike9m avatar Mar 12 '22 19:03 laike9m

I'm generally ok with supporting 1, though I anticipate the change to be non-trivial, and I may not have enough time to work on it at this moment.

for 2, I'd hold it. It is true that there's convention to treat the _ prefix as private, but it still is not a feature that we have in the language.

Cool, I get your point with the prefix matter. You're right about the changes this unfolding/indenting might've brought, I'll come up with more details to sort out what needs to be done.

iamgodot avatar Mar 13 '22 01:03 iamgodot