New tutorials

2012-12-02 Thread Mitya Sirenef
Hi everyone, I'm making a series of python tutorials and I've just finished the introductory part: http://lightbird.net/larks/intro.html Feedback is appreciated.. - mitya http://lightbird.net/larks/intro.html -- http://mail.python.org/mailman/listinfo/python-list

Re: loops

2012-12-02 Thread Mitya Sirenef
On 12/02/2012 04:39 PM, Verde Denim wrote: I'm just getting into py coding, and have come across an oddity in a py book - while loops that don't work as expected... import random MIN = 1 MAX = 6 def main(): again = 'y' while again == 'y': print('Rolling...')

Re: New tutorials

2012-12-03 Thread Mitya Sirenef
While referencing the python tutorial, you should state how your tutorial complement the already existing one, possibly which issues you're trying to fix, or how different your approach is. Cheers, JM Thanks for the feedback, I've added the following line to the Intro section: My

Re: New tutorials

2012-12-03 Thread Mitya Sirenef
On 12/02/2012 09:54 AM, Mitya Sirenef wrote: Hi everyone, I'm making a series of python tutorials and I've just finished the introductory part: http://lightbird.net/larks/intro.html I've just uploaded a new section -- a tictactoe game: http://lightbird.net/larks/tictactoe.html I've also

Re: New tutorials

2012-12-04 Thread Mitya Sirenef
On 12/02/2012 09:54 AM, Mitya Sirenef wrote: Hi everyone, I'm making a series of python tutorials and I've just finished the introductory part: http://lightbird.net/larks/intro.html Feedback is appreciated.. - mitya http://lightbird.net/larks/intro.html I've just added a new section 'blocky

Re: New tutorials

2012-12-06 Thread Mitya Sirenef
On 12/02/2012 09:54 AM, Mitya Sirenef wrote: Hi everyone, I'm making a series of python tutorials and I've just finished the introductory part: http://lightbird.net/larks/intro.html Feedback is appreciated.. - mitya http://lightbird.net/larks/intro.html I've added two more tutorials

Re: New tutorials

2012-12-06 Thread Mitya Sirenef
On 12/06/2012 12:16 PM, Jean-Michel Pichavant wrote: - Original Message - On 12/02/2012 09:54 AM, Mitya Sirenef wrote: Hi everyone, I'm making a series of python tutorials and I've just finished the introductory part: http://lightbird.net/larks/intro.html Feedback

Re: Issue with seeded map generation

2012-12-08 Thread Mitya Sirenef
On 12/08/2012 04:32 PM, Graham Fielding wrote: Hey, all! I've managed to get my project to a semi-playable state (everything functions, if not precisely the way I'd like it to). One small issue is that when the player movs from one level to the next, the items and monsters in the previous

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-11 Thread Mitya Sirenef
On 12/11/2012 05:39 PM, Dave Cinege wrote: On Tuesday 11 December 2012 16:53:12 Ian Kelly wrote: Just out of curiosity, how old are we talking? enumerate was added in Python 2.3, which is nearly 10 years old. Prior to 2.2 I don't think it was even possible to subclass dict, which would

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-11 Thread Mitya Sirenef
On 12/11/2012 07:53 PM, Mitya Sirenef wrote: By the way, the Thesaurus class reminds me of using the old recipe called 'Bunch': http://code.activestate.com/recipes/52308-the-simple-but-handy-collector-of-a-bunch-of-named/ like this: b = Bunch(x=1) b.stuff = Bunch(y=2) b.stuff.y 2 Sorry

Re: Hollow square program

2012-12-12 Thread Mitya Sirenef
On 12/12/2012 11:48 AM, siimnur...@gmail.com wrote: Hey, I need to write a program that prints out a square, which is empty on the inside. So far, I've made a program that outputs a square, which is full on the inside. P.S. Between every asterisk there needs to be a space( ) Here's my code:

Re: unpacking first few items of iterable

2012-12-13 Thread Mitya Sirenef
On 12/13/2012 03:09 PM, Daniel Fetchinson wrote: Hi folks, I swear I used to know this but can't find it anywhere: What's the standard idiom for unpacking the first few items of an iterable whose total length is unknown? Something like a, b, c, _ = myiterable where _ could eat up a variable

Re: unpacking first few items of iterable

2012-12-13 Thread Mitya Sirenef
On 12/13/2012 03:39 PM, Daniel Fetchinson wrote: Hi folks, I swear I used to know this but can't find it anywhere: What's the standard idiom for unpacking the first few items of an iterable whose total length is unknown? Something like a, b, c, _ = myiterable where _ could eat up a variable

Re: Trying to make a basic Python score counter in a game... will not count.

2012-12-16 Thread Mitya Sirenef
On 12/16/2012 12:00 PM, Darrien Glasser wrote: Hey guys, I'm working on a Python rock paper scissors (lizard spock) game, and the beginning is complete. After I finished it, I thought, You know what? I think I can make this even better, and add a score counter. And so I did. The problem is

Re: Trying to make a basic Python score counter in a game... will not count.

2012-12-16 Thread Mitya Sirenef
On 12/16/2012 01:17 PM, tbg wrote: On Sunday, December 16, 2012 1:07:16 PM UTC-5, Mitya Sirenef wrote: On 12/16/2012 12:00 PM, Darrien Glasser wrote: Hey guys, I'm working on a Python rock paper scissors (lizard spock) game, and the beginning is complete. After I finished it, I thought

Re: Trying to make a basic Python score counter in a game... will not count.

2012-12-16 Thread Mitya Sirenef
On 12/16/2012 01:07 PM, Mitya Sirenef wrote: On 12/16/2012 12:00 PM, Darrien Glasser wrote: Hey guys, I'm working on a Python rock paper scissors (lizard spock) game, and the beginning is complete. After I finished it, I thought, You know what? I think I can make this even better, and add

Re: Delete dict and subdict items of some name

2012-12-17 Thread Mitya Sirenef
On 12/17/2012 12:27 PM, Gnarlodious wrote: Hello. What I want to do is delete every dictionary key/value of the name 'Favicon' regardless of depth in subdicts, of which there are many. What is the best way to do it? -- Gnarlie Something like this should work: def delkey(d, key): if

Re: Delete dict and subdict items of some name

2012-12-17 Thread Mitya Sirenef
On 12/17/2012 01:30 PM, Tim Chase wrote: On 12/17/12 11:43, Mitya Sirenef wrote: On 12/17/2012 12:27 PM, Gnarlodious wrote: Hello. What I want to do is delete every dictionary key/value of the name 'Favicon' regardless of depth in subdicts, of which there are many. What is the best way to do

Re: Delete dict and subdict items of some name

2012-12-17 Thread Mitya Sirenef
On 12/17/2012 05:00 PM, Dave Angel wrote: On 12/17/2012 04:33 PM, Mitya Sirenef wrote: On 12/17/2012 01:30 PM, Tim Chase wrote: On 12/17/12 11:43, Mitya Sirenef wrote: On 12/17/2012 12:27 PM, Gnarlodious wrote: Hello. What I want to do is delete every dictionary key/value of the name

Re: help with making my code more efficient

2012-12-20 Thread Mitya Sirenef
On 12/20/2012 08:46 PM, larry.mart...@gmail.com wrote: On Thursday, December 20, 2012 6:17:04 PM UTC-7, Dave Angel wrote: On 12/20/2012 07:19 PM, larry.mart...@gmail.com wrote: I have a list of tuples that contains a tool_id, a time, and a message. I want to select from this list all the

Re: help with making my code more efficient

2012-12-20 Thread Mitya Sirenef
On 12/20/2012 09:39 PM, Mitya Sirenef wrote: On 12/20/2012 08:46 PM, larry.mart...@gmail.com wrote: On Thursday, December 20, 2012 6:17:04 PM UTC-7, Dave Angel wrote: On 12/20/2012 07:19 PM, larry.mart...@gmail.com wrote: I have a list of tuples that contains a tool_id, a time, and a message

Re: Pass and return

2012-12-20 Thread Mitya Sirenef
On 12/21/2012 12:23 AM, iMath wrote: Pass and return Are these two functions the same ? def test(): return def test(): pass I believe they are the same, but these statements have different meanings in other circumstances, e.g.: Class A(object): pass def test(): if x:

Re: Pass and return

2012-12-20 Thread Mitya Sirenef
On 12/21/2012 12:23 AM, iMath wrote: Pass and return Are these two functions the same ? def test(): return def test(): pass From the point of style, of course, the latter is much better because that's the idiomatic way to define a no-op function. With a return, it looks

Re: Pass and return

2012-12-21 Thread Mitya Sirenef
On 12/21/2012 03:52 AM, Duncan Booth wrote: Mitya Sirenef msire...@lightbird.net wrote: On 12/21/2012 12:23 AM, iMath wrote: Pass and return Are these two functions the same ? def test(): return def test(): pass From the point of style, of course, the latter is much

Re: Python, email temperature

2012-12-23 Thread Mitya Sirenef
On 12/23/2012 08:46 AM, KarlE wrote: On Saturday, December 22, 2012 9:36:41 PM UTC+1, KarlE wrote: Hi! Im totally new to Python, and im using it on my Raspberry pi. I found a program that sends an email, and one that checks the temperature of my CPU, but i cant seem to combine the to into

Re: Command Line Progress Bar

2012-12-25 Thread Mitya Sirenef
On 12/26/2012 01:17 AM, Kevin Anthony wrote: Hello, I'm writing a file processing script(Linux), and i would like to have a progress bar. But i would also like to be able to print messages. Is there a simple way of doing this without implementing something like ncurses? -- Thanks Kevin

Re: Can you please help me?

2012-12-26 Thread Mitya Sirenef
On 12/26/2012 04:40 PM, bobflipperdoo...@gmail.com wrote: I really hope you can help! I need to create a program where the user can order any combination and quantity of 3 products. I then offer a 10% discount if the customer correctly answers a trivia question. After that, there are 3

Re: Can you please help me?

2012-12-26 Thread Mitya Sirenef
On 12/26/2012 06:21 PM, bobflipperdoo...@gmail.com wrote: Thank you very much for your reply. I actually just deleted this post as you were replying! I had figured out a few things and then got confused about a few others :/ If you have a chance, can you look at the other post? Thank

Re: Please help if you can!

2012-12-26 Thread Mitya Sirenef
On 12/26/2012 07:04 PM, bobflipperdoo...@gmail.com wrote: First, sorry for starting a new post - I didn't want anyone to have to read through the whole first one when the questions were completely different :/ Second, I honestly have no idea how to answer your questions. I am a sophomore in

Re: Please help if you can!

2012-12-26 Thread Mitya Sirenef
On 12/26/2012 08:00 PM, Chris Angelico wrote: On Thu, Dec 27, 2012 at 11:45 AM, Joshua Landau joshua.landau...@gmail.com wrote: FINALLY: When you use Google Groups, your quotations look to us like this: This is something I said with lots of extra lines in the middle for no reason. Google

Re: Please help if you can!

2012-12-26 Thread Mitya Sirenef
On 12/26/2012 08:23 PM, Chris Angelico wrote: On Thu, Dec 27, 2012 at 12:17 PM, Mitya Sirenef msire...@lightbird.net wrote: I have to agree - I saw that howto as well and it occurred to me that if we have to delete blank lines manually we might as well use postal pigeons with tiny little

Re: How to get time.strptime()?

2012-12-26 Thread Mitya Sirenef
On 12/26/2012 10:09 PM, Gnarlodious wrote: This is problem that has unduly vexed me. When you start learning Python they don't tell you about these sharp edges. Someone needs to explain. -- Gnarlie In fact, if there were no bugs, there would be no need to explain nor to pick the right time

Re: Finding the name of a function while defining it

2012-12-27 Thread Mitya Sirenef
On 12/27/2012 02:45 AM, Abhas Bhattacharya wrote: On Thursday, 27 December 2012 10:22:15 UTC+5:30, Tim Roberts wrote: Abhas Bhattacharya abhasbhattachar...@gmail.com wrote: While I am defining a function, how can I access the name (separately as string as well as object) of the function

Re: Finding the name of a function while defining it

2012-12-27 Thread Mitya Sirenef
On 12/27/2012 03:26 AM, Abhas Bhattacharya wrote: On Thursday, 27 December 2012 13:33:34 UTC+5:30, Mitya Sirenef wrote: How about defining a function that prints value and then calls a function? def call(func_name): print(mydict[func_name]) globals()[func_name]() You could

Re: Wrapping statements in Python in SPSS

2012-12-28 Thread Mitya Sirenef
On 12/28/2012 12:33 PM, alankrin...@gmail.com wrote: I think 396 just comes from the end of the Python loop, without indicating which line in the loop is at issue. Here is the full code from this section of the loop: for ( msr, brk, dmn, src, dspd1, dspd2, dspd3, dspd4, dspd5, dspd6,

Re: Wrapping statements in Python in SPSS

2012-12-28 Thread Mitya Sirenef
On 12/28/2012 12:55 PM, Mitya Sirenef wrote: On 12/28/2012 12:33 PM, alankrin...@gmail.com wrote: I think 396 just comes from the end of the Python loop, without indicating which line in the loop is at issue. Here is the full code from this section of the loop: for ( msr, brk, dmn, src

Re: Wrapping statements in Python in SPSS

2012-12-28 Thread Mitya Sirenef
On 12/28/2012 01:05 PM, Mitya Sirenef wrote: On 12/28/2012 12:55 PM, Mitya Sirenef wrote: On 12/28/2012 12:33 PM, alankrin...@gmail.com wrote: I think 396 just comes from the end of the Python loop, without indicating which line in the loop is at issue. Here is the full code from

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-29 Thread Mitya Sirenef
On 12/29/2012 12:44 PM, Monte Milanuk wrote: Maybe its because I'm still just a hobbyist when it comes to coding, but I spend far more time 'thinking' about what I'm doing than typing things in... so shaving a few seconds here and there are less important to me. I think the general idea is

Re: dict comprehension question.

2012-12-29 Thread Mitya Sirenef
On 12/29/2012 02:48 PM, Quint Rankid wrote: Newbie question. I've googled a little and haven't found the answer. Given a list like: w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] I would like to be able to do the following as a dict comprehension. a = {} for x in w: a[x] = a.get(x,0) + 1 results in a

Re: dict comprehension question.

2012-12-29 Thread Mitya Sirenef
On 12/29/2012 03:01 PM, Mitya Sirenef wrote: On 12/29/2012 02:48 PM, Quint Rankid wrote: Newbie question. I've googled a little and haven't found the answer. Given a list like: w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1] I would like to be able to do the following as a dict comprehension

Re: Facing issue with Python loggin logger for printing object value

2012-12-29 Thread Mitya Sirenef
On 12/29/2012 03:50 PM, Morten Engvoldsen wrote: Hi Dave, It is able to log the message with: logger.debug(value of payment_line is +repr(payment_line)) The output is: value of payment_line is [] So it means payment_line is an empty list, so may be it could be reason it's not able to

Re: dict comprehension question.

2012-12-29 Thread Mitya Sirenef
On 12/29/2012 03:15 PM, Joel Goldstick wrote: On Sat, Dec 29, 2012 at 3:09 PM, Mitya Sirenef msire...@lightbird.net mailto:msire...@lightbird.net wrote: On 12/29/2012 03:01 PM, Mitya Sirenef wrote: On 12/29/2012 02:48 PM, Quint Rankid wrote: Newbie question. I've

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-29 Thread Mitya Sirenef
On 12/29/2012 04:52 PM, Roy Smith wrote: In the big for loop, a couple of lines down, no, not there, the other for loop, yeah, now go down a couple of lines, no that's too far, back up one. Yeah there. On that line, why do you ... with: On line 647, why do you ... It's even better when

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-29 Thread Mitya Sirenef
On 12/29/2012 05:30 PM, Chris Angelico wrote: In the big for loop, a couple of lines down, no, not there, the other for loop, yeah, now go down a couple of lines, no that's too far, back up one. Yeah there. On that line, why do you ... with: On line 647, why do you ... Absolutely! Though

Re: Considering taking a hammer to the computer...

2012-12-31 Thread Mitya Sirenef
On 12/31/2012 06:42 PM, worldsbiggestsabres...@gmail.com wrote: Hey :) I'm trying to help my son with an assignment and spending hours making an inch of progress. I know nothing about programming and I'm trying to learn, on my own, at a rate faster than possible. I would love a little

Re: Considering taking a hammer to the computer...

2012-12-31 Thread Mitya Sirenef
On 12/31/2012 07:29 PM, Mitya Sirenef wrote: Hi! First I want to note that this task would be easier and better to do with a break statement, so it's quite unfortunate that the teacher did not cover the right tools (and very basic ones, in fact) and yet given this task. Another question

Re: Considering taking a hammer to the computer...

2012-12-31 Thread Mitya Sirenef
On 12/31/2012 08:30 PM, worldsbiggestsabres...@gmail.com wrote: Here is what I've learned: 1) There's a bunch of extremely helpful and wonderful people here. 2) There's a bunch of very intelligent people here. 3) I still don't have any idea what I'm doing. 4) It's New Year's Eve and I'm

Re: New to python, do I need an IDE or is vim still good enough?

2013-01-01 Thread Mitya Sirenef
On 12/31/2012 10:46 PM, Steven D'Aprano wrote: On Sat, 29 Dec 2012 14:00:23 -0500, Mitya Sirenef wrote: I think the general idea is that with editors like Vim you don't get distracted by having to do some kind of an editor task, letting you keep your full attention on the code logic

Re: New to python, do I need an IDE or is vim still good enough?

2013-01-01 Thread Mitya Sirenef
On 01/01/2013 02:02 PM, Roy Smith wrote: In article mailman.1528.1357065822.29569.python-l...@python.org, Mitya Sirenef msire...@lightbird.net wrote: Clunky is the last word I'd use to describe it (ok maybe for Emacs :-) I probably remember about 200 commands, plus or minus, but a lot

Re: New to python, do I need an IDE or is vim still good enough?

2013-01-02 Thread Mitya Sirenef
On 01/02/2013 04:33 PM, Michael Torrie wrote: On 01/01/2013 11:43 AM, Mitya Sirenef wrote: Therefore, deleting 3 WORDs is 3daW (mnemonic: del a WORD 3 times). Interesting. I typically use just d3w. 3daW seems to delete 3 lines for me, the same result as d3enter. Another favorite command

Re: New to python, do I need an IDE or is vim still good enough?

2013-01-02 Thread Mitya Sirenef
On 01/02/2013 10:17 PM, Wayne Werner wrote: On Tue, 1 Jan 2013, Mitya Sirenef wrote: On 01/01/2013 02:02 PM, Roy Smith wrote: That's true with Vim, as well, especially when I'm making a custom mapping and I can NEVER remember what some combination does, even though if I actually needed to use

Re: Can't seem to start on this

2013-01-02 Thread Mitya Sirenef
On 01/02/2013 11:32 PM, Kene Meniru wrote: This sounds so simple but being new to python I am finding it hard to get started. I want to create a module which I will call B. There will be other modules called C, D, etc, which will most likely be imported in B. Then I want the user to import

Re: Can't seem to start on this

2013-01-02 Thread Mitya Sirenef
On 01/03/2013 12:32 AM, Kene Meniru wrote: Mitya Sirenef wrote: Where is snap_size from? Where is LinearMark from? You don't need to instantiate LinearMark in B, do it in A. I want to hide as much of the python syntax from the file A so the user just concentrates on using the classes

Re: Can't seem to start on this

2013-01-03 Thread Mitya Sirenef
On 01/03/2013 07:53 AM, Kene Meniru wrote: Mitya Sirenef wrote: So, how many instances do you want to make.. what kind of different functionality / properties they will have? - mitya I am porting a modeling system I created using POV-Ray scene description language available

Re: Can't seem to start on this

2013-01-03 Thread Mitya Sirenef
On 01/03/2013 02:30 PM, Kene Meniru wrote: Mitya Sirenef wrote: I'm not familiar with POV-Ray. I want to note that with python standard style, class names look like this: ClassName, instances look like this: instance_name; it sounds like you want LMark to be an instance? Or you want

Re: Can't seem to start on this

2013-01-03 Thread Mitya Sirenef
On 01/03/2013 07:08 PM, Kene Meniru wrote: LinearSide.put(Dining, (x,y,z)) # moves 'Dining' to x,y,z location The put function of the LinearSide boundary class finds Dining (which is an entity class called LinearSideData) in the dictionary and then allows this LinearSideData class to calculate

Re: Can't seem to start on this

2013-01-03 Thread Mitya Sirenef
On 01/03/2013 07:43 PM, Kene Meniru wrote: Mitya Sirenef wrote: That's what I thought, just wanted to confirm. However, if your objective to make it as easy for the user as possible, is it not easier to bind dining to a name and then do this?: dining.move(x, y, z) Absolutely. I just found

Re: Need a specific sort of string modification. Can someone help?

2013-01-05 Thread Mitya Sirenef
On 01/05/2013 03:35 AM, Sia wrote: I have strings such as: tA.-2AG.-2AG,-2ag or .+3ACG.+5CAACG.+3ACG.+3ACG The plus and minus signs are always followed by a number (say, i). I want python to find each single plus or minus, remove the sign, the number after it and remove i characters

Re: Need a specific sort of string modification. Can someone help?

2013-01-06 Thread Mitya Sirenef
On 01/06/2013 01:32 AM, Mitya Sirenef wrote: On 01/05/2013 03:35 AM, Sia wrote: I have strings such as: tA.-2AG.-2AG,-2ag or .+3ACG.+5CAACG.+3ACG.+3ACG The plus and minus signs are always followed by a number (say, i). I want python to find each single plus or minus, remove the sign

Re: psycopg2 cursor.execute CREATE TABLE issue

2013-01-06 Thread Mitya Sirenef
On Sun 06 Jan 2013 04:38:29 PM EST, andydtay...@gmail.com wrote: Hi all, I'm trying to create a process which will create a new table and populate it. But something is preventing this from working, and I don't know enough to figure it out, despite having spent most of today reading up. The

Re: psycopg2 cursor.execute CREATE TABLE issue

2013-01-06 Thread Mitya Sirenef
On Sun 06 Jan 2013 04:53:32 PM EST, andydtay...@gmail.com wrote: Wow it's as simple as that! I'm afraid my database experience is in Microsoft Access in Windows and not at the command line, so that wasn't intuitive for me. Thanks again, Andy IIRC I made the same mistake when I was using

Re: Best way to do this? List loop (matrix?) iteration

2013-01-08 Thread Mitya Sirenef
On Tue 08 Jan 2013 07:19:59 PM EST, andydtay...@gmail.com wrote: Hi! I might be missing the obvious, or I may have found something more complicated than the VBA I am used to. Could it be I need to use a maths library? For a given list of k items I'd like to turn it into an k*k matrix of item

Re: functon invoke or not

2013-01-09 Thread Mitya Sirenef
On Wed 09 Jan 2013 03:23:56 AM EST, skyworld wrote: Hi, I see someone's code as this: class ABC: def __init__(self, env): ... self.jmpTable['batchQ']['submit_job'] = self.lsf_submit ... def lsf_submit(self, cmd,env): . what

Re: Psycopg2 SyntaxError: invalid syntax on INSERT INTO database

2013-01-09 Thread Mitya Sirenef
On Wed 09 Jan 2013 07:19:10 PM EST, andydtay...@gmail.com wrote: Hi John, He're the code I would like to see work. The cursor_to is an oversight. I extracted this element from some other code in an attempt to isolate/resolve the problem myself, hence having a simplified table version. Which

Re: Psycopg2 SyntaxError: invalid syntax on INSERT INTO database

2013-01-09 Thread Mitya Sirenef
On Wed 09 Jan 2013 09:20:10 PM EST, andydtay...@gmail.com wrote: Thanks for your help guys. I was actually doing a few things wrong, but I have got this script to work by declaring fields as varchar and all values as strings. But I would like to log journey time values in hours/minutes, so I

Re: help

2013-01-11 Thread Mitya Sirenef
On 01/11/2013 09:24 AM, Matt Jones wrote: Pay isn't linked to the people in any way. A dictionary would serve this purpose better (at least in this simple example). database = { 'Mac' : 1000, 'Sam' : 2000 } name = raw_input('Enter your name:') if name in database.keys(): print your

Re: ANN: Python training text movies

2013-01-12 Thread Mitya Sirenef
On 01/13/2013 01:35 AM, Steven D'Aprano wrote: On Sun, 13 Jan 2013 00:11:53 -0500, AK wrote: I don't know what to call these, so for now I'll call them training text movies until I come up with a better name.. I hope these will be helpful, especially to new students of Python.

Re: ANN: Python training text movies

2013-01-12 Thread Mitya Sirenef
On 01/13/2013 02:28 AM, Terry Reedy wrote: On 1/13/2013 2:08 AM, Mitya Sirenef wrote: On 01/13/2013 01:35 AM, Steven D'Aprano wrote: On Sun, 13 Jan 2013 00:11:53 -0500, AK wrote: I don't know what to call these, so for now I'll call them training text movies until I come up

Re: For Loop in List

2013-01-13 Thread Mitya Sirenef
On 01/13/2013 07:45 AM, subhabangal...@gmail.com wrote: Dear Group, I have a list like, list1=[1,2,3,4,5,6,7,8,9,10,11,12] Now, if I want to take a slice of it, I can. It may be done in, list2=list1[:3] print list2 [1, 2, 3] If I want to iterate the list, I may do as, for i in list1:

Re: ANN: Python training text movies

2013-01-13 Thread Mitya Sirenef
On 01/14/2013 01:34 AM, Franck Ditter wrote: In article mailman.469.1358088303.2939.python-l...@python.org, Jason Friedman ja...@powerpull.net wrote: That is right; I would also add that it may be overwhelming for a newbie to be reading through a large wall of text -- here you have blank

Re: Safely add a key to a dict only if it does not already exist?

2013-01-18 Thread Mitya Sirenef
On 01/19/2013 02:27 AM, Vito De Tullio wrote: Chris Rebert wrote: How can I add a key in a thread-safe manner? I'm not entirely sure, but have you investigated dict.setdefault() ? but how setdefault makes sense in this context? It's used to set a default value when you try to retrieve an

Re: Safely add a key to a dict only if it does not already exist?

2013-01-19 Thread Mitya Sirenef
On 01/19/2013 02:35 AM, Mitya Sirenef wrote: On 01/19/2013 02:27 AM, Vito De Tullio wrote: Chris Rebert wrote: How can I add a key in a thread-safe manner? I'm not entirely sure, but have you investigated dict.setdefault() ? but how setdefault makes sense in this context? It's used to set

Re: ANN: Python training text movies

2013-01-19 Thread Mitya Sirenef
On 01/19/2013 04:32 AM, Franck Ditter wrote: In article mailman.488.1358146579.2939.python-l...@python.org, Mitya Sirenef msire...@lightbird.net wrote: On 01/14/2013 01:34 AM, Franck Ditter wrote: In article mailman.469.1358088303.2939.python-l...@python.org, Jason Friedman ja

Re: Any algorithm to preserve whitespaces?

2013-01-19 Thread Mitya Sirenef
On 01/19/2013 05:13 AM, Santosh Kumar wrote: I have a working script which takes argv[1] as an input, deassembles each line, and then each word. Then after it capitalizes all its word (upcases the first letter) and then prints it out on the stdout. That script does the capitalization work fine,

Re: ANN: Python training text movies

2013-01-20 Thread Mitya Sirenef
...@python.org, Mitya Sirenef msire...@lightbird.net wrote: On 01/19/2013 04:32 AM, Franck Ditter wrote: In article mailman.488.1358146579.2939.python-l...@python.org, Mitya Sirenef msire...@lightbird.net wrote: On 01/14/2013 01:34 AM, Franck Ditter wrote: In article mailman.469.1358088303.2939

Re: RE Help splitting CVS data

2013-01-20 Thread Mitya Sirenef
On 01/20/2013 05:04 PM, Garry wrote: I'm trying to manipulate family tree data using Python. I'm using linux and Python 2.7.3 and have data files saved as Linux formatted cvs files The data appears in this format: Marriage,Husband,Wife,Date,Place,Source,Note0x0a Note: the Source field or the

Re: To make a method or attribute private

2013-01-20 Thread Mitya Sirenef
On 01/20/2013 09:24 PM, alex23 wrote: On Jan 21, 9:32 am, Dave Angel d...@davea.name wrote: On 01/20/2013 06:14 PM, alex23 wrote: On Jan 20, 7:23 pm, Chris Angelico ros...@gmail.com wrote: On Sun, Jan 20, 2013 at 8:17 PM, iMath redstone-c...@163.com wrote: so what is your opinion about

Re: Else statement executing when it shouldnt

2013-01-20 Thread Mitya Sirenef
On 01/20/2013 11:40 PM, eli m wrote: an else statement is running when it shouldnt be. It is on the last line. Whenever i am in the math or game function, when i type in main, it goes back to the start of the program, but it also says not a valid function. I am stumped! Here is my code:

Re: Else statement executing when it shouldnt

2013-01-20 Thread Mitya Sirenef
On 01/20/2013 11:59 PM, eli m wrote: Your else is lined up with while, not with if. -m -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ When a friend succeeds, I die a little. Gore Vidal Its lined up. It got messed up when i copied the code into the post. I

Re: ANN: Python training text movies

2013-01-21 Thread Mitya Sirenef
On 01/21/2013 02:30 AM, rusi wrote: On Jan 13, 12:08 pm, Mitya Sirenef msire...@lightbird.net wrote: Sure: they play back a list of instructions on use of string methods and list comprehensions along with demonstration in a mock-up of the interpreter with a different display effect

Re: ANN: Python training text movies

2013-01-21 Thread Mitya Sirenef
On 01/21/2013 03:07 AM, Franck Ditter wrote: Ok I can make my way with jstmovie. Some remarks and questions : - Use encoding='utf-8' inside open of method __init__ of class Tutorial in jstmovie.py. Otherwise foreign languages are stuck. - To use the software outside Python, we need to

Re: ANN: Python training text movies

2013-01-21 Thread Mitya Sirenef
On 01/21/2013 03:07 AM, Franck Ditter wrote: Ok I can make my way with jstmovie. Some remarks and questions : - Use encoding='utf-8' inside open of method __init__ of class Tutorial in jstmovie.py. Otherwise foreign languages are stuck. Thanks, will fix this.. -m -- Lark's Tongue Guide

Re: ANN: Python training text movies

2013-01-21 Thread Mitya Sirenef
On 01/21/2013 06:30 AM, Franck Ditter wrote: In article mailman.731.1358757093.2939.python-l...@python.org, Mitya Sirenef msire...@lightbird.net wrote: - To use the software outside Python, we need to have proper indentation as real spaces. We should be able to distinguish Arial type

Re: Using filepath method to identify an .html page

2013-01-22 Thread Mitya Sirenef
On 01/22/2013 12:33 PM, rusi wrote: On Jan 22, 8:59 pm, Ferrous Cranus nikos.gr...@gmail.com wrote: I just need a way to CONVERT a string(absolute path) to a 4-digit unique number with INT!!! That's all i want!! But i cannot make it work :( I just need a way to eat my soup with a

Re: Formatting a column's value output

2013-01-27 Thread Mitya Sirenef
On 01/27/2013 03:24 PM, Κώστας Παπαδόπουλος wrote: Τη Κυριακή, 27 Ιανουαρίου 2013 9:12:16 μ.μ. UTC+2, ο χρήστης ru...@yahoo.com έγραψε: python code Yes indeed, there is no need to use a loop since i know the exact number of items i'am expecting. Thanks you very much for clarifying this

Re: what is the difference between commenting and uncommenting the __init__ method in this class?

2013-01-28 Thread Mitya Sirenef
On 01/28/2013 09:09 PM, iMath wrote: what is the difference between commenting and uncommenting the __init__ method in this class? class CounterList(list): counter = 0 ## def __init__(self, *args): ## super(CounterList, self).__init__(*args) def __getitem__(self, index):

Re: Please provide a better explanation of tuples and dictionaries

2013-01-29 Thread Mitya Sirenef
On 01/29/2013 09:55 PM, Daniel W. Rouse Jr. wrote: Hi all, I have recently started learning Python (2.7.3) but need a better explanation of how to use tuples and dictionaries. I am currently using Learning Python by Mark Lutz and David Ascher, published by O'Reilly (ISBN

Re: Multiple ways to access attributes

2013-02-10 Thread Mitya Sirenef
On 02/10/2013 05:44 PM, ISE Development wrote: Is it considered acceptable practice (e.g. not confusing, not surprising or not Pythonic) to allow multiple ways to access the same attributes? For example, supposing I am providing access to external devices, that these parameters may vary

Re: Small program ideas

2013-02-15 Thread Mitya Sirenef
On 02/15/2013 10:22 PM, eli m wrote: Any small program ideas? I would prefer to stick to command line ones. Thanks. How about these two: - simulation of a street crossing with green/red lights allowing cars and pedestrians to pass in one direction then another - simulation of an elevator

Re: Small program ideas

2013-02-15 Thread Mitya Sirenef
On 02/15/2013 10:57 PM, eli m wrote: On Friday, February 15, 2013 7:52:57 PM UTC-8, Mitya Sirenef wrote: On 02/15/2013 10:22 PM, eli m wrote: Any small program ideas? I would prefer to stick to command line ones. Thanks. How about these two: - simulation of a street crossing

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Mitya Sirenef
On 02/18/2013 07:52 PM, Jon Reyes wrote: So I have a dictionary and the key is a number. The values are either a single tuple or a tuple of tuples. Is there a better way to go about accessing the values of the dictionary? All the tuples contain four elements. So say: col = {1: (0,1,2,3):

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Mitya Sirenef
On 02/18/2013 08:38 PM, Jon Reyes wrote: Hi Mark. Well, doesn't iteritems() work the same? or am I missing something? By the way I'm sure I read the dictionaries part of Python but I'm unsure if it would take int's as a key for dictionaries. I've been weaned on Java where the keys of hashmaps

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Mitya Sirenef
On 02/18/2013 09:17 PM, Jon Reyes wrote: Thanks Dave and Mitya for enlightening me about dictionaries. I'm still confused about this though: so that if two key objects are equal, they stay equal, and if they differ, they stay different. What does this mean? I won't be comparing key

Re: Dictionaries with tuples or tuples of tuples

2013-02-18 Thread Mitya Sirenef
On 02/18/2013 10:14 PM, Dave Angel wrote: On 02/18/2013 09:54 PM, Mitya Sirenef wrote: On 02/18/2013 09:17 PM, Jon Reyes wrote: Thanks Dave and Mitya for enlightening me about dictionaries. I'm still confused about this though: so that if two key objects are equal, they stay equal

Re: Python Newbie

2013-02-21 Thread Mitya Sirenef
On 02/21/2013 04:26 PM, Piterrr wrote: Hi folks. I am a long time C sharp dev, just learning Python now due to job requirements. My initial impression is that Python has got to be the most ambiguous and vague language I have seen to date. I have major issues with the fact that white space

Re: Python Newbie

2013-02-22 Thread Mitya Sirenef
On 02/22/2013 06:58 AM, Rui Maciel wrote: Mitya Sirenef wrote: Looks very unclear and confusing to me. Whether it's C# or ruby or anything else, most devs don't indent like that; The Go programming language makes that style mandatory. Rui Maciel I was referring to different

Re: Python Newbie

2013-02-22 Thread Mitya Sirenef
On 02/22/2013 04:37 PM, piterrr.dolin...@gmail.com wrote: Thanks to everyone for all the posts, some friendly some not. I read all of them with genuine interest. So I am continuing to learn Python, here are my new observations for your consideration. There seems to be a heated argument

Re: Python Newbie

2013-02-22 Thread Mitya Sirenef
On 02/22/2013 09:18 PM, Chris Angelico wrote: On Sat, Feb 23, 2013 at 1:02 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 22 Feb 2013 20:47:20 -0500, Mitya Sirenef wrote: It's been used for many important projects by a huge number of big companies: http

Re: intX.__str__() ??

2013-02-24 Thread Mitya Sirenef
On 02/24/2013 12:29 PM, Michael Torrie wrote: I think he's maintaining existing code. It's unfortunate that his first exposure to python is code written by someone else in such a poor style, and in a way that definitely isn't pythonic. No wonder he's struggling to like python! Though I'm

Re: intX.__str__() ??

2013-02-24 Thread Mitya Sirenef
On 02/24/2013 01:23 PM, Steven D'Aprano wrote: On Sun, 24 Feb 2013 13:09:56 -0500, Mitya Sirenef wrote: On 02/24/2013 12:29 PM, Michael Torrie wrote: Another way to explain the double underscore methods is that they are how things like operator overloading is performed. Want to make

  1   2   >