Re: Functions help

2014-02-25 Thread Ethan Furman
On 02/23/2014 08:01 PM, ru...@yahoo.com wrote: On 02/23/2014 08:21 PM, Mark Lawrence wrote: On 24/02/2014 02:55, Benjamin Kaplan wrote: On Sun, Feb 23, 2014 at 5:39 PM, alex23 wrote: On 24/02/2014 11:09 AM, Mark Lawrence wrote: On 24/02/2014 00:55, alex23 wrote: for _ in range(5):

Re: Functions help

2014-02-25 Thread Cameron Simpson
On 23Feb2014 18:55, Benjamin Kaplan wrote: > On Sun, Feb 23, 2014 at 5:39 PM, alex23 wrote: > > On 24/02/2014 11:09 AM, Mark Lawrence wrote: > >> On 24/02/2014 00:55, alex23 wrote: > >>> for _ in range(5): > >>> func() > >> > >> the obvious indentation error above > > > > Stupid cut&pas

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Tim Chase
On 2014-02-25 23:10, Steven D'Aprano wrote: > On Tue, 25 Feb 2014 15:03:51 -0600, Tim Chase wrote: > > > On 2014-02-25 14:40, Skip Montanaro wrote: > >> What's the correct result of evaluating this expression? > >> > >> {'A': 1} | {'A': 2} > >> > >> I can see (at least) two possible "correct" an

Re: Functions help

2014-02-25 Thread Cameron Simpson
On 24Feb2014 13:59, Mark Lawrence wrote: > On 24/02/2014 04:01, ru...@yahoo.com wrote: > >On 02/23/2014 08:21 PM, Mark Lawrence wrote: > >>On 24/02/2014 02:55, Benjamin Kaplan wrote: > >>>On Sun, Feb 23, 2014 at 5:39 PM, alex23 wrote: > On 24/02/2014 11:09 AM, Mark Lawrence wrote: > >On 2

Re: python

2014-02-25 Thread Karthik Reddy
Thank you, but from by reaserch i got these requirements .. Python, django, Twisted, MySQL, PyQt, PySide, xPython. *Technical proficiency with Python and Django. *Technical proficiency in JavaScript. *Experience with MySQL / PgSQL. *Unix/Linux expertise. *Experience with MVC design patt

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Steven D'Aprano
On Tue, 25 Feb 2014 23:07:28 +, MRAB wrote: > On 2014-02-25 21:27, Ben Finney wrote: >> Or rather, sets *only* have values. Dictionaries have keys, sets do not >> have keys. >> > But a dictionary can have duplicate values, a set cannot. It is usual to talk about the things stored in dicts an

Re: Help father help son / Install Version 2.6 on Mac OSX 10.9

2014-02-25 Thread Cameron Simpson
On 24Feb2014 21:57, Ned Deily wrote: > In article > , > Chris Angelico wrote: > > On Tue, Feb 25, 2014 at 4:28 PM, wrote: > > > Trying to install Python 2.6 because PyGames says it will only install if > > > Python 2.6 is present. > > > > Are you sure you need 2.6 and not 2.7? This suggests

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread MRAB
On 2014-02-25 23:14, Ben Finney wrote: MRAB writes: On 2014-02-25 21:27, Ben Finney wrote: > Peter Otten <__pete...@web.de> writes: > >> mauro wrote: >> >> > - Dictionaries and sets are both accessed by key >> >> but sets have no values > > Or rather, sets *only* have values. Dictionaries have

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Steven D'Aprano
On Tue, 25 Feb 2014 15:03:51 -0600, Tim Chase wrote: > On 2014-02-25 14:40, Skip Montanaro wrote: >> What's the correct result of evaluating this expression? >> >> {'A': 1} | {'A': 2} >> >> I can see (at least) two possible "correct" answers. > > I would propose at least four: > > {'A': 1}

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Ben Finney
MRAB writes: > On 2014-02-25 21:27, Ben Finney wrote: > > Peter Otten <__pete...@web.de> writes: > > > >> mauro wrote: > >> > >> > - Dictionaries and sets are both accessed by key > >> > >> but sets have no values > > > > Or rather, sets *only* have values. Dictionaries have keys, sets do > > not

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread MRAB
On 2014-02-25 21:27, Ben Finney wrote: Peter Otten <__pete...@web.de> writes: mauro wrote: > - Dictionaries and sets are both accessed by key but sets have no values Or rather, sets *only* have values. Dictionaries have keys, sets do not have keys. But a dictionary can have duplicate valu

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Oscar Benjamin
On 25 February 2014 22:36, Tim Chase wrote: > On 2014-02-25 22:21, Duncan Booth wrote: >> > It would save some space if I didn't have to duplicate all the >> > keys into sets (on the order of 10-100k small strings), instead >> > being able to directly perform the set-ops on the dicts. But >> > ot

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Tim Chase
On 2014-02-25 22:21, Duncan Booth wrote: > > It would save some space if I didn't have to duplicate all the > > keys into sets (on the order of 10-100k small strings), instead > > being able to directly perform the set-ops on the dicts. But > > otherwise, it was pretty readable & straight-forward.

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Tim Chase
On 2014-02-25 22:21, Duncan Booth wrote: > > It would save some space if I didn't have to duplicate all the > > keys into sets (on the order of 10-100k small strings), instead > > being able to directly perform the set-ops on the dicts. But > > otherwise, it was pretty readable & straight-forward.

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Mark Lawrence
On 25/02/2014 22:11, mauro wrote: {1, 2} & {2, 3} == {2} In my mind the intersection is evaluated on keys, so the resulting dict should be the empty one but {1:"a", 2:"b", 3:"c"} & {2:"b", 3:"e", 4:"f"} == ??? my output will be {2:"b", 3:"e"} or {2:"b", 3:"c"} depending on the implementa

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Duncan Booth
Tim Chase wrote: > a_dict = dict(...) > b_dict = dict(...) > a_set = set(a_dict) > b_set = set(b_dict) > added_keys = b_set - a_set > removed_keys = a_set - b_set > same_keys = a_set & b_set > diff_keys = a_set ^ b_set > all_keys = a_set | b_set > > It would save some space if

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread mauro
> > {1, 2} & {2, 3} == {2} > In my mind the intersection is evaluated on keys, so the resulting dict should be the empty one > but > > {1:"a", 2:"b", 3:"c"} & {2:"b", 3:"e", 4:"f"} == ??? my output will be {2:"b", 3:"e"} or {2:"b", 3:"c"} depending on the implementation choice. > > The m

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Tim Chase
On 2014-02-25 22:54, Peter Otten wrote: > Tim Chase wrote: > > If dicts were to support set ops, > > They do in 2.7 and 3.x. > > >>> a.viewkeys() - b.viewkeys() > set(['a']) > >>> a.viewkeys() & b.viewkeys() > set(['b']) > >>> a.viewkeys() ^ b.viewkeys() > set(['a', 'c']) > >>> a.viewkeys() | b.

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread mauro
> > {'A': 1} | {'A': 2} > > I would propose at least four: > > {'A': 1} # choose the LHS > {'A': 2} # choose the RHS > {'A': (1,2)} # a resulting pair of both > set(['A']) # you did set-ops, so you get a set The implementation should define if LHS or RHS and user should change th

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread mauro
Il Tue, 25 Feb 2014 22:02:01 +, mauro ha scritto: >> {'A': 1} | {'A': 2} >> >> I would propose at least four: >> >> {'A': 1} # choose the LHS {'A': 2} # choose the RHS {'A': (1,2)} >> # a resulting pair of both set(['A']) # you did set-ops, so you get a >> set > > The implementati

Re: Intalling Python 2.6 on Mac OSX 10.9

2014-02-25 Thread Mark Lawrence
On 25/02/2014 18:28, Robert Schmidt wrote: I am trying to install Python 2.6 because Pygame will only run on 2.6. The configure gives only warnings. make frameworkinstall gcc -c -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Peter Otten
Tim Chase wrote: > On 2014-02-25 14:40, Skip Montanaro wrote: >> What's the correct result of evaluating this expression? >> >> {'A': 1} | {'A': 2} >> >> I can see (at least) two possible "correct" answers. > > I would propose at least four: > > {'A': 1} # choose the LHS > {'A': 2} # c

Re:intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Dave Angel
mauro Wrote in message: > Dictionaries and sets share a few properties: > - Dictionaries keys are unique as well as sets items > - Dictionaries and sets are both unordered > - Dictionaries and sets are both accessed by key > - Dictionaries and sets are both mutables > > So I wonder why operatio

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Ben Finney
Peter Otten <__pete...@web.de> writes: > mauro wrote: > > > - Dictionaries and sets are both accessed by key > > but sets have no values Or rather, sets *only* have values. Dictionaries have keys, sets do not have keys. -- \ “If nature has made any one thing less susceptible than all |

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Tim Chase
On 2014-02-25 14:40, Skip Montanaro wrote: > What's the correct result of evaluating this expression? > > {'A': 1} | {'A': 2} > > I can see (at least) two possible "correct" answers. I would propose at least four: {'A': 1} # choose the LHS {'A': 2} # choose the RHS {'A': (1,2)} # a re

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Peter Otten
Peter Otten wrote: > the empty dict {2:"b"} Make that half-empty ;) -- https://mail.python.org/mailman/listinfo/python-list

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Peter Otten
mauro wrote: > Dictionaries and sets share a few properties: > - Dictionaries keys are unique as well as sets items > - Dictionaries and sets are both unordered > - Dictionaries and sets are both accessed by key but sets have no values > - Dictionaries and sets are both mutables but frozenset

Re: An example of Python in action!

2014-02-25 Thread Timothy W. Grove
I'm sorry, but I don't know much more than this. If you follow the link there is a description of how the animation was created under the video. On 25/02/2014 18:47, Skip Montanaro wrote: On Tue, Feb 25, 2014 at 12:07 PM, Timothy W. Grove wrote: Here is an example of Python being used with Ma

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Skip Montanaro
On Tue, Feb 25, 2014 at 2:32 PM, mauro wrote: > So I wonder why operations such us intersection, union, difference, > symmetric difference that are available for sets and are not available > for dictionaries without going via key dictviews. What's the correct result of evaluating this expression?

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Nick Timkovich
On Tue, Feb 25, 2014 at 2:32 PM, mauro wrote: > > So I wonder why operations such us intersection, union, difference, > symmetric difference that are available for sets and are not available > for dictionaries without going via key dictviews. How would the set operations apply to the dictionary v

intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread mauro
Dictionaries and sets share a few properties: - Dictionaries keys are unique as well as sets items - Dictionaries and sets are both unordered - Dictionaries and sets are both accessed by key - Dictionaries and sets are both mutables So I wonder why operations such us intersection, union, differen

Re: An example of Python in action!

2014-02-25 Thread Skip Montanaro
On Tue, Feb 25, 2014 at 1:52 PM, Robert Kern wrote: > Maya as in Maya, the 3D animation software from AutoDesk. Ugh. What an unfortunate almost-name-clash... S -- https://mail.python.org/mailman/listinfo/python-list

Re: An example of Python in action!

2014-02-25 Thread Robert Kern
On 2014-02-25 18:47, Skip Montanaro wrote: On Tue, Feb 25, 2014 at 12:07 PM, Timothy W. Grove wrote: Here is an example of Python being used with Maya for animation http://vimeo.com/72276442 Maya as in MayaVi, the 3D data visualizer built atop VTK? Maya as in Maya, the 3D animation sof

First Brazilian programming MOOC with 10.000 enrolled

2014-02-25 Thread Fernando Masanori Ashikaga
Python for Zombies [1] is the first MOOC in portuguese to teach programming. Today we have 10.000 enrolled in 1013 cities from Brazil. We started five months ago. The website is a Django application. [1] http://pycursos.com/python-para-zumbis/ -- https://mail.python.org/mailman/listinfo/python-

Re: An example of Python in action!

2014-02-25 Thread Skip Montanaro
On Tue, Feb 25, 2014 at 12:07 PM, Timothy W. Grove wrote: > Here is an example of Python being used with Maya for animation > http://vimeo.com/72276442 Maya as in MayaVi, the 3D data visualizer built atop VTK? Skip -- https://mail.python.org/mailman/listinfo/python-list

Intalling Python 2.6 on Mac OSX 10.9

2014-02-25 Thread Robert Schmidt
I am trying to install Python 2.6 because Pygame will only run on 2.6. The configure gives only warnings. make frameworkinstall gcc -c -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -DSVNVERSION=\"`LC_ALL=C

An example of Python in action!

2014-02-25 Thread Timothy W. Grove
Here is an example of Python being used with Maya for animation http://vimeo.com/72276442 (No prizes for guessing what sport and team I support!!!) Best regards, Tim Grove -- https://mail.python.org/mailman/listinfo/python-list

Re: ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'S SIZE 11.5 NEW IN BOX', '$49.99')'

2014-02-25 Thread MRAB
On 2014-02-25 17:37, nowebdevmy...@gmail.com wrote: HI, I'm also getting this kind of error. This will show when I do the edit function http://screencast.com/t/hGSbe1vt and this when performing the delete "Error: You have an error in your SQL syntax; check the manual that corresponds to your M

Re: ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'S SIZE 11.5 NEW IN BOX', '$49.99')'

2014-02-25 Thread nowebdevmyrrh
HI, I'm also getting this kind of error. This will show when I do the edit function http://screencast.com/t/hGSbe1vt and this when performing the delete "Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near

Re: Python : parsing the command line options using optparse

2014-02-25 Thread Mark Lawrence
On 25/02/2014 15:31, Ganesh Pal wrote: Hi Folks , Iam newbie to Python, Iam trying to use optparse module and write a script that will parse the command line options ..I had to use opt parse instead of argparse because by host Operating system is still using python 2.6 Do you have the needed

Re: Python : parsing the command line options using optparse

2014-02-25 Thread Peter Otten
Ganesh Pal wrote: > Iam newbie to Python, Iam trying to use optparse module and write a script > that will parse the command line options ..I had to use opt parse instead > of argparse because by host Operating system is still using python 2.6 As you are just starting I recommend that you use ar

Python : parsing the command line options using optparse

2014-02-25 Thread Ganesh Pal
Hi Folks , Iam newbie to Python, Iam trying to use optparse module and write a script that will parse the command line options ..I had to use opt parse instead of argparse because by host Operating system is still using python 2.6 Below is the simple program ( Feel free to correct the error

Re: Install python 2 and 3 in the "wrong" order

2014-02-25 Thread Mark Lawrence
On 16/02/2014 08:13, Nagy László Zsolt wrote: And apparently, py.exe does not work the way it should be. What does this mean? Have you raised an issue on the bug tracker? I would happily reinstall 3.3 to solve the problem, but before I do that I would like to check all other related settin

Re: Install python 2 and 3 in the "wrong" order

2014-02-25 Thread sffjunkie
On Sunday, 16 February 2014 08:13:14 UTC, Nagy László Zsolt wrote: > > Though I don't see anything in the ActiveState builds (which are all > > I've ever used) to handle the #! type selection of the desired version. > > Just got done updating my 2.7, replacing 3.2 with 3.3, and then having to

Re: Python powerpoint automation using pywin32

2014-02-25 Thread sffjunkie
On Tuesday, 25 February 2014 03:52:29 UTC, Jaydeep Patil wrote: > I need to use COM interface for PowerPoint generation. The following will get you started http://nbviewer.ipython.org/github/sanand0/ipython-notebooks/blob/master/Office.ipynb Then you'll need to interpret the Microsoft MSDN docs

Re: Coding a simple state machine in python

2014-02-25 Thread Marko Rauhamaa
Peter Otten <__pete...@web.de>: > Why have the function return a name? Why not just another function? As people have said, there are many ways to skin the cat. A function can represent a state if it is the only type of event the state machine must process. A regular expression parser would be an

Re: SSH/Telnet program to Router/switch

2014-02-25 Thread Ferrous Cranus
Τη Τετάρτη, 19 Φεβρουαρίου 2014 10:45:53 π.μ. UTC+2, ο χρήστης Wojciech Łysiak έγραψε: > On 19.02.2014 09:14, Sujith S wrote: > > > Hi, > > > > > > I am new to programming and python. I am looking for a python script to do > > ssh/telnet to a network equipment ? I know tcl/perl does this usin

Re: Coding a simple state machine in python

2014-02-25 Thread Peter Otten
William Ray Wing wrote: > > On Feb 24, 2014, at 8:30 PM, Ronaldo wrote: > >> How do I write a state machine in python? I have identified the states >> and the conditions. Is it possible to do simple a if-then-else sort of an >> algorithm? Below is some pseudo code: >> >> if state == "ABC": >>

Re: Coding a simple state machine in python

2014-02-25 Thread Peter Otten
alex23 wrote: > On 25/02/2014 1:27 PM, Tim Daneliuk wrote: >> On 02/24/2014 08:55 PM, William Ray Wing wrote: >>> On Feb 24, 2014, at 8:30 PM, Ronaldo wrote: How do I write a state machine in python? > >> >>> Stackoverflow has a couple of compact examples here: >> >> Now you're making it TO

Re: Python powerpoint automation using pywin32

2014-02-25 Thread Mark Lawrence
On 25/02/2014 03:52, Jaydeep Patil wrote: On Monday, 24 February 2014 17:27:23 UTC+5:30, sffj...@gmail.com wrote: On Monday, 24 February 2014 11:35:08 UTC, Jaydeep Patil wrote: I need to create a new powerpoint presentation. I need to add images, paste some graphs, add texts, tables into po

Re: Coding a simple state machine in python

2014-02-25 Thread Mark Lawrence
On 25/02/2014 05:19, alex23 wrote: On 25/02/2014 1:27 PM, Tim Daneliuk wrote: On 02/24/2014 08:55 PM, William Ray Wing wrote: On Feb 24, 2014, at 8:30 PM, Ronaldo wrote: How do I write a state machine in python? >> Stackoverflow has a couple of compact examples here: Now you're making it

Re: Python 3.5, bytes, and %-interpolation (aka PEP 461)

2014-02-25 Thread Mark Lawrence
On 25/02/2014 08:07, wxjmfa...@gmail.com wrote: What is wrong by design will always stay wrong by design. Why are you making the statement that PEP 461 is wrong by design? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawre

Re: Python 3.5, bytes, and %-interpolation (aka PEP 461)

2014-02-25 Thread wxjmfauth
Le mardi 25 février 2014 00:55:36 UTC+1, Steven D'Aprano a écrit : > > > > However, you don't really want to be adding large numbers of byte strings > > together, due to efficiency. Better to use % interpolation to insert them > > all at once. Hence the push to add % to bytes in Python 3. >