Pokémon X and Y Fan Community
March 29, 2024, 07:01:51 am
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
  Home Help Search Arcade Gallery SHOUTBOX Staff List Calendar Members Login Register  

Programming Thread

Pages: 1 2 [3] 4 5 ... 12
  Send this topic  |  Print  
Author Topic: Programming Thread  (Read 3340 times)
0 Members and 11 Guests are viewing this topic.
klondikebar
Global Moderator
Malevolent Murkrow
*****

Level: 44
Offline Offline

Posts: 2977


View Profile
Badges: (View All)
« Reply #30 on: November 25, 2012, 03:06:43 pm »

I hate doing classes in Python, it's so weird. the __init__ is just the constructor (code that's executed when a object is created from the class) method. Comparing it to Java:

Code:
public class myClass{
      public myClass(){
             System.out.println("New Object");
      }
}

Is Python's equivelent of:
Code:
class myClass:
       def __init__(self):
              print("New Object")

I think it's the "self" thing that throws me off. It seems like every class is just referring to itself.
I'm learning python through Learn Python the Hard Way, and it's been great, but I needed more help on the classes. So, I went to codecademy, and it was slightly helpful, but then it's editor started bugging and it passed me for things I know that I'd done wrong, meaning I couldn't tell what I did wrong and fix it, or it failed me and then didn't give any clue as to what went wrong...

God I hate the internet sometimes.
Report Spam   Logged
Pages: 1 2 [3] 4 5 ... 12
  Send this topic  |  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
Free SMF Hosting - Create your own Forum

Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy
Page created in 0.058 seconds with 15 queries.