Buy this Domain

Community Discussions

Explore the latest discussions and community conversations related to this domain.

programming languages - Why do we use _ in variable names? - Stack Overflow

Main Post: programming languages - Why do we use _ in variable names? - Stack Overflow

Forum: stackoverflow.com

Can someone explain "_" and "__" in python clearly for me ?

Main Post:

I'm currently learning OOP and came across these "_" and "__" . These are parts of Python encapsulation. I can understand that by creating a variable with "_" makes that variable private and "__" makes the variable protected. However, my problem is people can still access and modify the private variable anytime outside the class and also you can access protected variables via "name mangling". So then what is the purpose of making a variable private and protected ? Also, is there any way we can make a variable or method really private or protected? And lastly, when should I use private and when should I use protected variable or methods ?

Top Comment: There is no inherent purpose, it's just convention. Python doesn't have real enforced scoping, it just assumes you know not to mess with things you're explicitly asked to not mess with.

Forum: r/learnpython

object oriented - Why is it uncommon (is it?) to use _ (underscore) in JS private vars? - Software Engineering Stack Exchange

Main Post: object oriented - Why is it uncommon (is it?) to use _ (underscore) in JS private vars? - Software Engineering Stack Exchange

Forum: softwareengineering.stackexchange.com

Difference between "private instance fields" and "private fields"

Main Post:

According to this Microsoft document, specific conventions for naming have been written, and the meaning of the following two items is not clear to me.

1: Use camelCase for method arguments, local variables, and private fields.

2: Private instance fields start with an underscore (_).

First, what are the differences between private fields and private instance fields, according to the contents?

Second, how do we use private instance fields whose names must begin with an underscore as function arguments according to the above two conventions (please provide an example)?

Third, does the following code follow Microsoft's C# identifier naming conventions?

using UnityEngine; public class PlayerController : MonoBehaviour { #region fields //Private fields private float vehicleSpeed = 5.0f; private float turnSpeed = 25f; private float horizontalInput; private float forwardInput; #endregion #region functions/methods // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { horizontalInput = Input.GetAxis("Horizontal"); forwardInput = Input.GetAxis("Vertical"); //We'll move the vehicle forward transform.Translate(Vector3.forward * Time.deltaTime * vehicleSpeed * forwardInput); //We turn the vehicle transform.Rotate(Vector3.up * Time.deltaTime * turnSpeed * horizontalInput); } #endregion }

Top Comment: According to this Microsoft document, specific conventions for naming have been written, and the meaning of the following two items is not clear to me. 1: Use camelCase for method arguments, local variables, and private fields. 2: Private instance...

Forum: learn.microsoft.com

How to make a community private?

Main Post:

How can I make my community and everything in it private to everyone unless they are member I approve?

Top Comment: Old reddit: Go to https://www.reddit.com/r/YourCommunity/about/edit/ Find 'type', shouldn't be far from the top. Select "private". Go to the very bottom of the page Click "save options". New reddit: Go to https://www.reddit.com/r/YourCommunity/about/edit/ Scroll down to 'Type of Community' Select 'private' Click the blue "Save Changes" in the top right.

Forum: r/ModSupport

Is the private browsing mode for reddit gone?

Main Post:

I recall there being a private browsing mode for the reddit app, but it seems to be removed on my interface.....? Did they remove it or rename it to another tool?

Top Comment: Welcome to r/NewToReddit , u/talkingtomind ! Thanks for posting. Your post has been flaired 'Needs attention' so we can easily identify which posts require answers. Someone will be along to help you shortly. If you're new, check out our "General Guide to Reddit and Karma" Wiki page version or Mobile friendly post version , it explains how to get started on Reddit; including information on karma, navigation, and more. You might also like to check out our wiki index and FAQ . Please let us know how you found us! - Click here to fill out our one question survey Once you get some answers, don’t forget to engage and ask any additional questions you have! Once you have a good answer you can mark your post as answered by commenting with the exact phrase !answered. Otherwise, a mod will do so as time allows, once an accurate answer has been provided. This makes unanswered posts easier to find. Thank you! :) I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

Forum: r/NewToReddit

Is Reddit's new policy that NO subreddits are allowed to be private any longer? I'm getting notifications in private test subreddits that I need to re-open

Main Post:

I have private subreddits with no members that I use for testing, or they were a joke subreddit that is now stale and the sub is now closed.

I mod a sub that is a common misspelling of 2 million member sub with a redirect to the main sub.

I am now starting to receive notices from u/ModCodeofConduct that these subs need to reopen.

Is this Reddit's new policy, or is this just a badly coded script?

Top Comment: Yes, I think the Admins need to clarify this point now. I have private subs that have been private for years upon years. Or restricted for years. A business needs a clear rules / policy during a crisis. Please just post Reddit Inc. policy in this crisis.

Forum: r/ModSupport

I would like to make subreddit private

Main Post:

Can someone please assist me with how to make my subreddit private?

Top Comment: Go to Mod Tools, then General Settings, then scroll down to the "Community Type" Section, and click on the button to request a change to become private.

Forum: r/ModSupport