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] Why does print(a_list.sort()) return None?

2015-03-28 Thread boB Stepp
On Sun, Mar 29, 2015 at 1:00 AM, Cameron Simpson wrote: > The former print: > > print(a_list.sort()) > > is printing the result of "a_list.sort()". > > Like most Python functions that operate on something (i.e. .sort, which > sorts the list in place), the .sort method returns None. And that is >

Re: [Tutor] Why does print(a_list.sort()) return None?

2015-03-28 Thread Cameron Simpson
On 29Mar2015 00:34, boB Stepp wrote: I am puzzled by the following: Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. a_list = [5, 0, 2, 4, 1] print(a_list.sort()) None print(a_list)

[Tutor] Why does print(a_list.sort()) return None?

2015-03-28 Thread boB Stepp
I am puzzled by the following: Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> a_list = [5, 0, 2, 4, 1] >>> print(a_list.sort()) None >>> print(a_list) [0, 1, 2, 4, 5] >>> I expecte

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] escape character regex

2015-03-28 Thread Dave Angel
On 03/28/2015 03:37 PM, Ian D wrote: Hi I run a regex like this: pchars = re.compile('\x00\x00\x00') #with or without 'r' for raw Which one did you actually want? The 3 byte sequence consisting of nulls, or the 12 byte one containing zeroes and backslashes? I'm going to assume the form

Re: [Tutor] escape character regex

2015-03-28 Thread Danny Yoo
> But if I try to match the extra digits at the end like this: > >>pchars = re.compile('\x00\x00\x00\x\d+') > > I get an error: > >>ValueError: invalid \x escape You should just be able to say: pchars = re.compile('\x00\x00\x00..') because it looks like you're trying to grab at the last two

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] escape character regex

2015-03-28 Thread Ian D
Hi I run a regex like this: >pchars = re.compile('\x00\x00\x00') #with or without 'r' for raw on a string like this: >data = "['broadcast', 'd8on\x00\x00\x00\x11broadcast', 'd11on']" >print "found pchars :",pchars.findall(data) which returns: >found pchars : ['\x00\x00\x00'] But if I tr

[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