Hi,
I would like to know what naming conventions we can follow for the following types of variables/sequences :
Variables :
-------------
Integer
Float
Boolean
Sequences :
--------------
Strings
List
Dictionary
Tuples
File
I understand that Python variables are "Dynamicall y Typed" ,that is one of the feature of it.But how the developer differentiate with different sequences or variables he is working with.
Thanks in advance
PSB
18 3275 bartonc 6,596
Recognized Expert Expert
Hi,
I would like to know what naming conventions we can follow for the following types of variables/sequences :
Variables :
-------------
Integer
Float
Boolean
Sequences :
--------------
Strings
List
Dictionary
Tuples
File
I understand that Python variables are "Dynamicall y Typed" ,that is one of the feature of it.But how the developer differentiate with different sequences or variables he is working with.
Thanks in advance
PSB
As I was reading your post, the words "Dynamicall y Typed" were running through my mind. I'm glad that you have that understanding. Because a function don't care about the type of it's arguments, I've settled on a nameType (sometimes long_nameType) naming "convention " for myself. But that mostly applies to instances of class objects. I don't differentiate between mutibles and non-mutibles the way that you have. As a rule, I use:
class: ThisClassName
def: ThisFuncName
useofThisClass = ThisClassName()
thisType = ThisFuncName()
Integer
Float
I just use descriptive names like
loopCount, distance, etc. Just wait 'til you meet Decimal and others that are not built in, but are very commonly used.
Boolean
conditionFlag
Strings
whateverStr
List
listofList
Dictionary
describeDict
Tuples
samehereTuple
File
alwaysFile
I hope that is useful to you. Thanks for posting. Keep it up.
bartonc 6,596
Recognized Expert Expert
As I was reading your post, the words "Dynamicall y Typed" were running through my mind. I'm glad that you have that understanding. Because a function don't care about the type of it's arguments, I've settled on a nameType (sometimes long_nameType) naming "convention " for myself. But that mostly applies to instances of class objects. I don't differentiate between mutibles and non-mutibles the way that you have. As a rule, I use:
class: ThisClassName
def: ThisFuncName
useofThisClass = ThisClassName()
thisType = ThisFuncName()
Integer
Float
I just use descriptive names like
loopCount, distance, etc. Just wait 'til you meet Decimal and others that are not built in, but are very commonly used.
Boolean
conditionFlag
Strings
whateverStr
List
listofList
Dictionary
describeDict
Tuples
samehereTuple
File
alwaysFile
I hope that is useful to you. Thanks for posting. Keep it up.
Also, for short loops where the whole life of a counter can be seen in just a few line, i, j, k, do just fine. And for long life instance variablea shared by many methods, I use_very_descri ptive_names which may not need the Type at the end. This is all just personal style and I have seen "convention s" change over the years. If you look at the style that Tkinter was written in, you'll see what I think is a very common "pythonic" way of naming things. On the other hand, wxPython ToolKit uses C naming conventions because of the underlieing implementation and is the style that I prefer.
bvdet 2,851
Recognized Expert Moderator Specialist
Hi,
I would like to know what naming conventions we can follow for the following types of variables/sequences :
Variables :
-------------
Integer
Float
Boolean
Sequences :
--------------
Strings
List
Dictionary
Tuples
File
I understand that Python variables are "Dynamicall y Typed" ,that is one of the feature of it.But how the developer differentiate with different sequences or variables he is working with.
Thanks in advance
PSB
Take a look at this: http://www.python.org/doc/essays/styleguide/
Following are some guidelines I use: single letter names for class instances ('a', 'b', 'c')
single letter name ('f') for an open file if contained in a small block of code
'i' (integer) when executing a range iteration
LineLineInterse ct3D, Plane3D - class definitions
clip_hole, add_weld, radius_cut, data_Defaults_p ath, import_data, trueAngleBetwee nMembers, formatDict, formatPtList - descriptive names for functions
PointRotate3D - descriptive names for functions with major functionality
pt_list or ptList - a list of points
bm_list or bmList - a list of beams
dd1, dd2, memDict, conn_dict - dictionaries
rot_arg - tuple (I mostly use lists)
ptWP, pt1, p1 - point objects
mem1 - the first selected member object
m, bm, col, mem, key - iteration on a list of:
material
beams
columns
members
dictionary keys
A descriptive name similar to lists - strings, integers, and floats
no_spa (number of spaces), left_dist (the distance from the left end)
I am still in 2.3 - not using sets yet bartonc 6,596
Recognized Expert Expert
Take a look at this: http://www.python.org/doc/essays/styleguide/
Thanks BV. I hadn't read that before. I am amazed how much of THE MAN's style I have picked up over the years just by reading library modules. My whitespace thinking exactly matches his. Great link (I bookmarked it).
Hi,
What naming conventions has to be followed for the Class Variables and Methods?.How to differentiate the Private ,Protected and Public Class Variables and Methods?Is there any conventions has to be followed.
Thankls & REgards
PSB
bartonc 6,596
Recognized Expert Expert
Hi,
What naming conventions has to be followed for the Class Variables and Methods?.How to differentiate the Private ,Protected and Public Class Variables and Methods?Is there any conventions has to be followed.
Thankls & REgards
PSB
Guess you haven't found this yet.
Hi ,
I am not able to decide the Naming conventions for the following.
Variables :
--------------
Float
Integer
String
List
Dictionary
Tuples
File
Class Names
Private,Protect ed and Public
Class Variables
Class Methods
Functions
I have looked for various material in Internet .I am not able to get the consistency naming conventions.
Each one is following thier own naming conventions.
Thanks in advacne
PSB
bartonc 6,596
Recognized Expert Expert
Hi ,
I am not able to decide the Naming conventions for the following.
Variables :
--------------
Float
Integer
String
List
Dictionary
Tuples
File
Class Names
Private,Protect ed and Public
Class Variables
Class Methods
Functions
I have looked for various material in Internet .I am not able to get the consistency naming conventions.
Each one is following thier own naming conventions.
Thanks in advacne
PSB
It really comes down to a matter of personal style.
BV gave a great link. I gave suggestions. Please try to keep one post per topic so that all info ends up in one place. Thanks.
Hi ,
The naming conventions for UI in Python are similar to that of Application.
UI Variables and Methods
- Handlers
- Control Variables ( ID's,EDIT Box,Combo Box)
- Class Variables
- Call back names
- Event Handlers
- Other
Thanks in Advacne
PSB
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Cristof Falk |
last post by:
I wanted to get a feel. The documentation gives naming conventions for
public/protected members. Is this truly widely adopted?
And what about using the same conventions for private members and
variables?
My coding preference is to use this everywhere (banish Hungarian and
follow the capitalization rules) but I need to sell it to team
members.
|
by: cmiddlebrook |
last post by:
Hi there,
I keep finding myself getting inconsistent with naming conventions for
things like member variables, class names etc and I just want to find
something that suits me and stick to it. I am wondering if there are
any naming conventions around that are deemed suitable by the general
C++ community. I have googled around and I can't find much - mostly
long lists of hungarian-like prefixes which is not really what I'm
after.
|
by: clintonG |
last post by:
Does the use of DTD, XML Schema and similar constructs adopt
the use of C# naming conventions? If so how do I make the distinction
of how to apply C# conventions with XML elements, attributes and so
on? Any referrals to resources that discuss or document XML Naming
Conventions?
--
<%= Clinton Gallagher, "Twice the Results -- Half the Cost"
Architectural & e-Business Consulting -- Software Development
NET...
|
by: Mark Broadbent |
last post by:
stupid question time again to most of you experts but this is something that
continually bothers me.
I am trying to get into the habit of naming variables and controls in an
assembly as per convensions. The thing is that Ive never really get the full
reference to check against.
Ive seen a couple of articles, but there always seems to be a bit missing. I
also always seem to run into conflicting convensions both in code samples
themselves...
|
by: clintonG |
last post by:
Does the use of DTD, XML Schema and similar constructs adopt
the use of C# naming conventions? If so how do I make the distinction
of how to apply C# conventions with XML elements, attributes and so
on? Any referrals to resources that discuss or document XML Naming
Conventions?
--
<%= Clinton Gallagher, "Twice the Results -- Half the Cost"
Architectural & e-Business Consulting -- Software Development
NET...
| |
by: rastaman |
last post by:
Hi all,
I know of the existence of Object Naming Conventions for Visual Basic 6.
Now I'm reading some books about VB .NET, but the names used for the
objects are button1, picturebox1, etc.
I wonder if I can use the same naming conventions as for VB6 ? If so, what
about the names for the new objects in .NET.
Kind regards
rastaman
|
by: Patrick |
last post by:
what are the general naming conventions for vb.net controls.
esp txtUserName, lblPassword, btnSubmit
What are the prefixes for the controls????
I've tried to search hi and low on the net, but in vain.
I'd much appreciate it if someone could guide me with regards to this.
All i need are standards for me to follow by my self. Cuz i'm finding it
difficult to make my own darn standards.
|
by: kevininstructor |
last post by:
Greetings,
I am in the process of creating naming conventions for VB.NET controls i.e.
CheckBox -> chkShowThisOnStartup
ListBoxt -> lstSomeList
What I am looking for other developers input for Window.Form controls and
what they are using for naming controls.
|
by: Smithers |
last post by:
Is it common practise to begin the name of form classes with "frm" (e.g.,
frmOneForm, frmAnotherForm).
Or is that generally considered an outdated convention?
If not "frm" what is a common or recommended practise?
Thanks.
|
by: Philipp Post |
last post by:
Marcello,
Not a big surprise as naming conventions have a lot to do with
personal prefernces. There are a lot of threads in comp.databases and
the other database groups. Just do a search for "naming conventions"
in the groups.
In my oppinion one of the good conventions is presented by Joe Celko
in "SQL Programming Style". I would suggest reading it and pick up
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |