Re: Exec Statement Question

2009-11-30 Thread Marco Mariani
Jean-Michel Pichavant wrote: if which == '': i = 0 all = '' while i < len(meanings): table = '%s\n' % meanings[i] table += "\n \n composing HTML like that is painful, bug prone and insecure You should have a look at http://tottinge.blogsome.com/meaningfulnames/ I

Re: Exec Statement Question

2009-11-30 Thread Carsten Haese
Victor Subervi wrote: > Taking out the parenthesis did it! Thanks. Now, you state this is an > option of last resort. Although this does indeed achieve my desired aim, > here is a complete example of what I am trying to achieve. The following > is from 'createTables2.py': > > for table in tables

Re: Feature request: String-inferred names

2009-11-30 Thread Bruno Desthuilliers
Lie Ryan a écrit : On 11/28/2009 3:08 PM, The Music Guy wrote: (snip the part about the proposed feature - which I don't like but that's not the point) My projects rely on a lot of metaclassing for the automatic generation of properties and methods, which saves tremendous amounts of coding.

Re: * for generic unpacking and not just for arguments?

2009-11-30 Thread Tim Chase
So you want *x behave radically different in subtly different contexts? a, *x, b = iterator would give x a list and iterator run to exhaustion, whereas: Using the infix "*x" I'd be fine with x being an iterator too in the same way as the postfix "*x" I'd enjoy, but this would require consum

Re: Python py2exe - memory load error

2009-11-30 Thread koranthala
On Nov 30, 10:10 am, koranthala wrote: > This is cross post from stackoverflow - I couldnt get the solution > there. Hopefully, nobody would mind. > > I am creating a medium level application in Python. Everything works > well now, and I am trying to make this a windows executable with > py2exe. T

Re: New to python

2009-11-30 Thread Gary Herron
Ronn Ross wrote: I have recently come across something called a struct. I have googled this, but have note found a good explanation. Can someone give me a good definition or point me to a page that has one. Thanks Well... Since you don't give us *any* information, other then the single word

Re: [Edu-sig] teaching python using turtle module

2009-11-30 Thread Gregor Lingl
Hello Brian, I think the most natural use of the if statement (using turtle graphics) occurs in recursive functions drawing trees, fractals and the like. This is well known from Logo, where recursion is the canonical way of doing repetitions. (But note, that Logo has tail recursion optimizaton!)

Re: Can't print Chinese to HTTP

2009-11-30 Thread Gnarlodious
Thanks for the help, but it doesn't work. All I get is an error like: UnicodeEncodeError: 'ascii' codec can't encode character '\\u0107' in position 0: ordinal not in range(128) It does work in Terminal interactively, after I import the sys module. But my script doesn't act the same. Here is my e

Re: Exec Statement Question

2009-11-30 Thread Dave Angel
Victor Subervi wrote: On Sun, Nov 29, 2009 at 10:23 PM, Dave Angel wrote: exec is a statement, and statements don't have "return values." It's not a function, so there are no parentheses in its syntax, either. exec is also a technique of last resort; there's nearly always a better/safer

Re: New to python

2009-11-30 Thread inhahe
to put it simplistically it's a way of combining multiple variables into one for example, for a person you could have person.haircolor person.echnicity person.age etc. but you can then also manipulate 'person' as a whole like you would any other variable, such as x[n] = person a struct, as far a

Re: Completely OT

2009-11-30 Thread Rami Chowdhury
On Mon, Nov 30, 2009 at 04:26, Victor Subervi wrote: > Hi; > I need a recommendation. I want to print out data like this: > > blue > red > > and enable the user to select the various colors he wants to add to a list > that would populate itself on the same page where the selections are, and > then

Re: New to python

2009-11-30 Thread Rami Chowdhury
On Mon, Nov 30, 2009 at 08:20, Ronn Ross wrote: > I have recently come across something called a struct. I have googled this, > but have note found a good explanation. Can someone give me a good > definition or point me to a page that has one. > Where did you come across a "struct"? Depending on

Re: problem with lambda / closures

2009-11-30 Thread inhahe
On Mon, Nov 30, 2009 at 10:54 AM, Benjamin Kaplan wrote: > > I don't know if anyone considers python's incomplete implementation of > closures a "feature" but it's documented so it's not really a bug > either. I believe there is a trick with default arguments to get this > to work, but I don't use

Questions about list-creation

2009-11-30 Thread Manuel Graune
Hello, in (most) python documentation the syntax "list()" and "[]" is treated as being more or less the same thing. For example "help([])" and "help(list())" point to the same documentation. Since there are at least two cases where this similarity is not the case, (see below) can someone explain

Re: Exec Statement Question

2009-11-30 Thread Victor Subervi
On Mon, Nov 30, 2009 at 12:25 PM, Carsten Haese wrote: > Victor Subervi wrote: > > Taking out the parenthesis did it! Thanks. Now, you state this is an > > option of last resort. Although this does indeed achieve my desired aim, > > here is a complete example of what I am trying to achieve. The fo

Re: Completely OT

2009-11-30 Thread Victor Subervi
On Mon, Nov 30, 2009 at 1:15 PM, Rami Chowdhury wrote: > On Mon, Nov 30, 2009 at 04:26, Victor Subervi > wrote: > > Hi; > > I need a recommendation. I want to print out data like this: > > > > blue > > red > > > > and enable the user to select the various colors he wants to add to a > list > > th

Re: Exec Statement Question

2009-11-30 Thread Victor Subervi
On Mon, Nov 30, 2009 at 1:12 PM, Dave Angel wrote: > Victor Subervi wrote: > >> On Sun, Nov 29, 2009 at 10:23 PM, Dave Angel wrote: >> >> >> >>> exec is a statement, and statements don't have "return values." It's >>> not >>> a function, so there are no parentheses in its syntax, either. exec

Re: how to format a python source file with tools?

2009-11-30 Thread Falcolas
On Nov 30, 7:37 am, gil_johnson wrote: > On Nov 27, 9:58 am, "Diez B. Roggisch" wrote: > [...] > > > > so i would like to have a tool to intelligently format the code for me > > > and make the code more beautiful > > > and automated. > > > This is not possible. Consider the following situation: >

os.starfile() linux

2009-11-30 Thread joao abrantes
i want a python program to start another python script and i want it to open a new shell and to put the output of the new python program there.. how can it be done? -- http://mail.python.org/mailman/listinfo/python-list

Re: Completely OT

2009-11-30 Thread inhahe
i'm pretty new to javascript programming, but i'm pretty sure you just need ajax, which AFAIK is a highly technical way of saying "using javascript in a way that makes web pages interactive" JSON afaik is a way of data to and from the server that allows for lists and more variable types and such, b

Re: New to python

2009-11-30 Thread Paul Boddie
On 30 Nov, 18:14, inhahe wrote: > i don't think structs technically exist in Python (though they exist > in C/C++), but you could always use a plain class like a struct, like > this, for a simple example: > > class Blah: >   pass > > b = blah() > b.eyecolor = "brown" [...] Yes, a "bare" class ca

Re: Req. for comments section "Basic Data" in intro book

2009-11-30 Thread Alf P. Steinbach
* Alf P. Steinbach: I added a section on "basic data" to ch 2 of my writings, an introduction to programming (with Python as main language). The intended reader is someone who is intelligent and wants to learn programming but knows little or nothing about it. As before it would be nice with

Re: problem with lambda / closures

2009-11-30 Thread Jussi Piitulainen
Benjamin Kaplan writes: > On Monday, November 30, 2009, Louis Steinberg wrote: > > I have run into what seems to be a major bug, but given my short > > exposure to Python is probably just a feature: > > > > running > > Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32) > > [GCC 4.0.1 (Apple Inc. bui

Re: PySerial and termios

2009-11-30 Thread Grant Edwards
On 2009-11-30, a b wrote: > I have a pain in the a** problem with pyserial- it works 90% > of time but on the 10% of time it thorows and termios.error > exception with the value (5, 'Input/output error') and i > cannot get rid of it :( Sounds like faulty converter or a bug in the device driver to

Re: reading from a text file

2009-11-30 Thread inhahe
i don't understand the point of using 'with' but i don't understand what 'with' does at all i've tried to understand it a few times anyway here: import random result = random.choice(open("c:\\test.txt").readlines()) On Mon, Nov 30, 2009 at 10:41 AM, Tim Golden wrote: > Olof Bjarnason wrote: >> >

Re: Completely OT

2009-11-30 Thread Victor Subervi
On Mon, Nov 30, 2009 at 1:39 PM, inhahe wrote: > i'm pretty new to javascript programming, but i'm pretty sure you just > need ajax, which AFAIK is a highly technical way of saying "using > javascript in a way that makes web pages interactive" > JSON afaik is a way of data to and from the server

Re: flattening and rebuilding a simple list of lists

2009-11-30 Thread Esmail
Ok, well I'm glad no one threw up their hands in horror to the code I posted. I'll have to study the alternate solutions offered (thanks!) Esmail -- http://mail.python.org/mailman/listinfo/python-list

Python PIL and Vista/Windows 7 .. show() not working ...

2009-11-30 Thread Esmail
Hello all. I am using the PIL 1.1.6 and Python 2.6.x under XP without any problems. However, I can't display any images under Vista or Windows 7. I could understand Windows 7 as it's relatively new, but Vista has been around for a bit. Sample code: import Image im = Image.open('c://mypic.jpg

Re: Completely OT

2009-11-30 Thread inhahe
On Mon, Nov 30, 2009 at 12:49 PM, Victor Subervi wrote: > > > On Mon, Nov 30, 2009 at 1:39 PM, inhahe wrote: >> >> i'm pretty new to javascript programming, but i'm pretty sure you just >> need ajax, which AFAIK is a highly technical way of saying "using >> javascript in a way that makes web page

Re: Noobie python shell question

2009-11-30 Thread John Posner
On Sun, 29 Nov 2009 22:03:09 -0500, tuxsun wrote: I've been working in the shell on and off all day, and need to see if a function I defined earlier is defined in the current shell I'm working in. Is there a shell command to get of list of functions I've defined? How about this: #

Re: Completely OT

2009-11-30 Thread inhahe
On Mon, Nov 30, 2009 at 12:58 PM, inhahe wrote: > On Mon, Nov 30, 2009 at 12:49 PM, Victor Subervi > wrote: >> >> >> If I'm not mistaken, that won't help me actually print to screen the user's >> choices as he selects them, which in my application, is important. Please >> advise. >> TIA, >> V > >

Re: semantics of ** (unexpected/inconsistent?)

2009-11-30 Thread MRAB
Lie Ryan wrote: On 11/30/2009 12:38 PM, Esmail wrote: Thanks all!! I get it now :-) It helped to have a number of different explanations, thanks for taking the time to post. Much appreciated. I generally do not expect operator precedence to be reliable at all except for: + - (binary ops, n

Re: Python PIL and Vista/Windows 7 .. show() not working ...

2009-11-30 Thread Esmail
> >   im = Image.open('c://mypic.jpg') sorry, slip of the finger, there's only one forward slash or you can use two backward slashes. The problem isn't with opening it (I know it opens fine since I can get its size attribute via im.size) - the show() is the problem. Esmail -- http://mail.python

Re: Python Statements/Keyword Localization

2009-11-30 Thread Emanuele D'Arrigo
Thank you all for the insights. I particularly like the broad spread of opinions on the subject. Indeed when I wrote the original post my thoughts were with those young students of non-English speaking countries that start learning to program before they learn English. My case is almost one of tho

Re: Feature request: String-inferred names

2009-11-30 Thread Lie Ryan
On 12/1/2009 3:35 AM, Bruno Desthuilliers wrote: Lie Ryan a écrit : On 11/28/2009 3:08 PM, The Music Guy wrote: (snip the part about the proposed feature - which I don't like but that's not the point) My projects rely on a lot of metaclassing for the automatic generation of properties and me

Re: Questions about list-creation

2009-11-30 Thread inhahe
On Mon, Nov 30, 2009 at 12:22 PM, Manuel Graune wrote: > > Hello, > > in (most) python documentation the syntax "list()" > and "[]" is treated as being more or less the same > thing. For example "help([])" and "help(list())" point > to the same documentation. Since there are at least > two cases w

Re: Can't print Chinese to HTTP

2009-11-30 Thread Aahz
In article , Gnarlodious wrote: > >Thanks for the help, but it doesn't work. All I get is an error like: > >UnicodeEncodeError: 'ascii' codec can't encode character '\\u0107' in >position 0: ordinal not in range(128) No time to give you more info, but you probably need to change the encoding of

Re: Questions about list-creation

2009-11-30 Thread Lie Ryan
On 12/1/2009 4:22 AM, Manuel Graune wrote: Hello, in (most) python documentation the syntax "list()" and "[]" is treated as being more or less the same thing. For example "help([])" and "help(list())" point to the same documentation. Since there are at least two cases where this similarity is n

Re: Completely OT

2009-11-30 Thread Victor Subervi
On Mon, Nov 30, 2009 at 2:00 PM, inhahe wrote: > On Mon, Nov 30, 2009 at 12:58 PM, inhahe wrote: > > On Mon, Nov 30, 2009 at 12:49 PM, Victor Subervi > > wrote: > >> > >> > >> If I'm not mistaken, that won't help me actually print to screen the > user's > >> choices as he selects them, which in

Re: Completely OT

2009-11-30 Thread Victor Subervi
On Mon, Nov 30, 2009 at 1:35 PM, Dennis Lee Bieber wrote: > On Mon, 30 Nov 2009 07:26:09 -0500, Victor Subervi > declaimed the following in > gmane.comp.python.general: > > > Hi; > > I need a recommendation. I want to print out data like this: > > > > blue > > red > > >Why all the off-pag

Re: Questions about list-creation

2009-11-30 Thread Mel
Manuel Graune wrote: > in (most) python documentation the syntax "list()" > and "[]" is treated as being more or less the same > thing. For example "help([])" and "help(list())" point > to the same documentation. Since there are at least > two cases where this similarity is not the case, (see belo

Re: Questions about list-creation

2009-11-30 Thread inhahe
i should also mention that a=[i for i in xrange(10)] and b=list(j for j in xrange(10)) isn't really just a difference of using [] vs. list() the first case is a list comprehension, the second case is a generator comprehension which is then converted to a list (the bug only applies to list compr

Re: reading from a text file

2009-11-30 Thread Tim Golden
inhahe wrote: i don't understand the point of using 'with' but i don't understand what 'with' does at all i've tried to understand it a few times anyway here: import random result = random.choice(open("c:\\test.txt").readlines()) Yep. That'll do the trick. The point of "with" is that, while i

Re: Can't print Chinese to HTTP

2009-11-30 Thread Lie Ryan
On 12/1/2009 4:05 AM, Gnarlodious wrote: Thanks for the help, but it doesn't work. All I get is an error like: UnicodeEncodeError: 'ascii' codec can't encode character '\\u0107' in position 0: ordinal not in range(128) The error says it all; you're trying to encode the chinese character using

Re: Completely OT

2009-11-30 Thread inhahe
On Mon, Nov 30, 2009 at 1:21 PM, Victor Subervi wrote: > On Mon, Nov 30, 2009 at 2:00 PM, inhahe wrote: >> >> On Mon, Nov 30, 2009 at 12:58 PM, inhahe wrote: >> > On Mon, Nov 30, 2009 at 12:49 PM, Victor Subervi >> > wrote: >> >> >> >> >> >> If I'm not mistaken, that won't help me actually prin

Re: Completely OT

2009-11-30 Thread Victor Subervi
On Mon, Nov 30, 2009 at 2:37 PM, inhahe wrote: > On Mon, Nov 30, 2009 at 1:21 PM, Victor Subervi > wrote: > > On Mon, Nov 30, 2009 at 2:00 PM, inhahe wrote: > >> > >> On Mon, Nov 30, 2009 at 12:58 PM, inhahe wrote: > >> > On Mon, Nov 30, 2009 at 12:49 PM, Victor Subervi > >> > wrote: > >> >>

Re: multiprocessing.connection with ssl

2009-11-30 Thread Ned Deily
In article <8ff1698c-8205-4171-9e41-2e382bd52...@g23g2000vbr.googlegroups.com>, Xavier wrote: > I've hacked multiprocessing.connection (in a basic way) to allow ssl > encryption using ssl.wrap_socket. > > Anybody knows how i can contribute this to main developers? If you haven't already, open

Re: semantics of ** (unexpected/inconsistent?)

2009-11-30 Thread Chris Rebert
> On Mon, Nov 30, 2009 at 3:46 AM, Gregory Ewing > wrote: >> Esmail wrote: >> >>> Wow .. never heard of Concatenative_languages languages before or the >>> distinction you make. Your distinction explains the behavior, but I >>> find it somewhat counter-intuitive. >> >> You shouldn't find it any mo

Re: High-performance Python websites

2009-11-30 Thread inhahe
On Wed, Nov 25, 2009 at 7:33 PM, ShoqulKutlu wrote: > Hi, > > Managing load of high volume of visitors is a common issue for all > kind of web technologies. I mean this is not the python issue. This > issue is mostly about server level designs. You need to supply load > balancing for both web serv

Re: semantics of ** (unexpected/inconsistent?)

2009-11-30 Thread inhahe
On Mon, Nov 30, 2009 at 1:53 PM, Chris Rebert wrote: >> On Mon, Nov 30, 2009 at 3:46 AM, Gregory Ewing >> wrote: >>> Esmail wrote: >>> Wow .. never heard of Concatenative_languages languages before or the distinction you make. Your distinction explains the behavior, but I find it s

Re: Can't print Chinese to HTTP

2009-11-30 Thread Ned Deily
In article , Gnarlodious wrote: > It does work in Terminal interactively, after I import the sys module. > But my script doesn't act the same. Here is my entire script: > > #!/usr/bin/python > print("Content-type:text/plain;charset=utf-8\n\n") > import sys > sys.stdout.buffer.write('ùÁÄn'.enco

Re: Python PIL and Vista/Windows 7 .. show() not working ...

2009-11-30 Thread Stephen Hansen
On Mon, Nov 30, 2009 at 9:57 AM, Esmail wrote: > Hello all. > > I am using the PIL 1.1.6 and Python 2.6.x under XP without any > problems. However, I can't display any images under Vista > or Windows 7. I could understand Windows 7 as it's relatively > new, but Vista has been around for a bit. >

Re: how to format a python source file with tools?

2009-11-30 Thread Lie Ryan
On 12/1/2009 4:30 AM, Falcolas wrote: Nonetheless, it would be better to implement coding standards that everyone can stick to. Agreed. You can't solve social issues with program. -- http://mail.python.org/mailman/listinfo/python-list

Re: semantics of ** (unexpected/inconsistent?)

2009-11-30 Thread Lie Ryan
On 12/1/2009 5:58 AM, inhahe wrote: i wasn't suggesting it as a feature for python, just pointing out why it might seem counterintuitive. I'm interested, what do YOU (inhahe) think the result should be? Should both become -9 or both become 9. What was your expectation when you wrote that post

Re: Completely OT

2009-11-30 Thread Lie Ryan
On 12/1/2009 5:00 AM, inhahe wrote: On Mon, Nov 30, 2009 at 12:58 PM, inhahe wrote: On Mon, Nov 30, 2009 at 12:49 PM, Victor Subervi wrote: If I'm not mistaken, that won't help me actually print to screen the user's choices as he selects them, which in my application, is important. Please

os.remove() permission problem

2009-11-30 Thread Victor Subervi
Hi; I get the following error when I try os.remove(file) *OSError*: [Errno 13] Permission denied: 'particulars.py' args = (13, 'Permission denied') errno = 13 filename = 'particulars.py' strerror = 'Permission denied' Here are the permissions: -rwxr-xr-x 1 root root 45

Re: Can't print Chinese to HTTP

2009-11-30 Thread exarkun
On 05:05 pm, gnarlodi...@gmail.com wrote: Thanks for the help, but it doesn't work. All I get is an error like: UnicodeEncodeError: 'ascii' codec can't encode character '\\u0107' in position 0: ordinal not in range(128) It does work in Terminal interactively, after I import the sys module. But

Re: semantics of ** (unexpected/inconsistent?)

2009-11-30 Thread Brian J Mingus
On Sun, Nov 29, 2009 at 5:58 PM, Esmail wrote: > Brian J Mingus wrote: > >> >> >> >> I think you answered your own question. 3**2 comes first in the order of >> operations, followed by the negation. >> > > No, that's not the problem, I'm ok with the operator precedence of - vs ** > > My problem i

Re: Questions about list-creation

2009-11-30 Thread Stephen Hansen
On Mon, Nov 30, 2009 at 9:22 AM, Manuel Graune wrote: > in (most) python documentation the syntax "list()" > and "[]" is treated as being more or less the same > thing. For example "help([])" and "help(list())" point > to the same documentation. Since there are at least > two cases where this simi

Re: Python PIL and Vista/Windows 7 .. show() not working ...

2009-11-30 Thread Lie Ryan
On 12/1/2009 5:04 AM, Esmail wrote: im = Image.open('c://mypic.jpg') sorry, slip of the finger, there's only one forward slash or you can use two backward slashes. The problem isn't with opening it (I know it opens fine since I can get its size attribute via im.size) - the show() is the pr

Re: Questions about list-creation

2009-11-30 Thread Luis Zarrabeitia
On Monday 30 November 2009 12:22:17 pm Manuel Graune wrote: > > when using local variables in list comprehensions, say > > a=[i for i in xrange(10)] > > the local variable is not destroyed afterwards: [...] > b=list(j for j in xrange(10)) > > the local variable is destroyed after use: Actually, []

Re: os.remove() permission problem

2009-11-30 Thread Victor Subervi
On Mon, Nov 30, 2009 at 3:21 PM, Victor Subervi wrote: > Hi; > I get the following error when I try > os.remove(file) > > *OSError*: [Errno 13] Permission denied: 'particulars.py' > args = (13, 'Permission denied') > errno = 13 > filename = 'particulars.py' > strerror = 'Pe

Re: Python PIL and Vista/Windows 7 .. show() not working ...

2009-11-30 Thread Esmail
On Nov 30, 3:08 pm, Lie Ryan wrote: > > What's your default image viewer? im.show is intended to be for > debugging purpose and may always guaranteed to work if your image viewer > doesn't support receiving the file through the image to the program>. It's whatever the default windows viewer is

Re: os.remove() permission problem

2009-11-30 Thread Martijn Arts
On Mon, Nov 30, 2009 at 8:21 PM, Victor Subervi wrote: > Hi; > I get the following error when I try > os.remove(file) > > *OSError*: [Errno 13] Permission denied: 'particulars.py' > args = (13, 'Permission denied') > errno = 13 > filename = 'particulars.py' > strerror = 'Pe

Re: [Edu-sig] teaching python using turtle module

2009-11-30 Thread kirby urner
I'm glad turtle graphics intersected my thinking re extended precision decimals (Decimal type) on edu-sig just now. I've updated my tmods.py to contain a turtle rendering the plane-net of a T-mod: http://www.4dsolutions.net/ocn/python/tmod.py (runnable source) http://www.flickr.com/photos/17157..

Re: Variables with cross-module usage

2009-11-30 Thread Terry Reedy
Lie Ryan wrote: On 11/30/2009 12:00 PM, Terry Reedy wrote: Dennis Lee Bieber wrote: In these languages, the names always refer to the same location. Python confuses matters by having names that don't really refer to location, but are attached to the objects. In everyday life and natural lang

PyArg_ParseTupleAndKeywords in Python3.1

2009-11-30 Thread Joachim Dahl
I am updating an extension module from Python2.6 to Python3. I used to pass character codes to the extension module, for example, I would write: >>> foo('X') with the corresponding C extension routine defined as follows: static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds) { ch

Re: PyArg_ParseTupleAndKeywords in Python3.1

2009-11-30 Thread Joachim Dahl
Obviously the name of the C function and the char variable cannot both be foo, so the C code should be: static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds) { char foochar; char *kwlist[] = {"foochar", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwrds, "c", kwlist, &foocha

Re: Python Programming Challenges for beginners?

2009-11-30 Thread Edward A. Falk
In article <09ea817f-57a9-44a6-b815-299ae3ce7...@x5g2000prf.googlegroups.com>, alex23 wrote: >On Nov 27, 1:24 pm, astral orange <457r0...@gmail.com> wrote: >> I would like to test out what I know so far by solving programming >> challenges. > >Project Euler can be a lot of fun: http://projecteule

Re: parsing json data

2009-11-30 Thread Edward A. Falk
There's a json parsing library in 2.6. (Sadly, 2.6 is not out for Ubuntu yet.) -- -Ed Falk, f...@despams.r.us.com http://thespamdiaries.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: PyArg_ParseTupleAndKeywords in Python3.1

2009-11-30 Thread casevh
On Nov 30, 1:04 pm, Joachim Dahl wrote: > Obviously the name of the C function and the char variable cannot both > be foo, > so the C code should be: > > static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds) > { >   char foochar; >   char *kwlist[] = {"foochar", NULL}; >   if (!PyA

top-like behavior

2009-11-30 Thread Jonathan Haddad
Is there a specific library used for displaying up to date consoles in the same way top behaves? Thanks in advance, Jon -- http://mail.python.org/mailman/listinfo/python-list

Re: [Edu-sig] teaching python using turtle module

2009-11-30 Thread Alf P. Steinbach
* Edward Cherlin: On Sun, Nov 29, 2009 at 11:34, Brian Blais wrote: After a bit of playing, I realized that I couldn't think of many exaples which use turtle with conditional structures (if- and while- statements), Repeat is used much more often. but of course we can provide examples of any

Re: Feature request: String-inferred names

2009-11-30 Thread Terry Reedy
Brad Harms wrote: Well, yes, the names would have to be determined at run time. That's what getattr and setattr do, except that that do it in the context of an object rather than the local scope. However, I was under the impression that python's mechanism for looking up local names was the sam

Re: Python PIL and Vista/Windows 7 .. show() not working ...

2009-11-30 Thread David Bolen
Esmail writes: > I dug around in the docs and found a named parameter that I can set > when I > call show. > > Definition: im.show(self, title=None, command=None) > > I installed irfanview and specified it/its path in the parameter, > but that didn't work either. It's really quite puzzling in

Re: PySerial and termios

2009-11-30 Thread Glazner
On Nov 30, 7:41 pm, Grant Edwards wrote: > On 2009-11-30, a b wrote: > > > I have a pain in the a** problem with pyserial- it works 90% > > of time but on the 10% of time it thorows and termios.error > > exception with the value (5, 'Input/output error') and i > > cannot get rid of it :( > > Soun

Re: Object Not Callable, float?

2009-11-30 Thread Terry Reedy
W. eWatson wrote: I think I understand it, but how does one prevent it from happening, or know it's the cause? That msg I got? Yes. The message 'x is not callable', where x is a name of something you expect to be callable (such as the builtin functions and classes), signals that x has been r

Re: Running function from win32 dll

2009-11-30 Thread Terry Reedy
Nadav Chernin wrote: I want to run function from win32 dll. I used ctypes.windll.LoadLibrary to load the DLL. But I don’t know how to select function and run it. Which part of the Lib manual chapter did you not understand? -- http://mail.python.org/mailman/listinfo/python-list

Re: os.remove() permission problem

2009-11-30 Thread Christian Heimes
Victor Subervi wrote: > When I go into the python interpreter and execute that statement, it > succeeds. What have I missed? You are confusing the permissions of a Unix file system. In order to create or a remove a file from a directory you need the x and w permission to enter the directory (x) an

Re: top-like behavior

2009-11-30 Thread John Bokma
Jonathan Haddad wrote: > Is there a specific library used for displaying up to date consoles in > the same way top behaves? No experience but I am quite sure that curses behaves like that. http://www.amk.ca/python/howto/curses/ via http://www.google.com/search?q=python%20curses John -- http:

Characters in arithmetic expressions (was: semantics of ** (unexpected/inconsistent?))

2009-11-30 Thread Ben Finney
MRAB writes: > Most programming languages don't differentiate in text between the > number "negative 3" and the expression "negated 3". APL does. The > former is written as "¯3" (3 preceded by the overscore character) and > the latter as "-3" (3 preceded by the minus sign). Well, since we're tal

Bored.

2009-11-30 Thread Necronymouse
Hello, I am learning python for about 2 years and I am bored. Not with python but I have a little problem, when i want to write something I realise that somebody had alredy written it! So i don´t want to make a copy of something but i wanna get better in python skills. Don´t you know what I should

Re: Completely OT

2009-11-30 Thread inhahe
On Mon, Nov 30, 2009 at 2:17 PM, Lie Ryan wrote: > On 12/1/2009 5:00 AM, inhahe wrote: >> >> On Mon, Nov 30, 2009 at 12:58 PM, inhahe  wrote: >>> >>> On Mon, Nov 30, 2009 at 12:49 PM, Victor Subervi >>>  wrote: If I'm not mistaken, that won't help me actually print to screen the >>

Re: Intro To Python Using Turtle Graphics

2009-11-30 Thread Terry Reedy
Lawrence D'Oliveiro wrote: Done by Northland Polytechnic, available for download under CC-BY-NC-ND here . I have two problems with the presentation, which make things harder for the students than they should be. First, t

Re: semantics of ** (unexpected/inconsistent?)

2009-11-30 Thread inhahe
On Mon, Nov 30, 2009 at 2:05 PM, Lie Ryan wrote: > On 12/1/2009 5:58 AM, inhahe wrote: >> >> i wasn't suggesting it as a feature for python, just pointing out why >> it might seem counterintuitive. > > I'm interested, what do YOU (inhahe) think the result should be? Should both > become -9 or both

Language and collaboration (was: Python Statements/Keyword Localization)

2009-11-30 Thread Ben Finney
"Emanuele D'Arrigo" writes: > Ultimately I certainly appreciate the ubiquity of English even though > in the interest of fairness and efficiency I'd prefer the role of > common language to be given to a constructed language, such as Ido. I prefer Lojban http://www.lojban.org/> as being logically

Re: parsing json data

2009-11-30 Thread John Bokma
f...@mauve.rahul.net (Edward A. Falk) wrote: > There's a json parsing library in 2.6. (Sadly, 2.6 is not out for > Ubuntu yet.) Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 on Ubuntu 9.04 John -- http://mail.python.org/mailman/listinfo/python-list

Re: PyArg_ParseTupleAndKeywords in Python3.1

2009-11-30 Thread Joachim Dahl
I think that "C" encoding is what I need, however I run into an odd problem. If I use the following C code static PyObject* foo(PyObject *self, PyObject *args, PyObject *kwrds) { char a, b; char *kwlist[] = {"a", "b", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwrds, "|CC", kwlist, &a, &b

How to prevent re.split() from removing part of string

2009-11-30 Thread Jeremy
I am using re.split to... well, split a string into sections. I want to split when, following a new line, there are 4 or fewer spaces. The pattern I use is: sections = re.split('\n\s{,4}[^\s]', lineoftext) This splits appropriately but I lose the character matched by [^s]. I know I can

Re: Trying to understand += better

2009-11-30 Thread Terry Reedy
Roy Smith wrote: In article <4b0a01a...@dnews.tpgi.com.au>, Lie Ryan wrote: The semantic of the in-place operator is something like: x += y becomes x = x.__iadd__(y) Except that the expression x is evaluated just once instead of twice. thus foo.bar += baz becomes foo.bar = foo.bar.__iadd_

Re: Python PIL and Vista/Windows 7 .. show() not working ...

2009-11-30 Thread Esmail
On Nov 30, 4:37 pm, David Bolen wrote: > Esmail writes: > > I dug around in the docs and found a named parameter that I can set > > when I > > call show. > > > Definition:     im.show(self, title=None, command=None) > > > I installed irfanview and specified it/its path in the parameter, > > but t

Re: problem with lambda / closures

2009-11-30 Thread Terry Reedy
Benjamin Kaplan wrote: I don't know if anyone considers python's incomplete implementation of closures a "feature" but it's documented so it's not really a bug either. I believe Python's implementation of closures is quite complete in 3.x. In what way do you consider it otherwise? One just ha

Re: top-like behavior

2009-11-30 Thread Tim Chase
Is there a specific library used for displaying up to date consoles in the same way top behaves? From the last time a similar question was asked[1]: You might look at the sourcecode for "iotop"[2] which would make a good example (it's a "top"-like program written in Python, used for monitorin

Re: Bored.

2009-11-30 Thread MRAB
Necronymouse wrote: Hello, I am learning python for about 2 years and I am bored. Not with python but I have a little problem, when i want to write something I realise that somebody had alredy written it! So i don´t want to make a copy of something but i wanna get better in python skills. Don´t y

Re: top-like behavior

2009-11-30 Thread Jonathan Haddad
Awesome. Thank you! Jon On Mon, Nov 30, 2009 at 4:57 PM, Tim Chase wrote: >> Is there a specific library used for displaying up to date consoles in >> the same way top behaves? > > From the last time a similar question was asked[1]: > > You might look at the sourcecode for "iotop"[2] which would

PIL build error on Snow Leopard

2009-11-30 Thread Xiao
Hello, I haven't fully understood the nuances in the difference between Apple's system Python and MacPython. But I have just installed Python 2.6.4 from python.org. Now I'm trying to install a fresh downloaded PIL 1.1.6 but couldn't. python setup.py install gives: lipo: can't open input file: /var

Re: Bored.

2009-11-30 Thread Jonathan Gardner
On Nov 30, 2:14 pm, Necronymouse wrote: > Hello, I am learning python for about 2 years and I am bored. Not with > python but I have a little problem, when i want to write something I > realise that somebody had alredy written it! So i don´t want to make a > copy of something but i wanna get bette

Re: Questions about list-creation

2009-11-30 Thread Terry Reedy
Manuel Graune wrote: in (most) python documentation the syntax "list()" and "[]" is treated as being more or less the same thing. Untrue. List() and [] happen to both evaluate to the same thing, an empty list. But there is no reason to expect list() and [] to always evaluate to the same thing

Re: Completely OT

2009-11-30 Thread geremy condra
On Mon, Nov 30, 2009 at 1:21 PM, Victor Subervi wrote: > On Mon, Nov 30, 2009 at 2:00 PM, inhahe wrote: >> >> On Mon, Nov 30, 2009 at 12:58 PM, inhahe wrote: >> > On Mon, Nov 30, 2009 at 12:49 PM, Victor Subervi >> > wrote: >> >> >> >> >> >> If I'm not mistaken, that won't help me actually prin

Re: Python PIL and Vista/Windows 7 .. show() not working ...

2009-11-30 Thread Terry Reedy
Esmail wrote: On Nov 30, 4:37 pm, David Bolen wrote: If that's the issue, there are various ways around it. You could patch PIL itself (same function) to quote the filename when it is constructing the command. Alternatively, the tempfile module has a tempdir global you could set to some oth

<    1   2   3   >