question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use CamelCase syntax for all classes

See original GitHub issue

I would like to change the syntax of all the classes to use CamelCase, as this is how it should be for modern Python.

I started a pull request for this: https://github.com/gccxml/pygccxml/pull/89

Technically there is nothing really difficult here. There is just a choice to be made for our two main classes describing the different declarations and types: type_t and declaration_t. I was thinking renaming them to DeclarationD and TypeT. The D is for the declaration hierarchy, the T is for the type hierarchy. This would lead to (for example): EnumerationD and ShortIntT.

On reason is to have something in the name that easily allows to see to what class hierarchy the class belongs to. One another reason is that I can not have a Type class (type is a reserved keyword in Python. Type would be fine but I would like to avoid confusions between the lowercase/uppercase version).

I know that @RomanYakovenko @mamoll @MarkOates may have an opinion on this:

  • should it be Declaration and Type, or DeclarationD and a TypeT + D or T suffix for all other classes
  • Should we keep the old syntax around for the 2.0 release. I could do something like this: https://github.com/gccxml/pygccxml/pull/89/files#diff-f3ca1b6d15eb0878707ef50fcfa65c30R15 I was thinking about wrapping this with a deprecation warning, but I am worried performance could take a hit if a lit of warnings need to be printed … so I would prefer to remove the old syntax for 2.0. If people want to keep the old syntax, they can stay on 1.9.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
RomanYakovenkocommented, Oct 31, 2017

I saw the branch few weeks ago and frankly I don’t know how to receive it or express gently my thoughts. pygccxml coding convention was born in order to make C++ developers feel comfortable with it. Not Python one, but C++. C++ developers was my main target. C++ has codding convention - std/boost libraries. For example - many names in “type traits” functionality are very similar/identical to C++. This is one point of view, another one current users. Why do you want to hurt them? Consider OMPL (https://github.com/gccxml/pygccxml/issues/56) py++/pygccxml performance issues. How many time/effort will be spent just to change the convention and for what? There are few project like it. For those projects investing time into “renaming” is a pure waste of time. Saying that, I understand your desire to make the package to be “Pythonic”. I also understand that in open source & free project it is very important to enjoy from it. May be you need/want to consider to provide “py2to3” like conversion script. So the transition will be “semi/fully” automated. I will test such script on my projects.

Regards, Roman

0reactions
iMichkacommented, Aug 18, 2018

Abandoning this idea for the moment. Got stuck with other projects, and I have not so much time anymore to take care of pygccxml. So I do not want to generate more work than needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the CamelCase naming convention? - TechTarget
CamelCase is a way to separate the words in a phrase by making the first letter of each word capitalized and not using...
Read more >
Can I use camelCase in CSS class names - Stack Overflow
Technically yes, but it's risky because while CSS syntax is mostly case-insensitive, in some browsers under certain conditions, class names ...
Read more >
Camel case in Java - Javatpoint
Java follows the camel-case syntax for naming the classes, interfaces, methods, and variables. If the name is combined with two words, the second...
Read more >
Pascal Case: under_scores, camelCase and PascalCase
Some languages which don't derive their syntax from C (such as Python & Ruby) use underscores for almost everything except class names.
Read more >
Programming Naming Conventions – Camel, Snake, Kebab ...
In camel case, you start a name with a small letter. If the name has multiple words, the later words will start with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found