• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

OOP in python

 
Ranch Foreman
Posts: 175
8
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just got help from Ryan (dijkstra baby steps) to solve a problem which actually follows that post (attempt at understanding graph theory). I would really appreciate some help about OOP, because I got really confused in the process!

1. question 1
I tried to order everything in a class, but I cannot figure out why that work:


while that does not?


2. why do I get unresolved reference to self when I put:

at the end of the code, after return cost, with an additional indent?







This is the class:


This is the test:
 
D.J. Quavern
Ranch Foreman
Posts: 175
8
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get it... everyone hates python     ?
 
Ranch Foreman
Posts: 376
4
Android Tomcat Server Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

D.J. Quavern wrote:I get it... everyone hates python     ?


Not really, but I think most of the user here know well on Java compare to Phyton. I wish I could help, but sadly I have zero knowledge on Phyton.
 
D.J. Quavern
Ranch Foreman
Posts: 175
8
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Randy Tong wrote:

D.J. Quavern wrote:I get it... everyone hates python     ?


Not really, but I think most of the user here know well on Java compare to Phyton. I wish I could help, but sadly I have zero knowledge on Phyton.



I know, right    
I started with Java (that's why I came on the ranch), and I stayed for the lovely atmosphere.
But my teacher told me to switch to python for algorithms and small problems...

Thank you for answering!
 
Randy Tong
Ranch Foreman
Posts: 376
4
Android Tomcat Server Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm added 3 flags to your thread. Hopefully it will get more attention.
 
Saloon Keeper
Posts: 3416
149
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi DJ,

no, I don't hate Python,  I followed two courses 5 years ago, but classes were hardly used. And this self thing I always found confusing. But I did want to help, I was just reading some articles on the internet about classes in Python. It strikes me that in the definitions within the class, self is always used, but not when invoked. Another problem is that testing what you think is requiring a decent IDE. I've just downloaded PyCharm from JetBrains, now trying to find my way in it.

So, we do want to help, but in my case it's going to take some time! And this teacher of yours....
 
D.J. Quavern
Ranch Foreman
Posts: 175
8
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Randy Tong wrote:I'm added 3 flags to your thread. Hopefully it will get more attention.


Oh my, that's so lovely of you!
You don't need to waste all your flags! I am sure I will end up learning it anyway!
 
D.J. Quavern
Ranch Foreman
Posts: 175
8
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Piet Souris wrote:hi DJ,

no, I don't hate Python,  I followed two courses 5 years ago, but classes were hardly used. And this self thing I always found confusing. But I did want to help, I was just reading some articles on the internet about classes in Python. It strikes me that in the definitions within the class, self is always used, but not when invoked. Another problem is that testing what you think is requiring a decent IDE. I've just downloaded PyCharm from JetBrains, now trying to find my way in it.

So, we do want to help, but in my case it's going to take some time! And this teacher of yours....



Thank you Piet! Now I feel guilty to monopolize your time!

I will ask my next questiosn on the algorithm instead, there is so much on this front as well!


 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!