cool thanks for your opinion.
I do use @property in somesituations, not saying to stay away (in fact we 
had a discusion is another thread about it a while back) 

I agree that function are usually verbes. And it is true that if you 
isolate the name pointPositions() it doesn't feel natural but being a 
method it would read as
myMesh.pointsPositions() which I think reads nice . For me 
myMesh.getPointsPositions() read well but in the back of my head I expecy 
myMesh.setPointPositions() too. Must be subjective I guess.


El martes, 11 de mayo de 2021 a las 20:02:42 UTC+2, Alok Gandhi escribió:

> I have generously used prefix for methods 'get' without any 'set'.
>
> I think there is no convention and my code readability is generally 
> dictated by common sense and ease of understanding.
>
> Another point is that functions/methods sgould always be verbs as long as 
> possible. So pointPositions() to me does not feel like a natural function 
> that 'does' something.
>
> I would definitely use descriptor protocol (@property) wherever I can. It 
> makes code beautiful, plus readonly attrs are easily managed by absence of 
> a @setter.attr.
>
> So overall, I would not stay away from get_ prefix in absence of a set_
>
>
> On Tue, May 11, 2021, 22:34 Rudi Hammad <rudih...@gmail.com> wrote:
>
>>
>> So, I get the feeling that there isn't a clear naming convenction when it 
>> comes to use "get" as a prefix. I am not refering to the python @property, 
>> nor getter/setter methods. I am talking about normal methods.
>>
>> My criteria is:
>> when ever I prefix a method with "get" it is because I am implying there 
>> is a "set". By doing that, just by this naming it hints the reader if it is 
>> a getter or normal method.
>> For instance, I do ~.pointsPositions() not  ~.getPointsPositions(). 
>> Reading that I am trying to hint the reader that there is no 
>> setPointsPositions().
>>
>> Reading different apis, it seems there isn't a clear convention for this. 
>> Even within the same api you can find the prefix "get" almost randomly. 
>> Sometimes it might even be a getter that is not prefixed with get, but has 
>> its corresponding setter with the prefix "set".
>>
>> thoughts?
>>
>> R
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to python_inside_m...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/python_inside_maya/d1ebae5b-3343-4e94-8829-4879b11a6e68n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/python_inside_maya/d1ebae5b-3343-4e94-8829-4879b11a6e68n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/740087bf-129e-40c2-bd62-6dd8b7b694e8n%40googlegroups.com.

Reply via email to