Re: [Tutor] Wondering about a project

2015-02-03 Thread dw
Well I've made some progress in terminal mode. The OS is Ubuntu 12.04 LXDE desktop This script works. It prompts for the url, lets the user confirm download and then runs the video in Gnome-Player. Once Gnome-Player is dropped by the user, it prompts to either move the file to storage or delete.

Re: [Tutor] Wondering about a project

2015-02-03 Thread Alan Gauld
On 02/02/15 18:42, dw wrote: geturl="" You don't really need this since you assign it inside the loop. while True: call(["clear"]) geturl= input("Enter Youtube URL ") if len(geturl)==0: break def unquote(geturl): return re.compile('%([0-9a-fA-F]{2})',re

Re: [Tutor] Wondering about a project

2015-02-03 Thread Dave Angel
On 02/03/2015 07:12 AM, Alan Gauld wrote: On 02/02/15 18:42, dw wrote: You forgot to tell us the Python version you're targeting. From various clues in your code, I have to assume you're using 2.7, but if I'm wrong, there are other comments I should have made. geturl="" You don't reall

[Tutor] Macintosh Help with Python

2015-02-03 Thread Mark Warren
Can you help me through a phone number or chat on working with Python? -- Mark Warren Humboldt Unified School District # 258 801 New York Street Humboldt, Kansas 66748 Phone -- (620) 704-1527 ___ Tutor maillist - Tutor@python.org To unsubscribe or ch

Re: [Tutor] Macintosh Help with Python

2015-02-03 Thread Alan Gauld
On 03/02/15 15:22, Mark Warren wrote: Can you help me through a phone number or chat on working with Python? Sorry Mark, this is a mailing list. We can answer questions posted by email. If you tell us what it is you want to do somebody can describe the process for you. There are also a ton of

[Tutor] Why is an instance smaller than the sum of its components?

2015-02-03 Thread Jugurtha Hadjar
Hello, I was writing something and thought: Since the class had some 'constants', and multiple instances would be created, I assume that each instance would have its own data. So this would mean duplication of the same constants? If so, I thought why not put the constants in memory once, for

Re: [Tutor] Why is an instance smaller than the sum of its components?

2015-02-03 Thread Danny Yoo
class bar(object): > ... def __init__(self): > ... self.w = 5 > ... self.x = 6 > ... self.y = 7 > ... self.z = 8 > sys.getsizeof(bar()) > 28 > 3 - Why's bar()'s size smaller than the sum of the sizes of 4 integers? But what is the docu

Re: [Tutor] Why is an instance smaller than the sum of its components?

2015-02-03 Thread Emile van Sebille
On 2/3/2015 1:12 PM, Jugurtha Hadjar wrote: Hello, I was writing something and thought: Since the class had some 'constants', and multiple instances would be created, I assume that each instance would have its own data. So this would mean duplication of the same constants? If so, I thought why n

Re: [Tutor] Why is an instance smaller than the sum of its components?

2015-02-03 Thread Danny Yoo
>> >> Summary questions: >> >> 1 - Why are foo's and bar's class sizes the same? (foo's just a nop) > > > i'm not sure on this one. > >> 2 - Why are foo() and bar() the same size, even with bar()'s 4 integers? > > > neither foo() nor bar() return anything explicitly, so both return the > default no

Re: [Tutor] Why is an instance smaller than the sum of its components?

2015-02-03 Thread Zachary Ware
On Tue, Feb 3, 2015 at 3:59 PM, Emile van Sebille wrote: > On 2/3/2015 1:12 PM, Jugurtha Hadjar wrote: >> 2 - Why are foo() and bar() the same size, even with bar()'s 4 integers? > > neither foo() nor bar() return anything explicitly, so both return the > default none This is not correct, foo() a

Re: [Tutor] Why is an instance smaller than the sum of its components?

2015-02-03 Thread Peter Otten
Jugurtha Hadjar wrote: > Hello, > > I was writing something and thought: Since the class had some > 'constants', and multiple instances would be created, I assume that each > instance would have its own data. So this would mean duplication of the > same constants? If so, I thought why not put the

Re: [Tutor] Why is an instance smaller than the sum of its components?

2015-02-03 Thread Jugurtha Hadjar
On 02/03/2015 10:57 PM, Danny Yoo wrote: But what is the documented behavior of sys.getsizeof? Reading... https://docs.python.org/3/library/sys.html#sys.getsizeof Ah ! I was reading this: https://docs.python.org/2/library/sys.html#sys.getsizeof The unlocking phrase: "Only

Re: [Tutor] Why is an instance smaller than the sum of its components?

2015-02-03 Thread Jugurtha Hadjar
On 02/03/2015 11:28 PM, Zachary Ware wrote: For the OP: while this will probably be a nice exercise for learning more about Python's internals, please keep in mind that 9 times out of 10 you won't need to worry about memory usage in Python, especially not before you've proven to yourself that yo

Re: [Tutor] Why is an instance smaller than the sum of its components?

2015-02-03 Thread Steven D'Aprano
On Tue, Feb 03, 2015 at 10:12:09PM +0100, Jugurtha Hadjar wrote: > Hello, > > I was writing something and thought: Since the class had some > 'constants', and multiple instances would be created, I assume that each > instance would have its own data. So this would mean duplication of the > same

Re: [Tutor] Why is an instance smaller than the sum of its components?

2015-02-03 Thread Dave Angel
On 02/03/2015 04:12 PM, Jugurtha Hadjar wrote: Hello, Lots of other good comments, so I'll just remark on one point. >>> class bar(object): ...def __init__(self): ...self.w = 5 ...self.x = 6 ...self.y = 7 ...self.z = 8 If these really are "constants,"

Re: [Tutor] Wondering about a project

2015-02-03 Thread dw
Thanks Alan for the tips!!! I greatly appreciate. :-D Duane -- bw...@fastmail.net ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Wondering about a project

2015-02-03 Thread dw
Thanks Dave A for your Tips!! I greatly appreciate. :-D Duane -- bw...@fastmail.net ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] How can I replicate a list in a for loop

2015-02-03 Thread Suresh Nagulavancha
This is my sample piece of code (not full code of my original code just sample of it) I am using python 2.7 Import itertools var=[1,2,3,4,5] Length=int(raw_input("length of possible numbers required")) #This is for length of 3 chars for i in itertools.product(var,var,var): print i[0]+i[1]+i[

Re: [Tutor] Why is an instance smaller than the sum of its components?

2015-02-03 Thread Jugurtha Hadjar
On 02/03/2015 11:40 PM, Peter Otten wrote: CPython already does this for many common values, e. g. small integers and variable names a = 42 b = 42 a is b True a = 300 b = 300 a is b False The threshold seems to be 256 (last value where it evaluates to True): >>> a = 1 >>> b = 1 >>> sam

Re: [Tutor] How can I replicate a list in a for loop

2015-02-03 Thread Mark Lawrence
On 03/02/2015 22:51, Suresh Nagulavancha wrote: This is my sample piece of code (not full code of my original code just sample of it) I am using python 2.7 Import itertools var=[1,2,3,4,5] Length=int(raw_input("length of possible numbers required")) #This is for length of 3 chars for i in iterto

Re: [Tutor] Why is an instance smaller than the sum of its components?

2015-02-03 Thread Jugurtha Hadjar
On 02/04/2015 12:18 AM, Steven D'Aprano wrote: Not necessarily. Consider: class A(object): spam = 23 def __init__(self): self.eggs = 42 In this case, the "spam" attribute is on the class, not the instance, and so it doesn't matter how many A instances you have, there is onl

Re: [Tutor] Why is an instance smaller than the sum of its components?

2015-02-03 Thread Jugurtha Hadjar
Sorry for the full lines. They were wrapped here but were sent unfolded. It seems I need to "rewrap" on Thunderbird. -- ~Jugurtha Hadjar, ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mail