laike9m / pdir2

Pretty dir() printing with joy:beer:
MIT License
1.33k stars 47 forks source link

About unfolding the CATEGORIES #61

Open iamgodot opened 2 years ago

iamgodot commented 2 years ago

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:

laike9m commented 2 years ago

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.

iamgodot commented 2 years ago

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.
laike9m commented 2 years ago

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.

iamgodot commented 2 years ago

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.