Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-22 Thread Ian Foote
On 22/03/16 11:05, BartC wrote: On 22/03/2016 01:01, Steven D'Aprano wrote: Pythonic code probably uses a lot of iterables: for value in something: ... in preference to Pascal code written in Python: for index in range(len(something)): value = something[index] (Suppose you ne

Re: try..except with empty exceptions

2015-04-11 Thread Ian Foote
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/04/15 08:11, Steven D'Aprano wrote: > But with try...except, an empty exception list means to catch > *everything*, not nothing: > > try: ... except a,b,c: # catches a, b, c > > try: ... except a,b: # catches a, b This example is incorrect. In

Re: Idiomatic backtracking in Python

2015-01-25 Thread Ian Foote
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I think a very idiomatic way to implement backtracking is using a recursive generator (python 3): def backtrack_solver(data=None): if data is None: yield from backtrack_solver(data=initial_data) if cannot_be_valid(data):

Re: Why Python 3?

2014-04-20 Thread Ian Foote
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 20/04/14 03:34, Michael Torrie wrote: > On 04/18/2014 10:49 PM, Andrew Berg wrote: >> Python 3 is not the future; it is the present. If you're >> developing an application, just use Python 3.4 and don't look >> back unless you absolutely positively

Re: Why Python 3?

2014-04-19 Thread Ian Foote
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 19/04/14 05:49, Andrew Berg wrote: > On 2014.04.18 22:28, Anthony Papillion wrote: >> What is the general feel of /this/ community? I'm about to start >> a large scale Python project. Should it be done in 2 or 3? What >> are the benefits, aside from

Re: Python GUI?

2013-09-12 Thread Ian Foote
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/09/13 21:55, eamonn...@gmail.com wrote: > There are a few known GUI toolkits out there, and the main ones > from what I can tell are: > > Tkinter -- Simple to use, but limited PyQT -- You have a GUI > designer, so I'm not going to count that PyG

Re: Kivy for Python 3.3

2013-07-11 Thread Ian Foote
On 11/07/13 10:09, fronag...@gmail.com wrote: Hello, first time poster here, and general newbie to Python. I'm looking to write a program in Python, (and have in fact written most of it by now,) and am trying to put together a GUI for it. Kivy looks very nice, particularly with the fact that i

Re: [SPOILERS] Python easter eggs

2013-07-03 Thread Ian Foote
On 03/07/13 14:29, Steven D'Aprano wrote: Most people are familiar with: import this and sometimes even with: from __future__ import braces But I'm aware of at least three more. Anyone care to give them? import antigravity Regards, Ian F -- http://mail.python.org/mailman/listinfo/pytho

Re: Python Game Development?

2013-06-07 Thread Ian Foote
On 07/06/13 16:53, letsplaysf...@gmail.com wrote: I was planning on making a small 2D game in Python. Are there any libraries for this? I know of: • Pygame - As far as I know it's dead and has been for almost a year • PyOgre - Linux and Windows only(I do have those, but I want multi-platform) •

Re: Future standard GUI library

2013-05-26 Thread Ian Foote
On 26/05/13 20:41, Michael Torrie wrote: On 05/26/2013 11:43 AM, Wolfgang Keller wrote: Maybe it would have been faster to develop, but ultimately less useful and require more development time in the long run. suppose I now want the app natively on my phone (because that's all the rage). It

Re: Newbie to python. Very newbie question

2013-04-07 Thread Ian Foote
On 07/04/13 20:09, Dennis Lee Bieber wrote: On Sun, 7 Apr 2013 04:16:27 -0700 (PDT), ReviewBoard User declaimed the following in gmane.comp.python.general: Hi I am a newbie to python and am trying to write a program that does a sum of squares of numbers whose squares are odd. For example, for

Re: JIT compilers for Python, what is the latest news?

2013-04-05 Thread Ian Foote
On 05/04/13 03:29, John Ladasky wrote: I'm revisiting a project that I haven't touched in over a year. It was written in Python 2.6, and executed on 32-bit Ubuntu 10.10. I experienced a 20% performance increase when I used Psyco, because I had a computationally-intensive routine which occupi

Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-28 Thread Ian Foote
On 28/03/13 09:03, jmfauth wrote: The problem is elsewhere. Nobody understand the examples I gave on this list, because nobody understand Unicode. These examples are not random examples, they are well thought. If you were understanding the coding of the characters, Unicode and what this flexible

Re: "monty" < "python"

2013-03-20 Thread Ian Foote
On 20/03/13 13:38, Jan Oelze wrote: "Strings are compared lexicographically using the numeric equivalents (the result of the built-in function ord()) of their characters. Unicode and 8-bit strings are fully interoperable in this behavior." This isn't true in python 3: Python 3.2.3 (default, O

Re: Beginner Tutorials

2013-01-18 Thread Ian Foote
On 18/01/13 14:47, Rik wrote: Hi, I've developed a website for beginners to Python. I'd appreciate any comments or criticism. It's still under development, and should be finished in the next few months. Oh, and it's free to use. www.usingpython.com Your example code on http://usingpython.co

Re: Beginner Tutorials

2013-01-18 Thread Ian Foote
On 18/01/13 14:47, Rik wrote: Hi, I've developed a website for beginners to Python. I'd appreciate any comments or criticism. It's still under development, and should be finished in the next few months. Oh, and it's free to use. www.usingpython.com Is there a particular reason you disable r

Re: Dependency management in Python?

2013-01-11 Thread Ian Foote
On 11/01/13 22:34, Rodrick Brown wrote: On Fri, Jan 11, 2013 at 5:23 PM, Adelbert Chang mailto:adelbe...@gmail.com>> wrote: Hi all, I've been using Python for a while now but one of my concerns is if it is possible to have some sort of dependency management (not sure if right te

Re: get each pair from a string.

2012-10-21 Thread Ian Foote
On 22/10/12 09:03, Emile van Sebille wrote: So, as OP's a self confessed newbie asking about slicing, why provide an example requiring knowledge of tee, enumerate, next and izip? Because not only the newbie will read the thread? I for one was interested to see all the different possible appro

Re: Is there any difference between print 3 and print '3' in Python ?

2012-09-09 Thread Ian Foote
On 09/09/12 14:23, iMath wrote: 在 2012年3月26日星期一UTC+8下午7时45分26秒,iMath写道: I know the print statement produces the same result when both of these two instructions are executed ,I just want to know Is there any difference between print 3 and print '3' in Python ? thx everyone The difference is

Re: Function for examine content of directory

2012-09-06 Thread Ian Foote
On 06/09/12 15:56, Tigerstyle wrote: Hi guys, I'm trying to write a module containing a function to examine the contents of the current working directory and print out a count of how many files have each extension (".txt", ".doc", etc.) This is the code so far: -- import os path = "v:\\wo

Re: asking

2012-08-21 Thread Ian Foote
Oops, hopefully this with indent correctly: def all_in(string, substrings): for substring in substrings: if substring not in string: return False return True -- http://mail.python.org/mailman/listinfo/python-list

Re: asking

2012-08-21 Thread Ian Foote
On 22/08/12 03:57, mingqiang hu wrote: can I use just one statement to figure out if substring “a” ,"b" "c" are in string "adfbdfc" ? not use the statement like ("a" in "adfbdfc") or ( "b" in "adfbdfc") or ("c" in "adfbdfc" ) ,because if I have lots of substring, this could sucks This might

Re: looking for a neat solution to a nested loop problem

2012-08-06 Thread Ian Foote
The function range can be called with more than one argument. For example: for i in range(N, N + 10): for j in range(M, M + 100): do_something(i, j) You can also call range with 3 arguments, if want a step size different to 1: for k in range(2, 11, 3): print(k) 2 5 8 Hope th

Re: My first ever Python program, comments welcome

2012-07-21 Thread Ian Foote
On 21/07/12 20:08, Lipska the Kat wrote: Greetings Pythoners A short while back I posted a message that described a task I had set myself. I wanted to implement the following bash shell script in Python Here's the script sort -nr $1 | head -${2:-10} this script takes a filename and an optio