Re: Beginner question

2013-06-04 Thread Mitya Sirenef
On 06/04/2013 07:53 AM, Carlos Nepomuceno wrote: On 4 Jun 2013 12:28, Carlos Nepomuceno carlosnepomuc...@outlook.com wrote: [...] What's going on? Is there a way to make dict() to resolve the variables? Well yes. dict(**{a:0,b:1}) The dict() constructor makes a dictionary from keyword

Re: howto remove the thousand separator

2013-04-14 Thread Mitya Sirenef
On 04/14/2013 02:57 PM, pyth0n3r wrote: Hi, I came across a problem that when i deal with int data with ',' as thousand separator, such as 12,916, i can not change it into int() or float(). How can i remove the comma in int data? Any reply will be appreciated!! Best, Chen I would do

Re: Functional vs. Object oriented API

2013-04-12 Thread Mitya Sirenef
On 04/12/2013 10:19 AM, Roy Smith wrote: As part of our initial interview screen, we give applicants some small coding problems to do. One of the things we see a lot is what you could call Java code smell. This is our clue that the person is really a Java hacker at heart who just dabbles in

Re: Typing letters slowly using sys

2013-04-05 Thread Mitya Sirenef
On 04/05/2013 10:04 AM, mattgrav...@gmail.com wrote: I am using sys to give the effect that I am typing letters slowly. Basically what I want to have happen is have it show Loading.. with the word loading appearing instantly and then the periods appearing slowly, as most loading screens

Re: In defence of 80-char lines

2013-04-04 Thread Mitya Sirenef
On 04/03/2013 09:36 PM, Steven D'Aprano wrote: Although PEP 8 is only compulsory for the Python standard library, many users like to stick to PEP 8 for external projects. http://www.python.org/dev/peps/pep-0008/ With perhaps one glaring exception: many people hate, or ignore, PEP 8's

Re: In defence of 80-char lines

2013-04-03 Thread Mitya Sirenef
On 04/03/2013 09:59 PM, Andrew Berg wrote: While I agree that not having a line take up hundreds of characters is a good thing, 80 is really arbitrary in 2013 and having any self-imposed hard limit is silly. When you put a single 4- or 5-character word on a new line because you don't want

Re: Doing both regex match and assignment within a If loop?

2013-03-29 Thread Mitya Sirenef
On 03/29/2013 04:27 AM, Peter Otten wrote: (2) import re class Matcher: def __call__(self, expr, line): result = self.match = expr.match(line) return result def __getattr__(self, name): return getattr(self.match, name) Perhaps it's a little simpler to

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Mitya Sirenef
On 03/27/2013 05:10 AM, Michael Herrmann wrote: At the very least, for small dialogs it's sipmpler to do: with press(CTRL + 's'): write(test.txt, into=File name) click(Save) I think what the context manager approach really has going for itself is the syntactic structure it

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Mitya Sirenef
On 03/26/2013 05:38 AM, Michael Herrmann wrote: On Tuesday, March 26, 2013 12:40:45 AM UTC+1, Mitya Sirenef wrote: ... I think I would prefer context managers. I don't think it's a big problem for win users because this behaviour would be one of the first things documented in the start

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Mitya Sirenef
On 03/26/2013 10:59 AM, Michael Herrmann wrote: On Tuesday, March 26, 2013 2:41:38 PM UTC+1, Mitya Sirenef wrote: ... At the __exit__, further commands are no longer routed to that window; if it was a nested context, window is switched to the outer context, WHEN there are commands

Re: Help me pick an API design (OO vs functional)

2013-03-25 Thread Mitya Sirenef
On 03/25/2013 03:29 PM, Michael Herrmann wrote: Hello everyone, my name is Michael, I'm the lead developer of a Python GUI automation library for Windows called Automa: http://www.getautoma.com. We want to add some features to our library but are unsure how to best expose them via our API. It

Re: What am I doing wrong in this simple tkinter example?

2013-03-16 Thread Mitya Sirenef
On 03/16/2013 10:53 AM, Yves S. Garret wrote: Hi all, I'm well into Python Programming for the Absolute Beginner in order to become more acquainted with the language. However, when I got to page 304 and did my first example: http://bin.cakephp.org/view/1107093008 And this is the error

Re: What am I doing wrong in this simple tkinter example?

2013-03-16 Thread Mitya Sirenef
On 03/16/2013 11:16 AM, Yves S. Garret wrote: On Saturday, March 16, 2013 11:10:07 AM UTC-4, Mitya Sirenef wrote: On 03/16/2013 10:53 AM, Yves S. Garret wrote: Hi all, I'm well into Python Programming for the Absolute Beginner in order to become more acquainted with the language

Re: Switch statement

2013-03-10 Thread Mitya Sirenef
On 03/10/2013 10:16 AM, Joseph L. Casale wrote: I have a switch statement composed using a dict: switch = { 'a': func_a, 'b': func_b, 'c': func_c } switch.get(var, default)() As a result of multiple functions per choice, it migrated to: switch = { 'a': (func_a1, func_a2), 'b':

Re: suggestions for improving code fragment please

2013-02-28 Thread Mitya Sirenef
On 02/28/2013 02:47 PM, The Night Tripper wrote: Hi there I'm being very dumb ... how can I simplify this fragment? if arglist: arglist.pop(0) if arglist: self.myparm1 = arglist.pop(0) if arglist: self.myparm2 = arglist.pop(0) if arglist: self.myparm3 = arglist.pop(0) if arglist:

Re: Store a variable permanently

2013-02-28 Thread Mitya Sirenef
On 02/28/2013 10:35 PM, eli m wrote: So i have a variable called funds that i want to store the value of even after the program is exited. My funds variable holds the total value of funds i have. I add a certain number of funds each time i run the program by entering how much i want to add.

Re: Do you feel bad because of the Python docs?

2013-02-27 Thread Mitya Sirenef
On 02/27/2013 08:22 AM, Antoine Pitrou wrote: Mitya Sirenef msirenef at lightbird.net writes: I think the issue with python documentation is that it ignores the 95/5 rule: 95% of people who land on a module's page are only looking for 5% of its information. The 95/5 rule is generally

Re: Do you feel bad because of the Python docs?

2013-02-26 Thread Mitya Sirenef
On 02/26/2013 07:54 AM, Steven D'Aprano wrote: One week ago, JoePie91 wrote a blog post challenging the Python community and the state of Python documentation, titled: The Python documentation is bad, and you should feel bad.

Re: Do you feel bad because of the Python docs?

2013-02-26 Thread Mitya Sirenef
Subject: Re: Do you feel bad because of the Python docs? To: python-list@python.org Cc:Bcc: -=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=- On 02/26/2013 09:00 PM, Terry Reedy wrote: On 2/26/2013 1:58 PM, Mitya Sirenef wrote: I think the issue with python

Re: Do you feel bad because of the Python docs?

2013-02-26 Thread Mitya Sirenef
On 02/26/2013 10:09 PM, Mitya Sirenef wrote: (As a side note, I think it would be better if sections in datetime were in separate pages, it would be easier to google and the navbar on the left side is very crowded and rather hard to read - often I find myself missing stuff that's

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

Re: Python Newbie

2013-02-24 Thread Mitya Sirenef
On 02/24/2013 02:40 PM, piterrr.dolin...@gmail.com wrote: if (some statement): # short form rather than if (some statement == true): # long form What all those ugly brackets are for? Mark, Back in the day when C was king, or take many newer long established languages (C#, Java),

Re: Python Newbie

2013-02-24 Thread Mitya Sirenef
On 02/24/2013 04:44 PM, Chris Angelico wrote: On Mon, Feb 25, 2013 at 8:08 AM, Roy Smith r...@panix.com wrote: In article mailman.2438.1361739512.2939.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: no need to remember what's an object and what's not -- everything is an

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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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?

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: 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: 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: 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: 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: 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: 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: 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

  1   2   >