Re: function call questions

2016-10-18 Thread chenyong20000
在 2016年10月19日星期三 UTC+8上午11:46:28,MRAB写道: > On 2016-10-19 03:15, chenyong20...@gmail.com wrote: > > Thanks Peter and Anssi for your kind help. Now I'm ok with the first > > question. But the second question still confused me. Why "it seems that > > after root = root.setdefault(ch,{}) tree['a'] and

Re: function call questions

2016-10-18 Thread MRAB
On 2016-10-19 03:15, chenyong20...@gmail.com wrote: Thanks Peter and Anssi for your kind help. Now I'm ok with the first question. But the second question still confused me. Why "it seems that after root = root.setdefault(ch,{}) tree['a'] and root are the same object" and follows tree['a']['b']?

Re: Button Widget and Key Binding Problem

2016-10-18 Thread MRAB
On 2016-10-19 03:13, Wildman via Python-list wrote: I am working on a program with a GUI created with Tkinter. I want to enable key bindings for the button widgets. Below is some of the code to show how the window and button widget was created. The button calls a routine that will load an imag

Re: function call questions

2016-10-18 Thread chenyong20000
Thanks Peter and Anssi for your kind help. Now I'm ok with the first question. But the second question still confused me. Why "it seems that after root = root.setdefault(ch,{}) tree['a'] and root are the same object" and follows tree['a']['b']? Thanks. -- https://mail.python.org/mailman/listinf

Button Widget and Key Binding Problem

2016-10-18 Thread Wildman via Python-list
I am working on a program with a GUI created with Tkinter. I want to enable key bindings for the button widgets. Below is some of the code to show how the window and button widget was created. The button calls a routine that will load an image. class Window(tk.Frame): def __init__(self, m

Survey About Package Requirements Management

2016-10-18 Thread Robert Roskam
Hey all, To clarify my title quickly, this survey is not about replacing pip, as yarn (https://github.com/yarnpkg/yarn) did recently with npm. This is about helping you throughout the lifespan of projects you maintain keep a handle on the dependencies it has. Where I work, we've already made s

Re: Inplace shuffle function returns none

2016-10-18 Thread Steve D'Aprano
On Wed, 19 Oct 2016 07:25 am, Sayth Renshaw wrote: > So why can't i assign the result slice to a variable b? > > It just keeps getting none. Of course you can assign the result slice to b. You just have to do it the right way. You keep getting None because you do it the wrong way. Unfortunatel

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread Michael Torrie
On 10/18/2016 03:23 PM, pozz wrote: > Il 18/10/2016 18:41, Demosthenes Koptsis ha scritto: > > My favorite GUIs are PyQt and wxPython. > > > > I prefer PyQt than PySide because PySide seem to me like an abandoned > > project. > > > > Also i prefer PyQt than wxPython because i can design the f

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread Demosthenes Koptsis
I have no experience of GTK On 10/19/2016 12:23 AM, pozz wrote: Il 18/10/2016 18:41, Demosthenes Koptsis ha scritto: > My favorite GUIs are PyQt and wxPython. > > I prefer PyQt than PySide because PySide seem to me like an abandoned > project. > > Also i prefer PyQt than wxPython because i can

Python | Data Science : Become a Data Scientist with Huge Employment Opportunities

2016-10-18 Thread Jayanth Nair
This course will help you to expertise the usage of Python in Data Science world. Why should you take this Training Course? Data Science skills are in huge demand with enterprises ready to pay big salaries to the right candidates with in-depth expertise. Python is a general-purpose programmin

Re: cannot import name pyhop

2016-10-18 Thread Irmen de Jong
On 18-10-2016 19:14, Gipper wrote: > On Friday, October 14, 2016 at 1:05:03 PM UTC-5, Irmen de Jong wrote: >> On 14-10-2016 7:31, Gipper wrote: >>> I'm trying to run a script that calls pyhop (from pyhop import pyhop). >>> Details here > https://docs.extrahop.com/5.0/extrahop-python-api/#metrics

Re: Python-based monads essay part 2

2016-10-18 Thread Gregory Ewing
Chris Angelico wrote: You can take your original set-builder monad and turn it into genuinely functional code; show me that you can do the same with I/O. Otherwise, what you're really saying is "we can cheat until we can do I/O", not "we can do I/O in a functional way". I don't think I'm saying

Re: Inplace shuffle function returns none

2016-10-18 Thread John Gordon
In <9d24f23c-b578-4029-ab80-f117599e2...@googlegroups.com> Sayth Renshaw writes: > So why can't i assign the result slice to a variable b? Because shuffle() modifies the list directly, and returns None. It does NOT return the shuffled list. -- John Gordon A is for Amy, who f

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread pozz
Il 18/10/2016 18:41, Demosthenes Koptsis ha scritto: > My favorite GUIs are PyQt and wxPython. > > I prefer PyQt than PySide because PySide seem to me like an abandoned > project. > > Also i prefer PyQt than wxPython because i can design the forms in > QtDesigner easily. > > wxPython and wxWidgets

Re: Inplace shuffle function returns none

2016-10-18 Thread breamoreboy
On Tuesday, October 18, 2016 at 9:25:19 PM UTC+1, Sayth Renshaw wrote: > So why can't i assign the result slice to a variable b? > > It just keeps getting none. > > Sayth You are misunderstanding something that is fundamental in Python, namely that anything that is done inplace *ALWAYS* return

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread Dietmar Schwertberger
On 18.10.2016 00:58, pozz wrote: So I'm thinking to evaluate other solutions. wxWidgets is attractive for it's native look&feel, but python implementation Phoenix for Python3 is in alpha stage. Moreover wxGlade (the GUI builder application) needs Python2, but I couldn't understand if the genera

Re: Inplace shuffle function returns none

2016-10-18 Thread Ian Kelly
On Tue, Oct 18, 2016 at 2:25 PM, Sayth Renshaw wrote: > So why can't i assign the result slice to a variable b? > > It just keeps getting none. Because shuffle returns none. If you want to keep both the original list and the shuffled list, then do something like: b = a[:] shuffle(b) print(a) pri

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread Adam M
If my dusty memory is not wrong they were two projects aiming for GUI designer for wx: wxGlade (with option to generate code for Python) and Boa Contructor. I have no idea however if they are still available or working with newer wx. I prefer for simple stuff Tk for something more sophisticated

Re: Inplace shuffle function returns none

2016-10-18 Thread Sayth Renshaw
So why can't i assign the result slice to a variable b? It just keeps getting none. Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread Demosthenes Koptsis
My favorite GUIs are PyQt and wxPython. I prefer PyQt than PySide because PySide seem to me like an abandoned project. Also i prefer PyQt than wxPython because i can design the forms in QtDesigner easily. wxPython and wxWidgets do not have a GUI designer competitor to QtDesigner. So, my ch

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread Michael Torrie
On 10/18/2016 10:01 AM, pozz wrote: > What are the differences between PySides and PyQt... apart the licence? > Is PySides usable as PyQt? PySide aims to be pretty close to PyQt. Both of them wrap the C++ api, so class names and method calls should be identical. There are some differences though.

Re: cannot import name pyhop

2016-10-18 Thread Gipper
On Friday, October 14, 2016 at 1:05:03 PM UTC-5, Irmen de Jong wrote: > On 14-10-2016 7:31, Gipper wrote: > > I'm trying to run a script that calls pyhop (from pyhop import pyhop). > > Details here > https://docs.extrahop.com/5.0/extrahop-python-api/#metrics > > > > I've followed the directions

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread pozz
Il 18/10/2016 16:56, Michael Torrie ha scritto: On 10/18/2016 02:33 AM, Mark Summerfield wrote: When I started out I used Qt Designer to produce .ui files (XML) and then used the Qt uic tool to convert this to C++ (although you can convert to Python using pyuic). I then studied the code and lear

QPython ?

2016-10-18 Thread Askfor
What is te status of QPython on Android. I managed to run some scripts directly on the phone. Found some examples in Ferrill Paul's book which is about SL4A. They worked after some editing and looking into very few examples which came with installation. I even manage to develop some scripts of

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread Michael Torrie
On 10/18/2016 01:16 AM, pozz wrote: >> I am also learning Python so my experience is limited. I have >> tried pyGTK and Tkinter. GTK's concept of the hbox and vbox >> gave me of difficulty. I couldn't get the GUI to look the way >> I wanted. > > Yes, it's exactly my situation. I understand box

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread Michael Torrie
On 10/18/2016 02:33 AM, Mark Summerfield wrote: > When I started out I used Qt Designer to produce .ui files (XML) and > then used the Qt uic tool to convert this to C++ (although you can > convert to Python using pyuic). I then studied the code and learnt > from that. And it turns out that it isn'

Re: Inplace shuffle function returns none

2016-10-18 Thread John Gordon
In Sayth Renshaw writes: > If shuffle is an "in place" function and returns none how do i obtain > the values from it. The values are still in the original object -- variable "a" in your example. > from random import shuffle > a = [1,2,3,4,5] > b = shuffle(a) > print(b[:3]) > For example he

Re: Inplace shuffle function returns none

2016-10-18 Thread Chris Angelico
On Wed, Oct 19, 2016 at 1:48 AM, Sayth Renshaw wrote: > If shuffle is an "in place" function and returns none how do i obtain the > values from it. > > from random import shuffle > > a = [1,2,3,4,5] > b = shuffle(a) > print(b[:3]) > > For example here i just want to slice the first 3 numbers whic

Re: New to python

2016-10-18 Thread Chris Warrick
On 17 October 2016 at 21:51, Bill Cunningham wrote: > I just installed python I might start with 3. But there is version 2 out > too. So far I can '3+4' and get the answer. Nice. I typed the linux man page > and got a little info. So to learn this language is there an online > tutorial? I am i

Inplace shuffle function returns none

2016-10-18 Thread Sayth Renshaw
If shuffle is an "in place" function and returns none how do i obtain the values from it. from random import shuffle a = [1,2,3,4,5] b = shuffle(a) print(b[:3]) For example here i just want to slice the first 3 numbers which should be shuffled. However you can't slice a noneType object that b

Re: Meta classes - real example

2016-10-18 Thread Ethan Furman
On 10/17/2016 11:44 PM, Mr. Wrobel wrote: Ok,so in general, we could say that using Metclasses is ok for manipulating __new__ but not that what is setting by __init__. Am I right? No and yes. In this code (python 2 syntax): #untested class Wonderful(object): __metaclass__ = SomeMetaCla

Re: need help for an assignment plz noob here

2016-10-18 Thread Sayth Renshaw
> > > Hello guys. so my assignment consists in creating a key generator so i can > > use it in later steps of my work. In my first step i have to write a > > function called key_generator that receives an argument, letters, that > > consists in a tuple of 25 caracters. The function returns a t

Re: Generator comprehension - list None

2016-10-18 Thread Sayth Renshaw
Thank you quite easy, was trying to work around it in the generator, the print needs to be outside the generator to avoid the collection of "None". Wasn't really liking comprehensions though python 3 dict comprehensions are a really nice utility. Sayth -- https://mail.python.org/mailman/listi

Re: Generator comprehension - list None

2016-10-18 Thread Chris Angelico
On Tue, Oct 18, 2016 at 11:57 PM, Jon Ribbens wrote: > I must admit I find the idea of enumerate(range(n)) quite pleasing. > gotta keep track of which numbers those numbers are! Heh! I'm assuming that's a placeholder for enumerate(some_other_iterable), where the actual iterable in question isn't

Re: Generator comprehension - list None

2016-10-18 Thread Jon Ribbens
On 2016-10-18, Steve D'Aprano wrote: > On Tue, 18 Oct 2016 10:43 pm, Sayth Renshaw wrote: >> I was solving a problem to create a generator comprehension with 'Got ' >> and a number for each in range 10. >> >> This I did however I also get a list of None. I don't understand where >> none comes fro

Re: need help for an assignment plz noob here

2016-10-18 Thread Kaur Männamaa
How exactly did you get the final product if you don't know how to get there? I'm sorry but what you are trying to do does not seem fair:) One hint: for loops PS generators are actually specific functions in Python: http://stackoverflow.com/questions/1756096/understanding-generators-in-python#1

Re: Generator comprehension - list None

2016-10-18 Thread Steve D'Aprano
On Tue, 18 Oct 2016 10:43 pm, Sayth Renshaw wrote: > I was solving a problem to create a generator comprehension with 'Got ' > and a number for each in range 10. > > This I did however I also get a list of None. I don't understand where > none comes from. Can you please clarify? You get None bec

Re: Generator comprehension - list None

2016-10-18 Thread Ben Finney
Sayth Renshaw writes: > This I did however I also get a list of None. I don't understand where > none comes from. Can you please clarify? Every function in Python, if it returns, returns a value. In an expression that consists of only a function call, the expression resolves to the return value

Re: Generator comprehension - list None

2016-10-18 Thread Bob Gailer
On Oct 18, 2016 7:45 AM, "Sayth Renshaw" wrote: > > I was solving a problem to create a generator comprehension with 'Got ' and a number for each in range 10. > > This I did however I also get a list of None. I don't understand where none comes from. Can you please clarify? > > a = (print("Got {0}

Re: Generator comprehension - list None

2016-10-18 Thread Chris Angelico
On Tue, Oct 18, 2016 at 10:43 PM, Sayth Renshaw wrote: > I was solving a problem to create a generator comprehension with 'Got ' and a > number for each in range 10. > > This I did however I also get a list of None. I don't understand where none > comes from. Can you please clarify? > > a = (pri

Generator comprehension - list None

2016-10-18 Thread Sayth Renshaw
I was solving a problem to create a generator comprehension with 'Got ' and a number for each in range 10. This I did however I also get a list of None. I don't understand where none comes from. Can you please clarify? a = (print("Got {0}".format(num[0])) for num in enumerate(range(10))) # for

Re: Python-based monads essay part 2

2016-10-18 Thread Chris Angelico
On Tue, Oct 18, 2016 at 9:50 PM, Rustom Mody wrote: > Now we can functionalize all this by making 'the world' as a parameter to our > functions. > Greg talks of this as do other writings on functional IO > I personally find talking of 'world' as though its an object in my little > world to be a s

Re: Python-based monads essay part 2

2016-10-18 Thread Rustom Mody
On Tuesday, October 18, 2016 at 4:07:53 PM UTC+5:30, Marko Rauhamaa wrote: > Chris Angelico wrote: > > If you want to prove to me that monads are still functional, > > Ultimately, monads are simply the pipelining pattern. It is used > extensively in Unix shells. (I don't know Microsoft's PowerShel

Re: Python-based monads essay part 2

2016-10-18 Thread Marko Rauhamaa
Chris Angelico : > I think, it is patently false to claim that Haskell is purely > functional - but the I/O monads are a crucial feature in making the > language useful. As soon as you accept that values can exist in "a superposition," that is, in a not-yet-fully-materialized form, you can see tha

Re: Python-based monads essay part 2

2016-10-18 Thread Marko Rauhamaa
Chris Angelico : > If you want to prove to me that monads are still functional, Ultimately, monads are simply the pipelining pattern. It is used extensively in Unix shells. (I don't know Microsoft's PowerShell, but it used to be called "Monad".) > Otherwise, what you're really saying is "we can c

How to overlay data points on a static google image?

2016-10-18 Thread Madhavan Bomidi
Hello everyone, I have been using IDL for making plots until recently and currently transitioning to Python programming. I have a task to obtain a static google image for my region of interest and then overlay the variable frequency counts at different lat-long coordinates. While I have succeed

Re: Python-based monads essay part 2

2016-10-18 Thread Chris Angelico
On Tue, Oct 18, 2016 at 8:56 PM, Rustom Mody wrote: > One thing probably is correct in what you are saying (if you are saying!): > The IO monad cannot be programmed at the vanilla user/programmer level but > must > be hardwired into the system (for an FPL of course; for python its all demo > any

Re: Python-based monads essay part 2

2016-10-18 Thread Rustom Mody
On Tuesday, October 18, 2016 at 2:55:07 PM UTC+5:30, Chris Angelico wrote: > On Fri, Oct 14, 2016 at 9:52 AM, Gregory Ewing wrote: > > A bit more on SMFs, and then some I/O. > > > > http://www.cosc.canterbury.ac.nz/greg.ewing/essays/monads/DemystifyingMonads2.html > > Finally finished reading this

Re: function call questions

2016-10-18 Thread Peter Otten
chenyong20...@gmail.com wrote: >> > My question is: >> > (1) why root is always {}? >> >> Because that's what you bind it to in the line >> >> > ... root = root.setdefault(ch,{}) >> >> See >> for a description of the the s

Re: function call questions

2016-10-18 Thread chenyong20000
> > My question is: > > (1) why root is always {}? > > Because that's what you bind it to in the line > > > ... root = root.setdefault(ch,{}) > > See > for a description of the the setdefault() method. I'm still confused h

Re: Python-based monads essay part 2

2016-10-18 Thread Chris Angelico
On Fri, Oct 14, 2016 at 9:52 AM, Gregory Ewing wrote: > A bit more on SMFs, and then some I/O. > > http://www.cosc.canterbury.ac.nz/greg.ewing/essays/monads/DemystifyingMonads2.html Finally finished reading this - it's been up in a tab in Chrome for the past few days. So here's how I summarize y

Re: function call questions

2016-10-18 Thread Anssi Saari
chenyong20...@gmail.com writes: > My question is: > (1) why root is always {}? Because that's what you wrote. root.setdefault(ch, {}) returns {} and you assign that to root. You probably want to do just root.setdefault(ch, {}) instead of root = root.setdefault(ch, {}). > (2) why tree is {'a': {'

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread Mark Summerfield
On Tuesday, October 18, 2016 at 9:04:48 AM UTC+1, pozz wrote: > Il 18/10/2016 09:42, Mark Summerfield ha scritto: [snip] > Why don't you use a GUI design tool? Better... how can you design a GUI > without seeing it? For me it's very difficult to "code the GUI". When I started out I used Qt Desi

Re: function call questions

2016-10-18 Thread Peter Otten
chenyong20...@gmail.com wrote: > Hi, > I got a function call as this: > def add_to_tree(root,value_string): > ...print "root is %s, value_string is %s" % (root, value_string) > ...for ch in value_string: > ... print "ch is %s" % ch > ... root = root.setdefault(ch,{}) > ...

testfixtures 4.12.0 Released!

2016-10-18 Thread Chris Withers
Hi All, I'm pleased to announce the release of testfixtures 4.12.0 featuring the following: - Add support for specifying a callable to extract rows from log records when using LogCapture(). - Add support for recursive comparison of log messages with LogCapture(). The package is on PyPI a

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread pozz
Il 18/10/2016 09:42, Mark Summerfield ha scritto: PySide/PyQt On Windows I use Python 3.4 + PySide 1.2.4 (Qt 4.8). I have found this very reliable and use it for both my personal projects and for my commercial products. I don't use a GUI design tool but you could use Qt Designer to visually draw

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread pozz
Il 18/10/2016 03:25, Paul Rubin ha scritto: If you're just getting started and you're not trying to make something super slick, I'd suggest Tkinter. It's easy to learn and use, you can bang stuff together with it pretty fast, it's included with various Python distributions so you avoid download/

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread Mark Summerfield
PySide/PyQt On Windows I use Python 3.4 + PySide 1.2.4 (Qt 4.8). I have found this very reliable and use it for both my personal projects and for my commercial products. I don't use a GUI design tool but you could use Qt Designer to visually draw your GUI since PySide can read the .ui files it out

function call questions

2016-10-18 Thread chenyong20000
Hi, I got a function call as this: >>>def add_to_tree(root,value_string): ...print "root is %s, value_string is %s" % (root, value_string) ...for ch in value_string: ... print "ch is %s" % ch ... root = root.setdefault(ch,{}) ... print "root is", root ... print "tree is

Re: [FAQ] "Best" GUI toolkit for python

2016-10-18 Thread pozz
Il 18/10/2016 02:57, Wildman ha scritto: On Tue, 18 Oct 2016 00:58:42 +0200, pozz wrote: I'm sorry, I know it is a FAQ..., but I couldn't find a good answer. I'm learning python and I'd like to start creating GUI applications, mainly for Windows OS. In the past, I wrote many applications in Vi