Re: Create directories and modify files with Python

2012-06-08 Thread Robert Miles
On 5/1/2012 5:51 AM, deltaquat...@gmail.com wrote: Il giorno martedì 1 maggio 2012 01:57:12 UTC+2, Irmen de Jong ha scritto: [snip] Focus on file input and output, string manipulation, and look in the os module for stuff to help scanning directories (such as os.walk). Irmen Thanks for the d

Re: Where is the lastest step by step guide to compile Python into an executable?

2012-06-08 Thread Chris Angelico
On Sat, Jun 9, 2012 at 3:41 AM, Prasad, Ramit wrote: >> > Where is the lastest step by step guide to compile Python into an >> executable? >> >> Google. > > I think you mean the Internet as Google is just an index. > Unless you are referring to Google's cache. He means this: http://www.catb.org/

Re: Some posts do not show up in Google Groups

2012-06-08 Thread Robert Miles
On 5/1/2012 1:12 AM, Frank Millman wrote: On Apr 30, 8:20 am, Frank Millman wrote: Hi all For a while now I have been using Google Groups to read this group, but on the odd occasion when I want to post a message, I use Outlook Express, as I know that some people reject all messages from Goog

Re: Some posts do not show up in Google Groups

2012-06-08 Thread Robert Miles
On 4/30/2012 1:20 AM, Frank Millman wrote: Hi all For a while now I have been using Google Groups to read this group, but on the odd occasion when I want to post a message, I use Outlook Express, as I know that some people reject all messages from Google Groups due to the high spam ratio (whi

Re: Import semantics?

2012-06-08 Thread Dan Stromberg
And a link to the ticket: http://bugs.python.org/issue15039 > -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing ints to a function

2012-06-08 Thread stayvoid
> You want to unpack the list: > > function(*a)  # like function(a[0], a[1], a[2], ...) Awesome! I forgot about this. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Import semantics?

2012-06-08 Thread Dan Stromberg
On Fri, Jun 8, 2012 at 3:48 PM, Ian Kelly wrote: > On Fri, Jun 8, 2012 at 4:24 PM, Dan Stromberg wrote: > > Am I misinterpreting this? It seems like according to the PEP, I should > > have still been able to import treap.py despite having a treap/. But I > > couldn't; I had to rename treap/ to

Re: Passing ints to a function

2012-06-08 Thread Steven D'Aprano
On Fri, 08 Jun 2012 16:41:40 -0700, stayvoid wrote: > Hello, > > I want to pass several values to a function which is located on a server > (so I can't change its behavior). That function only accepts five values > which must be ints. > > There are several lists: > a = [1, 2, 3, 4, 5] > b = [5,

Re: Passing ints to a function

2012-06-08 Thread Benjamin Kaplan
On Fri, Jun 8, 2012 at 7:41 PM, stayvoid wrote: > Hello, > > I want to pass several values to a function which is located on a > server (so I can't change its behavior). > That function only accepts five values which must be ints. > > There are several lists: > a = [1, 2, 3, 4, 5] > b = [5, 4, 3,

Re: Passing ints to a function

2012-06-08 Thread Ian Kelly
On Fri, Jun 8, 2012 at 5:41 PM, stayvoid wrote: > Hello, > > I want to pass several values to a function which is located on a > server (so I can't change its behavior). > That function only accepts five values which must be ints. > > There are several lists: > a = [1, 2, 3, 4, 5] > b = [5, 4, 3,

Passing ints to a function

2012-06-08 Thread stayvoid
Hello, I want to pass several values to a function which is located on a server (so I can't change its behavior). That function only accepts five values which must be ints. There are several lists: a = [1, 2, 3, 4, 5] b = [5, 4, 3, 2, 1] c = [0, 0, 0, 0, 0] I want to pass each value from these l

Re: mode for file created by open

2012-06-08 Thread Cameron Simpson
On 08Jun2012 14:36, Neal Becker wrote: | If a new file is created by open ('xxx', 'w') | | How can I control the file permission bits? Is my only choice to use chmod | after opening, or use os.open? | | Wouldn't this be a good thing to have as a keyword for open? Too bad what | python calls

Re: Import semantics?

2012-06-08 Thread Devin Jeanpierre
On Fri, Jun 8, 2012 at 6:24 PM, Dan Stromberg wrote: > Am I misinterpreting this?  It seems like according to the PEP, I should > have still been able to import treap.py despite having a treap/.  But I > couldn't; I had to rename treap/ to treap-dir/ first. Only if treap/ and treap.py were in the

Re: [Python-Dev] Import semantics?

2012-06-08 Thread Ethan Furman
Eric V. Smith wrote: On 6/8/2012 6:41 PM, Ethan Furman wrote: Dan Stromberg wrote: On Fri, Jun 8, 2012 at 3:16 PM, Ethan Furman wrote: Dan Stromberg wrote: Did the import semantics change in cpython 3.3a4? I used to be able to import treap.py even though I had a treap directory in my cwd. Wi

Re: Import semantics?

2012-06-08 Thread Ian Kelly
On Fri, Jun 8, 2012 at 4:24 PM, Dan Stromberg wrote: > Am I misinterpreting this?  It seems like according to the PEP, I should > have still been able to import treap.py despite having a treap/.  But I > couldn't; I had to rename treap/ to treap-dir/ first. That's how I understand it. The existe

Re: Import semantics?

2012-06-08 Thread Dan Stromberg
On Fri, Jun 8, 2012 at 3:16 PM, Ethan Furman wrote: > Dan Stromberg wrote: > >> >> Did the import semantics change in cpython 3.3a4? >> >> I used to be able to import treap.py even though I had a treap directory >> in my cwd. With 3.3a4, I have to rename the treap directory to see >> treap.py. >

Re: Import semantics?

2012-06-08 Thread Ethan Furman
Dan Stromberg wrote: Did the import semantics change in cpython 3.3a4? I used to be able to import treap.py even though I had a treap directory in my cwd. With 3.3a4, I have to rename the treap directory to see treap.py. Check out PEP 420 -- Implicit Namespace Packages [http://www.python.

Import semantics?

2012-06-08 Thread Dan Stromberg
Did the import semantics change in cpython 3.3a4? I used to be able to import treap.py even though I had a treap directory in my cwd. With 3.3a4, I have to rename the treap directory to see treap.py. -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing MySQLdb via FTP?

2012-06-08 Thread Corey Richardson
On Fri, 8 Jun 2012 09:55:23 -0800 Tim Johnson wrote: > See the thread titled "Python libraries portable?" you will note > that Corey Richardson makes the statement that MySQLdb is a C > extension. I accepted that statement, but upon looking at the > directories (I am on Mac Lion, but bel

Re: mode for file created by open

2012-06-08 Thread Devin Jeanpierre
On Fri, Jun 8, 2012 at 2:36 PM, Neal Becker wrote: > If a new file is created by open ('xxx', 'w') > > How can I control the file permission bits?  Is my only choice to use chmod > after opening, or use os.open? For whatever it's worth, in Python 3.3 you have the additional option of providing a

mode for file created by open

2012-06-08 Thread Neal Becker
If a new file is created by open ('xxx', 'w') How can I control the file permission bits? Is my only choice to use chmod after opening, or use os.open? Wouldn't this be a good thing to have as a keyword for open? Too bad what python calls 'mode' is like what posix open calls 'flags', and what

RunPy (was py2bat (was: How do I make a Python .bat executable file?))

2012-06-08 Thread James Lu
no way just use py2exe 1.download it and python 2.make a setup file with this replacing ? with python file name: from setuptools import setup setup(app=['Tic-Tac-Toe easy.py']) james a intermediate child programmer -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing MySQLdb via FTP?

2012-06-08 Thread Tim Johnson
* Prasad, Ramit [120608 09:38]: > > Is it possible to install MySQLdb via FTP? > > > > 1)I have a hostmonster account with SSH. I have been able to log in > > and install MySQLdb from the shell. Works fine. > > > > 2)Now I have a client who wants to have a hostmonster account and we > > will nee

RE: Where is the lastest step by step guide to compile Python into an executable?

2012-06-08 Thread Prasad, Ramit
> > Where is the lastest step by step guide to compile Python into an > executable? > > > > Regards. > > > > David > > > > > > > > > > Google. I think you mean the Internet as Google is just an index. Unless you are referring to Google's cache. :) Ramit Ramit Prasad | JPMorgan Chase Investme

RE: Installing MySQLdb via FTP?

2012-06-08 Thread Prasad, Ramit
> Is it possible to install MySQLdb via FTP? > > 1)I have a hostmonster account with SSH. I have been able to log in > and install MySQLdb from the shell. Works fine. > > 2)Now I have a client who wants to have a hostmonster account and we > will need MySQLdb. I *will not* have SSH access since (

Re: About a list comprehension to transform an input list

2012-06-08 Thread Ian Kelly
On Fri, Jun 8, 2012 at 10:43 AM, Emile van Sebille wrote: > Or alternately by leveraging true/false as 1/0: > [ 100*(not(ii%2))+ii for ii in range(10)] The same thing, leaving bools out of it altogether: >>> [100*(1-ii%2)+ii for ii in range(10)] -- http://mail.python.org/mailman/listinfo/p

Re: Why does this leak memory?

2012-06-08 Thread Ian Kelly
On Fri, Jun 8, 2012 at 10:02 AM, Steve wrote: > Well, I guess I was confused by the terminology. I thought there were leaked > objects _after_ a garbage collection had been run (as it said "collecting > generation 2"). That means that it's going to check all objects. The garbage collector divide

Re: About a list comprehension to transform an input list

2012-06-08 Thread Emile van Sebille
On 6/8/2012 9:17 AM Daniel Urban said... On Fri, Jun 8, 2012 at 6:10 PM, Julio Sergio wrote: > From a sequence of numbers, I'm trying to get a list that does something to even numbers but leaves untouched the odd ones, say: [0,1,2,3,4,...] ==> [100,1,102,3,104,...] I know that this can be d

Re: About a list comprehension to transform an input list

2012-06-08 Thread Daniel Urban
On Fri, Jun 8, 2012 at 6:10 PM, Julio Sergio wrote: > >From a sequence of numbers, I'm trying to get a list that does something to > >even > numbers but leaves untouched the odd ones, say: > > [0,1,2,3,4,...] ==> [100,1,102,3,104,...] > > I know that this can be done with an auxiliary function, a

About a list comprehension to transform an input list

2012-06-08 Thread Julio Sergio
>From a sequence of numbers, I'm trying to get a list that does something to >even numbers but leaves untouched the odd ones, say: [0,1,2,3,4,...] ==> [100,1,102,3,104,...] I know that this can be done with an auxiliary function, as follows: ->>> def filter(n): ... if (n%2 == 0): ...

Re: Why does this leak memory?

2012-06-08 Thread Steve
"John Gordon" wrote in message news:jqr3v5$src$1...@reader1.panix.com... I'm unfamiliar with gc output, but just glancing over it I don't see anything that looks like a leak. It reported that there were 19 objects which are unreachable and therefore are candidates for being collected. What mak

Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)

2012-06-08 Thread CM
On Jun 8, 8:27 am, Wolfgang Keller wrote: > > I want a gui designer that writes the gui code for me. I don't want to > > write gui code. what is the gui designer that is most popular? > > I tried boa-constructor, and it works, but I am concerned about how > > dated it seems to be with no updates i

what gui designer is everyone using

2012-06-08 Thread loïc Lauréote
Hi, pyQt is really good for fast graphic GUI design. Maybe not the best for beginners,cause this can't allow them to understand how to code GUIs. And as said before, for each modification you need to regenerate the code,it's sometimes boring. (sorry) Loïc From: laureote-

Re: Python libraries portable?

2012-06-08 Thread Terry Reedy
On 6/8/2012 4:09 AM, Alister wrote: On Thu, 07 Jun 2012 20:20:47 +, jkells wrote: We are new to developing applications with Python. A question came up concerning Python libraries being portable between Architectures. More specifically, can we take a python library that runs on a X86 archi

Re: Order a list to get a hierarchical order

2012-06-08 Thread Thibaut DIRLIK
Thanks for your help, I'll test this. 2012/6/8 Peter Otten <__pete...@web.de> > Ivars Geidans wrote: > > > def append_node(n, l, ls): > > ls.append(n) > > for c in [nc for nc in l if nc.parent is n]: > > append_node(c, l, ls) > > return ls > > > > def sort_nodes(l): > > ls

Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)

2012-06-08 Thread Wolfgang Keller
> I want a gui designer that writes the gui code for me. I don't want to > write gui code. what is the gui designer that is most popular? > I tried boa-constructor, and it works, but I am concerned about how > dated it seems to be with no updates in over six years. Sorry to "hijack" your thread, b

what gui designer is everyone using

2012-06-08 Thread loïc Lauréote
Hi, pyQt is really good for fast graphic GUI designing. Maybe not the best for beginners,cause this can't allow them to understand how to code GUIs. And as said before, for each modification not need to regenerate the code,it's sometimes boring Loïc > From: tis...@stackless.com > Subje

Re: Order a list to get a hierarchical order

2012-06-08 Thread Peter Otten
Ivars Geidans wrote: > def append_node(n, l, ls): > ls.append(n) > for c in [nc for nc in l if nc.parent is n]: > append_node(c, l, ls) > return ls > > def sort_nodes(l): > ls = [] > for r in l: > if r.parent == None: > append_node(r, l, ls) > >

Re: Order a list to get a hierarchical order

2012-06-08 Thread Peter Otten
Ivars Geidans wrote: > Something like this? Or this (I'm reusing some of your code but let the built-in sorted() do the hard work): #!/usr/bin/env python3 import random def _reverse_iterpath(node): while node is not None: yield node.name node = node.parent def path(node):

Re: Order a list to get a hierarchical order

2012-06-08 Thread Ivars Geidans
Something like this? #!/usr/bin/env python3 import random class Node: def __init__(self, parent, name): self.parent, self.name = parent, name def __repr__(self): return self.name p_1 = Node(None, 'Parent #1') p_2 = Node(None, 'Parent #2') c_1_1 = Node(p_1, 'Child #1.1')

Order a list to get a hierarchical order

2012-06-08 Thread Thibaut DIRLIK
Hi, Having a list of objet with a parent_id attribute pointing to a parent, I want to order this list like this : [Parent #1, Child #1.1, Child#1.1.1, Child#1.1.2, Child#1.2, Parent #2, Child #2.1, ...] Any clue on how to do this ? Thanks, -- http://mail.python.org/mailman/listinfo/python-list

Re: what gui designer is everyone using

2012-06-08 Thread Christian Tismer
Hi Miki, Yes, and this works very well. As a side effect it also serves as a template when you need to change certain things dynamically. You can pick snippets for your Gui dynamication. But as a strong recommendation: never ever change the generated code. Import the generated classes and derive

Re: what gui designer is everyone using

2012-06-08 Thread Christian Tismer
I used wx and Boa years before and Was quite pleased. In these days I switched to Qt with PySide. Qt designer works quite well. If you have the choice, then my recommendation is this. Cheers - chris Sent from my Ei4Steve On Jun 8, 2012, at 8:11, Alister wrote: > On Thu, 07 Jun 2012 20:58:09

Re: what gui designer is everyone using

2012-06-08 Thread Alister
On Thu, 07 Jun 2012 20:58:09 -0700, CM wrote: > On Jun 5, 10:10 am, Mark R Rivet wrote: >> I want a gui designer that writes the gui code for me. I don't want to >> write gui code. what is the gui designer that is most popular? >> I tried boa-constructor, and it works, but I am concerned about ho

Re: Python libraries portable?

2012-06-08 Thread Alister
On Thu, 07 Jun 2012 20:20:47 +, jkells wrote: > We are new to developing applications with Python. A question came up > concerning Python libraries being portable between Architectures. > More specifically, can we take a python library that runs on a X86 > architecture and run it on a SPAR

Re: what gui designer is everyone using

2012-06-08 Thread Chris Angelico
On Fri, Jun 8, 2012 at 7:18 AM, Kevin Walzer wrote: > On 6/5/12 10:10 AM, Mark R Rivet wrote: >> >> I want a gui designer that writes the gui code for me. I don't want to >> write gui code. what is the gui designer that is most popular? >> I tried boa-constructor, and it works, but I am concerned