Re: argparse zero-length switch

2011-10-15 Thread Gregory Ewing
Steven D'Aprano wrote: And it isn't like you gain any extra clarity or expressiveness, or even a major saving of typing! "-s" vs "@". You don't even save a key stroke: "@" requires two keystrokes, just as "-s" does. Also keep in mind that not all keystrokes are equal. Someone who uses all thei

Re: SciPy/NumPy: read, write images using Python3

2011-10-15 Thread Christoph Gohlke
On Oct 9, 8:43 am, thegripper wrote: > In SciPy / NumPy, the primary way to read and write images is PIL. But > PIL does not yet support Python3. Is there some good way to read, > write, and resize images in a NumPy and Python3 environment? Try Scikits.image . It uses a

Re: argparse zero-length switch

2011-10-15 Thread Steven D'Aprano
On Sat, 15 Oct 2011 20:29:40 -0700, Carl Banks wrote: > I don't really care for or agree with Steven and Ben Finney's foolish > consistency. I already weighed it against the benefits of consistency, > and decided that this parameter was easily important enough to warrant > special treatment. It'

Re: How do I get curses to work in Python 3.2 on win-64?

2011-10-15 Thread Christoph Gohlke
On Oct 15, 1:13 pm, Jan Sundström wrote: > How do I get curses to work in Python 3.2 on win-64? > > I'm new to Python and when exploring Python in console I want to use > some > simple functions for console programming that don't emulate a > typewriter > terminal but rather a text screen terminal.

Re: Usefulness of the "not in" operator

2011-10-15 Thread Steven D'Aprano
On Sat, 15 Oct 2011 15:04:24 -0700, DevPlayer wrote: > 1. I thought "x not in y" was later added as syntax sugar for "not x in > y" > meaning they used the same set of tokens. (Too lazy to check the actual > tokens) Whether the compiler has a special token for "not in" is irrelevant. Perhaps it

Re: argparse zero-length switch

2011-10-15 Thread Chris Angelico
On Sun, Oct 16, 2011 at 2:29 PM, Carl Banks wrote: > I don't really care for or agree with Steven and Ben Finney's foolish > consistency.  I already weighed it against the benefits of consistency, and > decided that this parameter was easily important enough to warrant special > treatment.  It'

Re: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-15 Thread Carl Banks
On Friday, October 14, 2011 6:23:15 PM UTC-7, alex23 wrote: > On Oct 14, 4:56 pm, Carl Banks > wrote: > > But you can see that, fully realized, syntax like that can do much more > > than can be done with library code. > > Well sure, but imaginary syntax can do _anything_. That doesn't mean > it'

Re: argparse zero-length switch

2011-10-15 Thread Carl Banks
On Friday, October 14, 2011 12:41:26 AM UTC-7, Peter Otten wrote: > Carl Banks wrote: > > > Is it possible to specify a zero-length switch? Here's what I mean. > > > > I have a use case where some users would have to enter a section name on > > the command line almost every time, whereas other u

Re: Reading a file into a data structure....

2011-10-15 Thread MrPink
I did not understand what a tuple was. So it was very hard for me to understand what a namedtuple was and follow the code. Then I looked up the word at dictionary.com and got this: http://dictionary.reference.com/browse/tuple tuple: computing a row of values in a relational database Now I under

Re: Reading a file into a data structure....

2011-10-15 Thread Troy S
Chris, Thanks for the help. I am using the powerball numbers from this text file downloaded from the site. http://www.powerball.com/powerball/winnums-text.txt The first row is the header/fieldnames and the file starts off like this: Draw Date WB1 WB2 WB3 WB4 WB5 PB PP 10/12/2011 43 10 12 23

Re: Loop through a dict changing keys

2011-10-15 Thread PoD
On Sat, 15 Oct 2011 11:00:17 -0700, Gnarlodious wrote: > What is the best way (Python 3) to loop through dict keys, examine the > string, change them if needed, and save the changes to the same dict? > > So for input like this: > {'Mobile': 'string', 'context': '', 'order': '7', > 'time': 'True'}

Re: type(), modules: clarification please

2011-10-15 Thread Chris Rebert
On Sat, Oct 15, 2011 at 4:00 PM, Shane wrote: > Hi, > > When one writes, > >> className='Employee' >> baseClasses = ... >> dictionary = { ... } >> newClass = type( className, , dictionary) > > in what module does newClass belong? If it's the current module That does seem to be the case. > what c

re: type(), modules: clarification please

2011-10-15 Thread Shane
Hi, When one writes, > className='Employee' > baseClasses = ... > dictionary = { ... } > newClass = type( className, , dictionary) in what module does newClass belong? If it's the current module what code do I run to print out the name of that module in a.b.c... form? Related: If I want to make

Re: Usefulness of the "not in" operator

2011-10-15 Thread DevPlayer
On Oct 8, 8:41 am, Alain Ketterlin wrote: > candide writes: > > Python provides > > >     -- the not operator, meaning logical negation > >     -- the in operator, meaning membership > > > On the other hand, Python provides the not in operator meaning > > non-membership. However, it seems we can

Re: I am a newbie for python and try to understand class Inheritance.

2011-10-15 Thread DevPlayer
On Oct 15, 2:20 am, aaabb...@hotmail.com wrote: > Test.py > --- > #!/usr/bin/python > > from my_lib import my_function > > class MyClass(my_function): # usually class names start capital > > """We know you're not forgetting to document.""" > >     def __init__(self, name): > sup

Re: How to generate error when argument are not supplied and there is no explicit defults (in optparse)?

2011-10-15 Thread ru...@yahoo.com
On 10/14/2011 03:29 PM, Peng Yu wrote: > Hi, > > The following code doesn't give me error, even I don't specify the > value of filename from the command line arguments. filename gets > 'None'. I checked the manual, but I don't see a way to let > OptionParser fail if an argument's value (which has n

Re: Can I search a list for a range of values?

2011-10-15 Thread DevPlayer
On Oct 14, 7:46 pm, Ian Kelly wrote: > On Fri, Oct 14, 2011 at 5:36 PM, Troy S wrote: > (Python 3) > date_range = {d:v for d, v in source_dict.items() if '20110809' <= d > <= '20110911'} > Ian- Hide quoted text - > - Show quoted text - (Python 2.7) supports dictionary comprehensions. I prehaps a

Re: Loop through a dict changing keys

2011-10-15 Thread 88888 dihedral
Is there an FAQ available here? Please check the PYTHON official site and the active state PYTHON examples first, also check the PLEAC comparisons of a lot programming languages first! - Nothing is more thrilling to o

How do I get curses to work in Python 3.2 on win-64?

2011-10-15 Thread Jan Sundström
How do I get curses to work in Python 3.2 on win-64? I'm new to Python and when exploring Python in console I want to use some simple functions for console programming that don't emulate a typewriter terminal but rather a text screen terminal. I want to be able to clear the screen, position the cu

Re: Usefulness of the "not in" operator

2011-10-15 Thread Alexander Kapps
On 10.10.2011 19:29, Nobody wrote: On Sun, 09 Oct 2011 02:25:27 +0200, Alexander Kapps wrote: Even if it's off-topic, could you add some similar explanations for Church numerals (maybe Lambda calculus it isn't too much?) The Church numeral for N is a function of two arguments which applies it

Re: Loop through a dict changing keys

2011-10-15 Thread Alexander Kapps
On 15.10.2011 20:00, Gnarlodious wrote: What is the best way (Python 3) to loop through dict keys, examine the string, change them if needed, and save the changes to the same dict? So for input like this: {'Mobile': 'string', 'context': '', 'order': '7', 'time': 'True'} I want to booleanize 'Tr

Re: hi can someone help please key bind

2011-10-15 Thread Alexander Kapps
On 15.10.2011 19:30, Gary wrote: Hi im trying to use key bind on Tkinter to call this function def Start(): for i in range(60,-1,-1): ent['text'] = i time.sleep(1) root.update() ent['text'] = 'Time Out!' root.update() i know the function is ok as i have assigned a button and i calls the functio

Re: Loop through a dict changing keys

2011-10-15 Thread MRAB
On 15/10/2011 19:00, Gnarlodious wrote: What is the best way (Python 3) to loop through dict keys, examine the string, change them if needed, and save the changes to the same dict? So for input like this: {'Mobile': 'string', 'context': '', 'order': '7', 'time': 'True'} I want to booleanize 'Tr

Re: hi can someone help please key bind

2011-10-15 Thread MRAB
On 15/10/2011 18:30, Gary wrote: Hi im trying to use key bind on Tkinter to call this function def Start(): for i in range(60,-1,-1): ent['text'] = i time.sleep(1) root.update() ent['text'] = 'Time Out!' root.update() i know the function is ok as i have assigned

Loop through a dict changing keys

2011-10-15 Thread Gnarlodious
What is the best way (Python 3) to loop through dict keys, examine the string, change them if needed, and save the changes to the same dict? So for input like this: {'Mobile': 'string', 'context': '', 'order': '7', 'time': 'True'} I want to booleanize 'True', turn '7' into an integer, escape '',

Python hangs: Problem with wxPython, threading, pySerial, or events?

2011-10-15 Thread Ethan Swint
Hi- I'm experiencing crashes in my Win32 Python 2.7 application which appear to be linked to pyzmq. At the moment, I can't even kill the "python.exe *32" process in the Windows Task Manager. At the moment I'm running the script using Ipython by calling C:\Python27\pythonw.exe "/python27/sc

hi can someone help please key bind

2011-10-15 Thread Gary
Hi im trying to use key bind on Tkinter to call this function def Start(): for i in range(60,-1,-1): ent['text'] = i time.sleep(1) root.update() ent['text'] = 'Time Out!' root.update() i know the function is ok as i have assigned a button and i calls the function

Re: Opportunity missed by Python ?

2011-10-15 Thread 88888 dihedral
The undetected recursive call loop in some states that can be hacked or would hang and crush! Every program has to be run in a VM is just one solution but that will slow down a lot. -- http://mail.python.org/mailman/listinfo/python-list

Re: Opportunity missed by Python ?

2011-10-15 Thread geremy condra
On Fri, Oct 14, 2011 at 5:49 PM, alex23 wrote: > On Oct 13, 8:07 pm, Chris Angelico wrote: >> Python, as I found out to my detriment, is practically impossible to >> sandbox effectively. > > The latest version of PyPy introduces a prototype sandbox: > > http://pypy.org/features.html#sandboxing >

Help with beginner form using lpthw.web

2011-10-15 Thread pngrv
Hey -- I'm still learning what all of the different exceptions and errors mean. What I'd like to do is grab a bit of assistance figuring out the error I'm getting so that I can keep moving. My python code for this particular part of the app looks like this: class rs_request: def GET(self)

Re: Fwd: os.statvfs bug or my incompetence ?

2011-10-15 Thread Kev Dwyer
Peter G. Marczis wrote: Hello Peter, Welcome to the list. Have you tried calling statvfs from a C program? What happens if you do? Best regards, Kev -- http://mail.python.org/mailman/listinfo/python-list

Re: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-15 Thread Grant Edwards
On 2011-10-14, Westley Mart?nez wrote: > On Thu, Oct 13, 2011 at 11:56:20PM -0700, Carl Banks wrote: > > While we're at it, let's throw in the register keyword. Yah! C compilers have been ignoring it for ages, and I miss it. -- Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: Can I search a list for a range of values?

2011-10-15 Thread Chris Angelico
On Sat, Oct 15, 2011 at 10:53 PM, Steven D'Aprano wrote: > I'm not familiar with a language that uses Python syntax but "and" is a > bitwise and. Which language is that? > I'm not familiar with any either, it's just that I have a few habits that I slip into. ChrisA -- http://mail.python.org/mai

Re: Opportunity missed by Python ?

2011-10-15 Thread 88888 dihedral
Conversion utilities are used to ease the burdens for programmers to translate source scripts and codes into different languages or even the same language with revisions. Check for translators for C, C++, PASCAL, BASIC, and FORTRAN and also SWIG, PYREX, CYTHON, JYTHON and etc.. -- ht

Re: Can I search a list for a range of values?

2011-10-15 Thread Steven D'Aprano
Chris Angelico wrote: > Yeah, it's legal because you can nest fors and ifs in a list comp. > Stylistic difference, I used "if" instead of "and" because there's no > way that it could be a bitwise and. If you're using Python, there's no way that it could be a bitwise and. > (It's a cross-langua

Re: argparse zero-length switch

2011-10-15 Thread Steven D'Aprano
Carl Banks wrote: > So instead of typing this: > > sp subcommand -s abc foo bar > > they could type this: > > sp subcommand @abc foo bar > > Admittedly a small benefit. I would call it a *cost* and not a benefit at all. Instead of using a standard, familiar user interface for entering comman

Re: Want to make the transition to games?

2011-10-15 Thread Chris Withers
Please don't spam this list with jobs, especially if they have nothing to do with Python. If they do, use the job board instead: http://www.python.org/community/jobs/howto/ cheers, Chris On 12/10/2011 05:49, Marta wrote: Hi, I'm working as an onsite recruiting consultant and we are looking

Re: Seven Python Developers Needed $125K

2011-10-15 Thread Chris Withers
I'd suggest you post to the job board rather than spamming the list: http://www.python.org/community/jobs/howto/ cheers, Chris On 11/10/2011 19:16, WR wrote: Top Global Consulting Firm in NYC needs 7 Python Developers Up to $125K depending on experience Solid knowledge of fundamental Python

Re: Site to open blocked sites, and prohibited and encoded

2011-10-15 Thread Alec Taylor
Large list: http://proxy.org/ On Sat, Oct 15, 2011 at 7:44 PM, porxy wrote: > Site to open blocked sites, and prohibited and encoded > > http://myway.x90x.net/ > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list

Re: why msvcrt.printf show the first char only?

2011-10-15 Thread Gabriel Genellina
On 12 oct, 08:50, Nobody wrote: > On Wed, 12 Oct 2011 04:18:25 -0700, install...@189.cn wrote: > > from ctypes import * > > msvcrt = cdll.msvcrt > > message_string = "Hello world!\n" > > print(msvcrt.printf("Testing: %s", message_string)) > > > when running in eclipse, the result is: > > 1 > > T >

Re: I am a newbie for python and try to understand class Inheritance.

2011-10-15 Thread Chris Rebert
On Sat, Oct 15, 2011 at 12:59 AM, wrote: > On 10月15日, 上午12时04分, Chris Rebert wrote: >> On Fri, Oct 14, 2011 at 11:20 PM,   wrote: >> >    my_class.main() >> >> Your class doesn't define any method named "main" (you only defined >> test() and __initial__() ), so this call will fail. > how to do

Re: I am a newbie for python and try to understand class Inheritance.

2011-10-15 Thread aaabbb16
On 10月15日, 上午12时04分, Chris Rebert wrote: > On Fri, Oct 14, 2011 at 11:20 PM,   wrote: > > Test.py > > #!/usr/bin/python > > from my_lib import test > > class my_class(my_function.name): > > Why are you subclassing my_function.name and not just my_function? try to inherit or change "name" attribute

Re: I am a newbie for python and try to understand class Inheritance.

2011-10-15 Thread Chris Rebert
On Sat, Oct 15, 2011 at 12:09 AM, Jason Swails wrote: > For instance, let's say you want to deal with shapes.  You can define a > shape via a class > > class Shape(object): >    """ Base shape class """ > Now we get into inheritance.  Let's suppose that we want a specific type of > shape.  For i

Re: I am a newbie for python and try to understand class Inheritance.

2011-10-15 Thread Jason Swails
On Sat, Oct 15, 2011 at 2:20 AM, wrote: > Test.py > #!/usr/bin/python > from my_lib import my_function > class my_class(my_function.name): > Classes must inherit from other classes -- not variables or functions. >def __initial__(self, name); > This should be "def __init__(self, name):" (:

Re: I am a newbie for python and try to understand class Inheritance.

2011-10-15 Thread Chris Rebert
On Fri, Oct 14, 2011 at 11:20 PM, wrote: > Test.py > #!/usr/bin/python > from my_lib import my_function > class my_class(my_function.name): Why are you subclassing my_function.name and not just my_function? >    def __initial__(self, name); >         pass The initializer method should be named