Python class coding

Discussion in 'General Chat' started by maskedcerf, May 11, 2016.

Tags:
  1. Grenore

    Grenore 《Member》

    Joined:
    Apr 18, 2016
    Messages:
    1,241
    Likes Received:
    465
    Reading List:
    Link
    oh yea, it doesn't use, but i thought it does. nvm ;DD i guess my mind got messed up after using java
     
  2. maskedcerf

    maskedcerf DCLXVI

    Joined:
    Oct 22, 2015
    Messages:
    1,770
    Likes Received:
    2,329
    Reading List:
    Link
    ahah no worry XD it happen ^^
     
  3. Scarecrow

    Scarecrow > dev/null

    Joined:
    Oct 22, 2015
    Messages:
    1,919
    Likes Received:
    1,860
    Reading List:
    Link
    Teach me senpai.
     
  4. Alvastar

    Alvastar Well-Known Member

    Joined:
    Nov 15, 2015
    Messages:
    645
    Likes Received:
    619
    Reading List:
    Link
    This is not valid in python. Python is based on pseudo-code, which relies heavily on indentation. Where the start of curly bracket would be there is a colon. This follows a line-break and indentation. Everything inside the function/statement is on the same level of indentation. It's similar to case statements in other languages.

    Having said that, {} and [] are used for lists and dictionaries in python. These are very interesting and highly useful if done properly.
     
    trvc and maskedcerf like this.
  5. Little Dragon

    Little Dragon I does what I likes and I likes what I do

    Joined:
    Nov 21, 2015
    Messages:
    1,803
    Likes Received:
    4,449
    Reading List:
    Link
  6. Nyarlathotep

    Nyarlathotep The laziest and the King of Procrastination

    Joined:
    Nov 23, 2015
    Messages:
    1,572
    Likes Received:
    1,011
    Reading List:
    Link
    I'm Italian and I'm not proud of it * goes to hide in shame after thinking of A LOT of his compatriots*
     
    Westeller and maskedcerf like this.
  7. maskedcerf

    maskedcerf DCLXVI

    Joined:
    Oct 22, 2015
    Messages:
    1,770
    Likes Received:
    2,329
    Reading List:
    Link
    XD that would be a good title for the thread
     
  8. maskedcerf

    maskedcerf DCLXVI

    Joined:
    Oct 22, 2015
    Messages:
    1,770
    Likes Received:
    2,329
    Reading List:
    Link
    italian isn't that bad XD i mean from the news i heard that you were having progress
     
  9. sufod01

    sufod01 Ghost

    Joined:
    Mar 27, 2016
    Messages:
    1,698
    Likes Received:
    1,431
    Reading List:
    Link
    C'est en français wow! Bien que je ne comprend pas les codages (je suis nul à ça) ça fait plaisir de voir un peu de français ici :p
     
    maskedcerf likes this.
  10. f.m.

    f.m. Great Unambitious Eccentric

    Joined:
    Jan 6, 2016
    Messages:
    256
    Likes Received:
    91
    Reading List:
    Link
    coding makes me pissy...

    [​IMG]
     
  11. justmehere

    justmehere Well-Known Member

    Joined:
    Nov 2, 2015
    Messages:
    3,927
    Likes Received:
    3,729
    Reading List:
    Link
    Lol,

    looking at the previous pages that contains everything but your solution.... I think you are asking in the wrong place here....
     
  12. lichdeath

    lichdeath undead meatbun ^^

    Joined:
    Apr 18, 2016
    Messages:
    780
    Likes Received:
    744
    Reading List:
    Link
    true
     
  13. Serene Moon Over Silent Waters

    Serene Moon Over Silent Waters Well-Known Member

    Joined:
    Nov 8, 2015
    Messages:
    28
    Likes Received:
    26
    Reading List:
    Link
    So getter and setter refer to methods for encapsulation. Good programming should always separate out the interactions between objects and users. In this case, getter and setter make it so that only by running these methods can the values of the attributes of personnage be viewed or modified directly. Setter will make it so that if you need to set the value of vie, perhaps through some skill a character uses, it can only be done that way. Getter makes it so that vie will only be viewable through this method.

    Also use more comments. If you want people to understand your code, including yourself after a 6 month hiatus, you need to document it.
     
    trvc likes this.
  14. maskedcerf

    maskedcerf DCLXVI

    Joined:
    Oct 22, 2015
    Messages:
    1,770
    Likes Received:
    2,329
    Reading List:
    Link
    true it happened a lot in the past but i always forget XD thanks ^^
    j'en suis fort aise (jdec c'est un plaisir mec XD)
     
    sufod01 likes this.