[Tutor] video watermark

2010-06-04 Thread Igor Nemilentsev
Hi everyone. Can someone suggest a python module so that it would be able to do a video processing and adding watermark in video? -- "If it's not loud, it doesn't work!" -- Blank Reg, from "Max Headroom" ___ Tutor maillist - Tutor@python.org To unsub

Re: [Tutor] Misc question about scoping

2010-06-04 Thread Alan Gauld
"Steven D'Aprano" wrote isThumbnail = True if size == "thumbnail" else False That is technically correct, you could do that. That's a good example of the syntax of the `if` expression, but it's a bad example of where to use it: In the sense that an equality test will always give a real b

Re: [Tutor] sockets, servers, clients, broadcasts...?

2010-06-04 Thread spir
On Thu, 3 Jun 2010 18:03:34 -0400 Alex Hall wrote: > Hi all, > I am a CS major, so I have had the required networking class. I get > the principles of networking, sockets, and packets, but I have never > had to actually implement any such principles in any program. Now I > have this Battleship ga

[Tutor] BerkeleyTIP Join June Global Free SW HW Culture Mtgs via VOIP or in Berkeley

2010-06-04 Thread giovanni_re
Hi Python Tutor people :) Who leads this group? I put together a global meeting (via voip) that 1) has an interest in Python, 2) and that Python learners, users & developers might be interested in. BerkeleyTIP is a meeting about All Free SW HW & Culture. It is Educational, Productive, & Socia

Re: [Tutor] Misc question about scoping

2010-06-04 Thread Dave Angel
Alan Gauld wrote: flag = True if (smoeValue or another) else False is different to flag = someValue or another Which was why I thought it worth pointing out that the if/else could be used. I'd prefer the form: flag = not not (someValue or another) if I needed real True or False resul

Re: [Tutor] Misc question about scoping

2010-06-04 Thread Tino Dai
> That is technically correct, you could do that. That's a good example of > the syntax of the `if` expression, but it's a bad example of where to > use it: > > (1) it only works in Python 2.5 or better; and > > (2) experienced Python programmers will laugh at you :) > > with all due respect to Ala

Re: [Tutor] Misc question about scoping

2010-06-04 Thread Hugo Arts
On Fri, Jun 4, 2010 at 1:23 PM, Dave Angel wrote: > > I'd prefer the form: > >  flag = not not (someValue or another) > That's a construct you might commonly find in languages like C, but I don't think it's very pythonic. If you want to convert your result to a bool, be explicit about it: flag =

Re: [Tutor] Misc question about scoping

2010-06-04 Thread Hugo Arts
On Fri, Jun 4, 2010 at 2:46 PM, Tino Dai wrote: > >     I'm at a point where I can do most things in Python (maybe) , > now I'm looking to do them succinctly and elegantly. For instance, I > had about 10 - 15 lines of code to do this before with a bunch of > loops and if blocks, I distilled th

Re: [Tutor] video watermark

2010-06-04 Thread Jan Jansen
Am 04.06.2010 09:21, schrieb Igor Nemilentsev: Hi everyone. Can someone suggest a python module so that it would be able to do a video processing and adding watermark in video? Once I had to blur the part of the viewing area of a screencast which showed some confident CAD model. First, I ex

Re: [Tutor] Misc question about scoping

2010-06-04 Thread Tino Dai
> I have a distinct feeling that you would simply love a language like lisp. LOL, it's actually on the list of things to do. And hear that one will become a better programmer once they learn LISP. > The code is succinct, and it may very well be called elegant in some > sense of the word. I might

Re: [Tutor] Misc question about scoping

2010-06-04 Thread Emile van Sebille
On 6/4/2010 5:46 AM Tino Dai said... I'm at a point where I can do most things in Python (maybe) , now I'm looking to do them succinctly and elegantly. For instance, I had about 10 - 15 lines of code to do this before with a bunch of loops and if blocks, I distilled the product down to t

[Tutor] treeTraversal, nested return?

2010-06-04 Thread jjcrump
All, any observations might be helpful. For the display of database contents I have the following problem: Database querys will return data to me in tuples of the following sort: each tuple has a unique id, a parent id, and a type. a parent id of 0 indicates that the element has no parent. no

Re: [Tutor] From SQL Blobs to Python Buffers to Actual Files

2010-06-04 Thread GoodPotatoes
When I write the blob/binary data to a file and give it its original file name "customer1.rtf", I am expecting the application to read the binary data into text,excel,word documents, or whatever application created the file originally. Example: when I write blob1 to customer1.rtf, I get "xÚµVKs

Re: [Tutor] treeTraversal, nested return?

2010-06-04 Thread Matthew Wood
In general, there's 2 solutions to your "unflattening" problem. A) The general solution: Keep track of the depth you're at, and add tabs/spaces ('\t' * depth) as necessary. B) The xml solution: Use (for example) the dom.minidom module, and create a new "ul node" and populate it with children, at

Re: [Tutor] sockets, servers, clients, broadcasts...?

2010-06-04 Thread Alex Hall
Thanks for the suggestions, everyone. For now, more as a way to introduce myself to all this, I am going to have my program automatically start a server and pop up that server's ip. Then, if you want, you can type in an ip and connect to the server at that ip (ports are hard-coded at ). That wa

Re: [Tutor] Misc question about scoping

2010-06-04 Thread ALAN GAULD
> > flag = True if (someValue or another) else False > > > I'd prefer the form: > >flag = not not (someValue or another) Eek! no I'd just cast to a bool: flag = bool(someValue or another) but the if/else form has the Pythonic virtue of explicitness. Alan G. __

Re: [Tutor] Misc question about scoping

2010-06-04 Thread Hugo Arts
On 4 jun 2010, at 21:02, ALAN GAULD wrote: Eek! no I'd just cast to a bool: flag = bool(someValue or another) but the if/else form has the Pythonic virtue of explicitness. Are you arguing that the if/else form is better than simply casting to bool because it is more explicit? You could ha

Re: [Tutor] sockets, servers, clients, broadcasts...?

2010-06-04 Thread Alan Gauld
"Alex Hall" wrote connect to you as a client. It appears, though, that I need a loop to have a server make any sense at all, to handle incoming data and connection requests. You need to listen then process incoming messages then listen some more, so yes you will need a loop. Probaqbly an i

Re: [Tutor] Misc question about scoping

2010-06-04 Thread ALAN GAULD
> Are you arguing that the if/else form is better than simply casting > to bool because it is more explicit? No, I'm simply offering a reason to use if/else in the general sense. In practice, for this specific case, I'd go with the bool(expr) form. Alan Gauld Author of the Learn To Program we

Re: [Tutor] Misc question about scoping

2010-06-04 Thread Hugo Arts
On Fri, Jun 4, 2010 at 10:02 PM, ALAN GAULD wrote: > > No, I'm simply offering a reason to use if/else in the general sense. > > In practice, for this specific case, I'd go with the bool(expr) form. > Ah, then it seems we are in agreement. Sorry for the misunderstanding __

Re: [Tutor] Misc question about scoping

2010-06-04 Thread Dave Angel
Hugo Arts wrote: On Fri, Jun 4, 2010 at 1:23 PM, Dave Angel wrote: I'd prefer the form: flag =ot not (someValue or another) That's a construct you might commonly find in languages like C, but I don't think it's very pythonic. If you want to convert your result to a bool, be explici

Re: [Tutor] Misc question about scoping

2010-06-04 Thread Hugo Arts
On Fri, Jun 4, 2010 at 6:26 PM, Tino Dai wrote: > > LOL, it's actually on the list of things to do. And hear that one will become > a > better programmer once they learn LISP. > I most certainly did. There are very few languages as conceptually pure as this one. If you ever get it on the top of

Re: [Tutor] Misc question about scoping

2010-06-04 Thread spir
On Fri, 4 Jun 2010 12:26:20 -0400 Tino Dai wrote: > Also could you give me some instances > where a generator > would be used in a real situation? I have already read the stuff on > doc.python.org about > generators. Sure, generally speaking in the programming world, documentation misses the fi

Re: [Tutor] treeTraversal, nested return?

2010-06-04 Thread spir
On Fri, 4 Jun 2010 10:15:26 -0700 (PDT) jjcr...@uw.edu wrote: > All, > > any observations might be helpful. For the display of database contents I > have the following problem: > > Database querys will return data to me in tuples of the following sort: > each tuple has a unique id, a parent id,

Re: [Tutor] sockets, servers, clients, broadcasts...?

2010-06-04 Thread Alex Hall
On 6/4/10, Alan Gauld wrote: > > "Alex Hall" wrote > >> connect to you as a client. It appears, though, that I need a loop >> to >> have a server make any sense at all, to handle incoming data and >> connection requests. > > You need to listen then process incoming messages then listen some > mor

Re: [Tutor] From SQL Blobs to Python Buffers to Actual Files

2010-06-04 Thread Steven D'Aprano
On Sat, 5 Jun 2010 03:51:02 am GoodPotatoes wrote: > When I write the blob/binary data to a file and give it its original > file name "customer1.rtf", I am expecting the application to read the > binary data into text,excel,word documents, or whatever application > created the file originally. > >

Re: [Tutor] sockets, servers, clients, broadcasts...?

2010-06-04 Thread ALAN GAULD
> Look at the example in my tutorial. It doesn't use threads but What is the link for the tutorial? In my sig. Go to the V2 version and look for the Network Programming topic. > what is a context? I dealt with them a lot in Android programming Nothing to do with Android contexts I'm simply u

Re: [Tutor] Misc question about scoping

2010-06-04 Thread Alan Gauld
"Hugo Arts" wrote [1] http://mitpress.mit.edu/sicp/ [2] http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/ And I'd add the superb How to Design Programs: http://www.htdp.org/ It teaches Scheme programming using a recipe approach that creates a standard stricture for

Re: [Tutor] treeTraversal, nested return?

2010-06-04 Thread jjcrump
Matthew, sorry for responding to you instead of the list Thanks for trying to tutor the dunderheaded. It is exactly the general solution I wish to learn. But how, in the context of my treeTraversal function, does one "keep track of the depth you're at"? Tabs are all very well, but what I want

[Tutor] Lisphon

2010-06-04 Thread spir
On Fri, 4 Jun 2010 22:33:19 +0200 Hugo Arts wrote: > On Fri, Jun 4, 2010 at 6:26 PM, Tino Dai wrote: > > > > LOL, it's actually on the list of things to do. And hear that one will > > become a > > better programmer once they learn LISP. > > > > I most certainly did. There are very few language