Re: [Tutor] Python OO

2015-03-29 Thread Juan C.
On Sun, Mar 29, 2015 at 9:39 PM Juan C. wrote: The ID is set by the API, I don't have control over it, I can't modify it, and I don't really need to modify it. There is an option to search the API using the name, like so ( http://private-anon-37abaab74-themoviedb.apiary-mock.com/3/search/person?qu

Re: [Tutor] Python OO

2015-03-29 Thread Juan C.
On Sun, Mar 29, 2015 at 8:55 PM Alan Gauld wrote: Can you explain how that works? Does the user create their own random unique values? Do you use a source of unique keys? Or could the Actor init() maybe generate an ID for the user? But without the API knowing the ID, how does the correct data get

Re: [Tutor] Python OO

2015-03-29 Thread Alan Gauld
On 29/03/15 20:16, Juan C. wrote: Current code on core.py: from pycinema.mdb import MovieDB API = MovieDB('API KEY GOES HERE') class Actor: ... Current code on mdb.py: import requests class MovieDB: ... def get_actor(self, actor_id): response = requests.get('http://api.themoviedb.org/3/per

Re: [Tutor] Python OO

2015-03-29 Thread Juan C.
Ok, applying what you guys said I have: - folder: pycinema - package: pycinema - - core.py - - mdb.py - __main__.py Current code on core.py: # -*- coding: utf-8 -*- from pycinema.mdb import MovieDB API = MovieDB('API KEY GOES HERE') class Actor: def __init__(self, actor_id): api = API.get_act

Re: [Tutor] Python OO

2015-03-29 Thread Mark Lawrence
On 29/03/2015 18:30, Juan C. wrote: On Sun, Mar 29, 2015 at 3:56 AM Ben Finney wrote: As a side issue: You apparently intend to choose names that are English language. If that's true, you should know that “actor”, “movie”, “series” are all singular. My bad, it's series indeed. On Sun, Mar 29

Re: [Tutor] Python OO

2015-03-29 Thread Juan C.
On Sun, Mar 29, 2015 at 3:56 AM Ben Finney wrote: As a side issue: You apparently intend to choose names that are English language. If that's true, you should know that “actor”, “movie”, “series” are all singular. My bad, it's series indeed. On Sun, Mar 29, 2015 at 10:33 AM Dave Angel wrote:

Re: [Tutor] Python OO

2015-03-29 Thread Peter Otten
Dave Angel wrote: > On 03/28/2015 09:16 PM, Juan C. wrote: >> Ok, so, let me try to express what I think is 'right' here according to >> what you said. >> >> My code structure needs to be something like that: >> >> pycinema >> - package: pycinema >> - - __init__.py >> - - api.py >> - - actor.py >>

Re: [Tutor] Python OO

2015-03-29 Thread Mark Lawrence
On 29/03/2015 02:32, Juan C. wrote: On Sat, Mar 28, 2015 at 10:26 PM Mark Lawrence wrote: If your classes are small put them in one source file, which is clearly simpler than your proposed structure. Why over-engineer something if there is no need to? Well, my classes won't be that small, and s

Re: [Tutor] Python OO

2015-03-29 Thread Dave Angel
On 03/28/2015 09:16 PM, Juan C. wrote: Ok, so, let me try to express what I think is 'right' here according to what you said. My code structure needs to be something like that: pycinema - package: pycinema - - __init__.py - - api.py - - actor.py - - movie.py - - serie.py - __main__.py I'd su

Re: [Tutor] Python OO

2015-03-29 Thread Alan Gauld
On 29/03/15 02:16, Juan C. wrote: Ok, so, let me try to express what I think is 'right' here according to what you said. My code structure needs to be something like that: pycinema - package: pycinema - - __init__.py - - api.py - - actor.py - - movie.py - - serie.py - __main__.py What I said

Re: [Tutor] Python OO

2015-03-28 Thread Ben Finney
"Juan C." writes: > My actor related methods should be set apart from my movie, serie > related ones, don't you agree? As a side issue: You apparently intend to choose names that are English language. If that's true, you should know that “actor”, “movie”, “series” are all singular. https:/

Re: [Tutor] Python OO

2015-03-28 Thread Juan C.
On Sat, Mar 28, 2015 at 10:26 PM Mark Lawrence wrote: If your classes are small put them in one source file, which is clearly simpler than your proposed structure. Why over-engineer something if there is no need to? Well, my classes won't be that small, and separating them by modules would be eas

Re: [Tutor] Python OO

2015-03-28 Thread Mark Lawrence
On 29/03/2015 02:16, Juan C. wrote: Ok, so, let me try to express what I think is 'right' here according to what you said. My code structure needs to be something like that: pycinema - package: pycinema - - __init__.py - - api.py - - actor.py - - movie.py - - serie.py - __main__.py And why I u

Re: [Tutor] Python OO

2015-03-28 Thread Juan C.
Ok, so, let me try to express what I think is 'right' here according to what you said. My code structure needs to be something like that: pycinema - package: pycinema - - __init__.py - - api.py - - actor.py - - movie.py - - serie.py - __main__.py And why I use it this way? 1. You said that I ne

Re: [Tutor] Python OO

2015-03-28 Thread Alan Gauld
On 28/03/15 21:39, Juan C. wrote: you should also be thinking about the methods. What will a series object do in the context of your application? My app doesn't do anything specific. It's just for the sake of doing something. Maybe, I just create a serie instance and print all the info about

Re: [Tutor] Python OO

2015-03-28 Thread Juan C.
On Sat, Mar 28, 2015 at 5:23 PM Alan Gauld wrote: > That looks like a data oriented class, which may not be a bad thing but you should also be thinking about the methods. What will a series object do in the context of your application? How will those data attributes help the methods do their job?

Re: [Tutor] Python OO

2015-03-28 Thread Alan Gauld
On 28/03/15 19:06, Juan C. wrote: The script uses the Movie DB API, and I have a Series module. So far so good, but you probably want to hide the MDB API inside your module so that if you replace it with another one (or add another one later) you don't change your modules API. In this module

[Tutor] Python OO

2015-03-28 Thread Juan C.
So, I'm trying to create a little script here using OO to learn it, and I got some questions: The script uses the Movie DB API, and I have a Series module. In this module I have 3 classes, 'Serie', 'Season' and 'Episode'. In __main__.py I will instantiate a serie like so 'some_random_name = Serie