Re: Python 3: dict & dict.keys()

2013-07-23 Thread Peter Otten
Ethan Furman wrote: > So, my question boils down to: in Python 3 how is dict.keys() different > from dict? What are the use cases? I just grepped through /usr/lib/python3, and could not identify a single line where some_object.keys() wasn't either wrapped in a list (or set, sorted, max) call,

Re: Converting a list of lists to a single list

2013-07-23 Thread Chris Angelico
On Wed, Jul 24, 2013 at 8:34 AM, Rafael Durán Castañeda wrote: > In [3]: [ y for y in itertools.chain.from_iterable(x)] > Out[3]: ['A0', 'A1', 'A2', 'B0', 'B1', 'B2', 'C0', 'C1', 'C2'] Complete aside, given that this has already been pointed out as solving a different problem: Any time you see a

Re: how: embed + extend to control my running app?

2013-07-23 Thread David M. Cotter
i'm targeting Mac and Windows. Let's skip the thing about "it should work when my app isn't running", just assume it's going to be embedded, no pipes or sockets necessary. For Mac, I understand i need to "create" (?) a python.dylib, but i find no directions for that at the expected location:

Re: Python 3: dict & dict.keys()

2013-07-23 Thread Steven D'Aprano
On Tue, 23 Jul 2013 18:16:08 -0700, Ethan Furman wrote: > Back in Python 2.x days I had a good grip on dict and dict.keys(), and > when to use one or the other. > > Then Python 3 came on the scene with these things called 'views', and > while range couldn't be bothered, dict jumped up and down sh

Re: non sequitur: [OT] SPF - was Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Steven D'Aprano
On Tue, 23 Jul 2013 19:59:01 -0400, Dennis Lee Bieber wrote: > {Liaden culture seems heavy on personal honor, and comments tend (to me) > be worded to avoid any chance of being interpreted as disparaging of the > person with whom one is speaking... Hmmm, pity such modes can't be > enforced on the

Python 3: dict & dict.keys()

2013-07-23 Thread Ethan Furman
Back in Python 2.x days I had a good grip on dict and dict.keys(), and when to use one or the other. Then Python 3 came on the scene with these things called 'views', and while range couldn't be bothered, dict jumped up and down shouting, "I want some!" So now, in Python 3, .keys(), .values()

Re: Converting a list of lists to a single list

2013-07-23 Thread Terry Reedy
On 7/23/2013 5:52 PM, st...@divillo.com wrote: I think that itertools may be able to do what I want but I have not been able to figure out how. A recursive generator suffices. I want to convert an arbitrary number of lists with an arbitrary number of elements in each list into a single list a

Re: Converting a list of lists to a single list

2013-07-23 Thread Zero Piraeus
: On 23 July 2013 17:52, wrote: > > Say I have three lists: > > [[A0,A1,A2], [B0,B1,B2] [C0,C1,C2]] > > I would like to convert those to a single list that looks like this: > [A0,B0,C0,C1,C2,B1,C0,C1,C2,B2,C0,C1,C2,A1,B0,C0,C1,C2,B1,C0,C1,C2,B2,C0,C1,C2,A2,B0,C0,C1,C2,B1,C0,C1,C2,B2,C0,C1,C2] H

Re: Converting a list of lists to a single list

2013-07-23 Thread MRAB
On 23/07/2013 22:52, st...@divillo.com wrote: I think that itertools may be able to do what I want but I have not been able to figure out how. I want to convert an arbitrary number of lists with an arbitrary number of elements in each list into a single list as follows. Say I have three lists

Re: Python testing tools

2013-07-23 Thread Ben Finney
cutems93 writes: > On Saturday, July 20, 2013 1:11:12 AM UTC-7, Ben Finney wrote: > > You will find these discussed at the Python Testing Tools Taxonomy > > http://wiki.python.org/moin/PythonTestingToolsTaxonomy>. > > > > Hope that helps. > > Thank you, but I already read this page before I post

Re: Converting a list of lists to a single list

2013-07-23 Thread Rafael Durán Castañeda
El 23/07/13 23:52, st...@divillo.com escribió: [[A0,A1,A2], [B0,B1,B2] [C0,C1,C2]] Hi, I think you are looking for itertools.chain, or in this case, itertools.chain.from_iterable: In [1]: x = [['A0','A1','A2'], ['B0','B1','B2'], ['C0','C1','C2']] In [2]: import itertools In [3]: [ y for y

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Gilles
On Mon, 22 Jul 2013 10:14:15 -0400, Kevin Walzer wrote: >http://www.hmailserver.com Thanks. hMailServer was one of the apps I checked, and I was just making sure there weren't something simpler, considering my needs, ideally something like Mongoose MTA. Regardless, because of the SPAM anti-measu

Converting a list of lists to a single list

2013-07-23 Thread steve
I think that itertools may be able to do what I want but I have not been able to figure out how. I want to convert an arbitrary number of lists with an arbitrary number of elements in each list into a single list as follows. Say I have three lists: [[A0,A1,A2], [B0,B1,B2] [C0,C1,C2]] I would

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Gilles
On Mon, 22 Jul 2013 08:10:10 -0600, Michael Torrie wrote: >Where did you look? Here's one I found. It's not the real sendmail >program, but it implements the interface which is all you need: > >http://glob.com.au/sendmail/ > >I just googled for sendmail win32 Thanks, but I need an MTA, not just

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Gilles
On Mon, 22 Jul 2013 08:54:11 -0400, "Eric S. Johansson" wrote: >try http://emailrelay.sourceforge.net/ Thanks. I did find it, but it says it's not a full MTA: "E-MailRelay is not a routing MTA. It forwards e-mail to a pre-configured SMTP server, regardless of any message addressing or DNS redire

Re: [OT] SPF - was Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Chris Angelico
On Wed, Jul 24, 2013 at 1:12 AM, Michael Torrie wrote: > On 07/23/2013 03:30 AM, Chris Angelico wrote: >> On Tue, Jul 23, 2013 at 7:19 PM, Chris Angelico wrote: >>> Ah, there's a solution to this one. You simply use your own >>> envelope-from address; SPF shouldn't be being checked for the From:

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Chris Angelico
On Tue, Jul 23, 2013 at 8:06 PM, Duncan Booth wrote: > Excellent idea, I'll tell the email forwarding service to rewrite their > system immediately. Yes. If they are using your domain in the MAIL FROM command and not using your mail servers, then yes, you should tell them, and use a different ser

Re: Python testing tools

2013-07-23 Thread Skip Montanaro
> Could you please elaborate on the difference of the two? I heard pylint > does not import your source code when it is analyzing, while pychecker does. > Does that make some difference? Moreover, do you personally like pylint or > pycheker and why? I haven't followed pychecker development for awh

Re: Python testing tools

2013-07-23 Thread cutems93
On Tuesday, July 23, 2013 11:33:10 AM UTC-7, Skip Montanaro wrote: > > Thank you! What tool do you use for coverage? > > > > coverage. :-) > > > > > And have you used pychecker? > > > > Yes, in fact, I used to use a wrapper script I wrote that ran both > > pylint and pychecker, then massa

Re: Python testing tools

2013-07-23 Thread Skip Montanaro
> Thank you! What tool do you use for coverage? coverage. :-) > And have you used pychecker? Yes, in fact, I used to use a wrapper script I wrote that ran both pylint and pychecker, then massaged the output into suitable-for-emacs-next-error-command > I heard it is as good as pylint. What do yo

Re: Python testing tools

2013-07-23 Thread cutems93
On Tuesday, July 23, 2013 11:04:23 AM UTC-7, Skip Montanaro wrote: > > Thank you, but I already read this page before I posted this question. What > > I want to > > > know is whether you personally use these tools other than unit testing > > tools. > > > > I tried using one of the mock tools

Re: Python testing tools

2013-07-23 Thread Skip Montanaro
> Thank you, but I already read this page before I posted this question. What I > want to > know is whether you personally use these tools other than unit testing tools. I tried using one of the mock tools a few years ago. I found it didn't fit my brain very well. (Maybe it was just me.) I use

Re: Python testing tools

2013-07-23 Thread cutems93
On Saturday, July 20, 2013 1:11:12 AM UTC-7, Ben Finney wrote: > cutems93 writes: > > > > > I am currently doing some research on testing software for Python. I > > > found that there are many different types of testing tools. These are > > > what I've found. > > > > You will find these di

Re: Strange behaviour with os.linesep

2013-07-23 Thread Steven D'Aprano
On Tue, 23 Jul 2013 13:42:13 +0200, Vincent Vande Vyvre wrote: > On Windows a script where de endline are the system line sep, the files > are open with a double line in Eric4, Notepad++ or Gedit but they are > correctly displayed in the MS Bloc-Notes. I suspect the problem lies with Eric4, Notep

Re: Beginner. 2d rotation gives unexpected results.

2013-07-23 Thread Nobody
On Tue, 23 Jul 2013 15:11:43 +0200, Peter Otten wrote: > The conversion to int introduces a rounding error that accumulates over > time. Most floating point calculations introduce a rounding error. If the calculations are iterated, the error will accumulate. In general, you want to avoid accumu

[OT] SPF - was Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Michael Torrie
On 07/23/2013 03:30 AM, Chris Angelico wrote: > On Tue, Jul 23, 2013 at 7:19 PM, Chris Angelico wrote: >> Ah, there's a solution to this one. You simply use your own >> envelope-from address; SPF shouldn't be being checked for the From: >> header. > > There's an example, by the way, of this exact

Re: Strange behaviour with os.linesep

2013-07-23 Thread Jason Swails
On Tue, Jul 23, 2013 at 9:26 AM, Vincent Vande Vyvre < vincent.vandevy...@swing.be> wrote: > Le 23/07/2013 15:10, Vincent Vande Vyvre a écrit : > > The '\n' are in the original file. >> >> I've tested these other versions: >> >> --**- >> def write(): >> strings = [

Re: tkinter progress bar

2013-07-23 Thread Jason Swails
On Tue, Jul 23, 2013 at 5:38 AM, wrote: > Dear Christian, > > Thanks for the help. Can you please add a source example as I am new with > Tkinter. > http://docs.python.org/2/library/ttk.html#progressbar You can do something like this: #!/usr/bin/env python import Tkinter as tk import ttk imp

Re: Strange behaviour with os.linesep

2013-07-23 Thread Vincent Vande Vyvre
Le 23/07/2013 15:10, Vincent Vande Vyvre a écrit : The '\n' are in the original file. I've tested these other versions: --- def write(): strings = ['# -*- coding: utf-8 -*-\n', 'import os\n', 'import sys\n'] with open('writetes

Re: Strange behaviour with os.linesep

2013-07-23 Thread Vincent Vande Vyvre
Le 23/07/2013 14:39, Jason Swails a écrit : On Tue, Jul 23, 2013 at 7:42 AM, Vincent Vande Vyvre mailto:vincent.vandevy...@swing.be>> wrote: On Windows a script where de endline are the system line sep, the files are open with a double line in Eric4, Notepad++ or Gedit but they

Re: Beginner. 2d rotation gives unexpected results.

2013-07-23 Thread Peter Otten
en...@yandex.ru wrote: > This is my first post, nice to meet you all! Welcome! > I`m biology student from Russia, trying to learn python to perform some > > simple simulations. > > Here`s my first problem. > I`m trying to perform some simple 2d vector rotations in pygame, in order > > to lear

Re: Beginner. 2d rotation gives unexpected results.

2013-07-23 Thread David Hutto
haven't used pygame that much, but it sounds like you drew Z. You have [0,0],[0,100],[100,0],[100, 100] 0,0 is the top left, if I recall 0, 100 would be the lower left, then you move to100, 0 which would go diagonal to the top right, and then 100,100 to the lower right, this is assuming 0,0 is the

Re: Strange behaviour with os.linesep

2013-07-23 Thread Jason Swails
On Tue, Jul 23, 2013 at 7:42 AM, Vincent Vande Vyvre < vincent.vandevy...@swing.be> wrote: > On Windows a script where de endline are the system line sep, the files > are open with a double line in Eric4, Notepad++ or Gedit but they are > correctly displayed in the MS Bloc-Notes. > > Example with

Beginner. 2d rotation gives unexpected results.

2013-07-23 Thread enmce
Hello! This is my first post, nice to meet you all! I`m biology student from Russia, trying to learn python to perform some simple simulations. Here`s my first problem. I`m trying to perform some simple 2d vector rotations in pygame, in order to learn the basics of linear algebra and 2d trans

Strange behaviour with os.linesep

2013-07-23 Thread Vincent Vande Vyvre
On Windows a script where de endline are the system line sep, the files are open with a double line in Eric4, Notepad++ or Gedit but they are correctly displayed in the MS Bloc-Notes. Example with this code: -- # -*- coding: utf-8 -*- import os L_SEP

Re: Play Ogg Files

2013-07-23 Thread Devyn Collier Johnson
On 07/23/2013 01:19 AM, David Hutto wrote: Devyn, are you just trying to use this in an application? Would a browser based web app work. I ask because there will still be some sort of DB interaction, so could it be an option to go with a browser command? On Mon, Jul 22, 2013 at 8:37 PM, ale

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Duncan Booth
Chris Angelico wrote: > On Tue, Jul 23, 2013 at 6:06 PM, Duncan Booth wrote: >> I have a very common situation where an overly strict SPF may cause >> problems: >> >> Like many people I have multiple email addresses which all end up in >> the same inbox. The one I most commonly give out to busine

Re: tkinter progress bar

2013-07-23 Thread hsiwrek
Dear Christian, Thanks for the help. Can you please add a source example as I am new with Tkinter. Cheers. -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Chris Angelico
On Tue, Jul 23, 2013 at 7:19 PM, Chris Angelico wrote: > Ah, there's a solution to this one. You simply use your own > envelope-from address; SPF shouldn't be being checked for the From: > header. There's an example, by the way, of this exact technique right here - python-list@python.org sends ma

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Chris Angelico
On Tue, Jul 23, 2013 at 6:06 PM, Duncan Booth wrote: > Chris Angelico wrote: > >> On Tue, Jul 23, 2013 at 12:08 AM, Michael Torrie >> wrote: >>> On 07/22/2013 06:51 AM, Chris Angelico wrote: > Thanks for the tip. I didn't know about SPF > http://en.wikipedia.org/wiki/Sender_Policy_Framew

Re: tkinter progress bar

2013-07-23 Thread Christian Gollwitzer
Am 23.07.13 08:52, schrieb hsiw...@walla.com: Hi, How can I add a tkinter progress bar in python 3.2 to start before a loop and end after it. I am looking for a very simple solution. def MyFunc(): Start progress bar for fileName in fileList: … End progress bar 1. There is a progre

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Duncan Booth
Chris Angelico wrote: > On Tue, Jul 23, 2013 at 12:08 AM, Michael Torrie > wrote: >> On 07/22/2013 06:51 AM, Chris Angelico wrote: Thanks for the tip. I didn't know about SPF http://en.wikipedia.org/wiki/Sender_Policy_Framework >>> >>> It's a great way of detecting legit vs forged mai

Re: How to tick checkboxes with the same name?

2013-07-23 Thread Peter Otten
malay...@gmail.com wrote: > I faced a problem: to implement appropriate search program I need to tick > few checkboxes which turned out to have the same name (name="a", > id="a1","a2","a3","a4"). Set_input('a', True) does not work (I use Grab > library), For all but the most popular projects a u