Re: why cannot assign to function call

2009-01-04 Thread Steven D'Aprano
On Mon, 05 Jan 2009 01:13:48 -0600, Grant Edwards wrote: > On 2009-01-05, Derek Martin wrote: > >>> I'm sorry, but I really don't see how Python's assignment model could >>> be considered bizarre by anybody who's familiar with more than one or >>> two languages. >> >> And... what if one wasn't?

Re: [email/quoprimime.py] AttributeError: 'tuple' object has no attribute 'lstrip'

2009-01-04 Thread Chris Rebert
On Sun, Jan 4, 2009 at 11:15 PM, Gilles Ganault wrote: > Hello > >I successfully use the email package to send e-mail from Python > scripts, but this script fails when I fetch addresses from an SQLite > database where data is Unicode-encoded: > > == > from email.MIMEText import MIMETex

Re: threading a 10 lines out of a file

2009-01-04 Thread alex goretoy
I've found a great example on how to do threads. It compares a ping program in regular for loop and with threaded for loop. The link is below if anyone is interested. http://www.wellho.net/solutions/python-python-threads-a-first-example.html I hope my eagerness to post doesn't annoy anyone. I lik

[email/quoprimime.py] AttributeError: 'tuple' object has no attribute 'lstrip'

2009-01-04 Thread Gilles Ganault
Hello I successfully use the email package to send e-mail from Python scripts, but this script fails when I fetch addresses from an SQLite database where data is Unicode-encoded: == from email.MIMEText import MIMEText import smtplib,sys import apsw connection=apsw.Connection("test.

Re: why cannot assign to function call

2009-01-04 Thread Grant Edwards
On 2009-01-05, Derek Martin wrote: >> I'm sorry, but I really don't see how Python's assignment >> model could be considered bizarre by anybody who's familiar >> with more than one or two languages. > > And... what if one wasn't? The OP of this thread clearly > didn't understand... Whereas if

threading a 10 lines out of a file

2009-01-04 Thread alex goretoy
Hello All, I have a question. I'm not sure exactly as how to explain it in any other way then the way I will explain it. So I'm sorry if it's hard to understand exactly what it is I'm trying to do. Maybe not. Anyway. Here goes. Lets say I have a file that looks like this. id,name,desc,test 123,a

Re: why cannot assign to function call

2009-01-04 Thread Derek Martin
Forgive my indulgence, I find this rather academic discussion kind of interesting, as it turns out. On Sun, Jan 04, 2009 at 10:55:09PM -0600, Derek Martin wrote: > > You can't argue that one semantic or another is more intuitive > > without offering evidence. > > I think I have though, not that i

Re: why cannot assign to function call

2009-01-04 Thread Derek Martin
On Sun, Jan 04, 2009 at 09:56:33PM -0600, Grant Edwards wrote: > On 2009-01-05, Derek Martin wrote: > > On Sat, Jan 03, 2009 at 11:38:46AM -0600, Grant Edwards wrote: > >> One presumes that Mr. Martin finds anything different from his > >> first computer language to be BIZARRE. He should try out

Re: why cannot assign to function call

2009-01-04 Thread Derek Martin
On Sun, Jan 04, 2009 at 09:30:20PM -0500, Steve Holden wrote: > > I'm going to go out on a limb and assert that there's NO POSSIBLE WAY > > a student could intuit Python's variable assignment behavior, having > > never been exposed to that same behavior prior. It needs to be > > taught. > > > As

Re: Noob question: Is all this typecasting normal?

2009-01-04 Thread James Mills
On Mon, Jan 5, 2009 at 1:47 PM, sprad wrote: > On Jan 3, 6:41 pm, Steven D'Aprano cybersource.com.au> wrote: >> The OP comes from a Perl background, which AFAIK allows you to concat >> numbers to strings and add strings to numbers. That's probably the (mis) >> feature he was hoping Python had. I

Re: Noob question: Is all this typecasting normal?

2009-01-04 Thread Roy Smith
In article , sprad wrote: > On Jan 3, 6:41 pm, Steven D'Aprano cybersource.com.au> wrote: > > The OP comes from a Perl background, which AFAIK allows you to concat > > numbers to strings and add strings to numbers. That's probably the (mis) > > feature he was hoping Python had. > > That's cor

Re: why cannot assign to function call

2009-01-04 Thread Grant Edwards
On 2009-01-05, Derek Martin wrote: > On Sat, Jan 03, 2009 at 11:38:46AM -0600, Grant Edwards wrote: >> > Or are they also "BIZARRE"!? >> >> One presumes that Mr. Martin finds anything different from his >> first computer language to be BIZARRE. He should try out >> Prolog or something genuinely

Re: Noob question: Is all this typecasting normal?

2009-01-04 Thread sprad
On Jan 3, 6:41 pm, Steven D'Aprano wrote: > The OP comes from a Perl background, which AFAIK allows you to concat > numbers to strings and add strings to numbers. That's probably the (mis) > feature he was hoping Python had. That's correct -- and that's been one of the more difficult parts of my

Re: Code coverage to Python code

2009-01-04 Thread James Mills
On Sun, Jan 4, 2009 at 9:35 PM, Hussein B wrote: > What is the best code coverage tool available for Python? I like ot use nose with it's coverage plugin. easy_install nose easy_install co And I use the following in my top-level Makefile tests: @nosetests \ --with-coverage \ --c

Re: Code coverage to Python code

2009-01-04 Thread David Stanek
On Sun, Jan 4, 2009 at 9:26 PM, Roy Smith wrote: > In article , > Robert Kern wrote: > >> Hussein B wrote: >> > Hey, >> > What is the best code coverage tool available for Python? >> >> I like Titus Brown's figleaf. >> >> http://darcs.idyll.org/~t/projects/figleaf/doc/ > > I was playing with Ned

Re: why cannot assign to function call

2009-01-04 Thread Steve Holden
Derek Martin wrote: > On Sat, Jan 03, 2009 at 10:15:51AM +, Marc 'BlackJack' Rintsch wrote: >> On Fri, 02 Jan 2009 04:39:15 -0600, Derek Martin wrote: >> >>> On Tue, Dec 30, 2008 at 02:21:29PM +, John O'Hagan wrote: >>> What the Python community often overlooks, when this discussion again >

Re: Code coverage to Python code

2009-01-04 Thread Roy Smith
In article , Robert Kern wrote: > Hussein B wrote: > > Hey, > > What is the best code coverage tool available for Python? > > I like Titus Brown's figleaf. > > http://darcs.idyll.org/~t/projects/figleaf/doc/ I was playing with Ned Batchelder's coverage.py module today. Once I stopped screwi

Windows Python install vs. MSI extract question

2009-01-04 Thread cjl
OK -- this might be a strange question. If I do a 'full' install of Python on Windows XP, the result is a directory 'C:\Python25'. Depending on whether I install for all users or just me, the 'python25.dll' might end up in 'C:\Python25', or in the Windows system directory. If I copy python25.dll t

Re: why cannot assign to function call

2009-01-04 Thread Derek Martin
On Sat, Jan 03, 2009 at 11:38:46AM -0600, Grant Edwards wrote: > > Or are they also "BIZARRE"!? > > One presumes that Mr. Martin finds anything different from his > first computer language to be BIZARRE. He should try out > Prolog or something genuinely different. One's presumption would be mist

Re: why cannot assign to function call

2009-01-04 Thread Derek Martin
On Sat, Jan 03, 2009 at 10:15:51AM +, Marc 'BlackJack' Rintsch wrote: > On Fri, 02 Jan 2009 04:39:15 -0600, Derek Martin wrote: > > > On Tue, Dec 30, 2008 at 02:21:29PM +, John O'Hagan wrote: > > What the Python community often overlooks, when this discussion again > > rears its ugly head

Re: pep-8 vs. external interfaces?

2009-01-04 Thread Carl Banks
On Jan 4, 1:47 pm, Roy Smith wrote: > Or, I could draw a line in the sand and say, "If it's a protocol > primitive, it stays as written.  Otherwise, it's pep-8".  That's a > little uglier because it's not always obvious to the user exactly > which names are protocol primitives and which are higher

Re: Reverse order of bit in repeating seqence of byte string

2009-01-04 Thread Scott David Daniels
imageguy wrote: On Jan 2, 7:33 pm, John Machin wrote: For some very strange definition of "works" Well that's embarrassing ... you are correct. I need to convert from 'bgr' to 'rgb' If that is the only issue: >>> import Image >>> p = Image.open('~/VPython.png') >>> r, g, b

Re: structuring a package?

2009-01-04 Thread James Mills
On Mon, Jan 5, 2009 at 10:17 AM, Torsten Mohr wrote: > It looks natural to me to write in a code that uses the package: > > import graphic > import graphic.square > import graphic.circle > > That way i'd have to structure the code like this: > > graphic/ > __init__,py (GraphicObject) > square.p

structuring a package?

2009-01-04 Thread Torsten Mohr
Hi, i have a question on how to structure a package best, would be great if anybody could give me some hint on this: Assuming i have a base class GraphicObject and derived from that some classes like Square, Circle, ... It looks natural to me to write in a code that uses the package: import gra

Re: Testing if an index is in a slice

2009-01-04 Thread Bryan Olson
Steven D'Aprano wrote: Here's a less verbose version which passes your test cases: def inslice(index, slc, len): """Return True if index would be part of slice slc of a sequence of length len, otherwise return False. """ start, stop, stride = slc.indices(len) if stride < 0:

Re: How to declare python ints in C extensions?

2009-01-04 Thread Tony Houghton
On Sun, 04 Jan 2009 21:05:14 +0100 Christian Heimes wrote: > Philip Semanchuk schrieb: > > This works for me: > >PyModule_AddIntConstant(module, "O_CREAT", O_CREAT); > > > > I've had to learn a lot about writing extensions from looking at the > > Python source code. Lots of valuable tricks t

[ANN] TZMud 0.8

2009-01-04 Thread Lee Harr
TZMud is a Python MUD server. http://tzmud.googlecode.com/ A MUD is a text-based virtual environment accessed via telnet, or with a specialised MUD client. TZMud development is still in early stages, focusing on API and server stability. TZMud uses several high-quality Python libraries to facil

Re: Memory debugging tool for Python/C API?

2009-01-04 Thread Martin v. Löwis
> This works, but I'm not sure if PyString...() really makes a new copy of > the data (ellowing me to use free()) See the documentation: http://docs.python.org/c-api/string.html#PyString_FromString # Return a new string object with a *copy* of the string v as value > Another example (all on the

Re: greenlets and how they can be used

2009-01-04 Thread James Mills
On Sun, Jan 4, 2009 at 4:52 AM, Benjamin Walkenhorst wrote: > Back when I was still using Perl, there was - and still is, I guess - a > really nice framework called POE, that allowed you to write event-driven > state machines in a really easy and pleasant way. Under POE, EVERYTHING was > an eve

Re: Code coverage to Python code

2009-01-04 Thread Robert Kern
Hussein B wrote: Hey, What is the best code coverage tool available for Python? I like Titus Brown's figleaf. http://darcs.idyll.org/~t/projects/figleaf/doc/ -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad atte

Re: Python3

2009-01-04 Thread alexus
On Jan 4, 4:46 pm, s...@pobox.com wrote: >     alexus> enviroment: FreeBSD j.jothost.com 7.0-RELEASE-p7 FreeBSD > 7.0-RELEASE- >     alexus> p7 #6: Wed Dec 24 15:58:06 EST 2008     > ale...@j.jothost.com:/usr/obj/ >     alexus> usr/src/sys/GENERIC  i386 > >     alexus> I installed both of Python

Re: Package / Module Hierarchy question

2009-01-04 Thread alex goretoy
You might try this in qwe.py import os,sys sys.path.append(os.getcwd()+"../") This will allow you to then import modules from module(dir). Hope this helps. OTOH, there maybe a better solution. -Alex Goretoy http://www.alexgoretoy.com On Sun, Jan 4, 2009 at 9:10 PM, Torsten Mohr wrote: > Hi,

Re: Python3

2009-01-04 Thread skip
alexus> enviroment: FreeBSD j.jothost.com 7.0-RELEASE-p7 FreeBSD 7.0-RELEASE- alexus> p7 #6: Wed Dec 24 15:58:06 EST 2008 ale...@j.jothost.com:/usr/obj/ alexus> usr/src/sys/GENERIC i386 alexus> I installed both of Python 2 and Python 3 via source code alexus> (compile t

Re: Python3

2009-01-04 Thread alexus
On Jan 4, 4:23 pm, s...@pobox.com wrote: >     alexus> I wanted to try out new Python 3 on my system, so I did "make >     alexus> fullinstall" and now as promised it broke every single program >     alexus> there is that runs on my system that depends on Python. > >     alexus> is there a way to u

SSL certificate parsing?

2009-01-04 Thread Taras Ivashchenko
Hello, list! I use pyopenssl [0] for checking SSL certificates. And one of such checks is if given certificate is self-signed. I can do it using values of X509v3 extensions: the subject key identifier and the authority key id: X509v3 Subject Key Identifier: 0E:D4:AA:B1:09:91:7C:36:60:EA:56:4E:9C:5

Re: Python3

2009-01-04 Thread skip
alexus> I wanted to try out new Python 3 on my system, so I did "make alexus> fullinstall" and now as promised it broke every single program alexus> there is that runs on my system that depends on Python. alexus> is there a way to undo that? I've tried re-installing Python 2,

Package / Module Hierarchy question

2009-01-04 Thread Torsten Mohr
Hi, in a package i use these files: module (dir) __init__.py submodule __init__.py qwe.py qwe.py defines a class that derives from a class defined in submodule (and by that in submodule/__init__.py. Is it possible somehow to write in qwe.py to import submodule (though __init__.py

Python3

2009-01-04 Thread alexus
I wanted to try out new Python 3 on my system, so I did "make fullinstall" and now as promised it broke every single program there is that runs on my system that depends on Python. is there a way to undo that? I've tried re-installing Python 2, yet that didn't help me at all. -- http://mail.python

Memory debugging tool for Python/C API?

2009-01-04 Thread Robert Latest
Hello, extending Python in C ist just the coolest thing since sliced bread (and I'm particularly happy because I really had started to miss C when I did more and more things in Python). I've got one question though. Tha C/API documentation is not quite clear (to me, anyway) on what happens exactl

Re: Python training in Colorado, January 27-30

2009-01-04 Thread alex goretoy
I'd be interested in attending if you make it to Tulsa,OK. Are your courses only in Colorado? -Alex Goretoy http://www.alexgoretoy.com On Sun, Jan 4, 2009 at 7:29 PM, Mark Lutz wrote: > Python author and trainer Mark Lutz will be teaching a 4-day > Python class on January 27-30, in Longmont, C

Re: How to declare python ints in C extensions?

2009-01-04 Thread Christian Heimes
Philip Semanchuk schrieb: > This works for me: >PyModule_AddIntConstant(module, "O_CREAT", O_CREAT); > > I've had to learn a lot about writing extensions from looking at the > Python source code. Lots of valuable tricks to be learned there. This trick makes it even easier: #ifndef PyModule_A

pep-8 vs. external interfaces?

2009-01-04 Thread Roy Smith
I'm building a Python language wrapper to an network protocol which traditionally uses camelCase function names. I'm trying to make the new code pep-8 compliant, which means function names should be written this_way() instead of thisWay(). I've got a couple of choices open to me. I could convert

Python training in Colorado, January 27-30

2009-01-04 Thread Mark Lutz
Python author and trainer Mark Lutz will be teaching a 4-day Python class on January 27-30, in Longmont, Colorado. This is a public training session open to individual enrollments, and covers the same topics and hands-on lab work as the onsite sessions that Mark teaches. The class provides an in-

Re: IDLE spinning beach ball on OS X 10.3.9 Panther

2009-01-04 Thread Tommy Nordgren
On Jan 4, 2009, at 7:14 PM, kleefaj wrote: Greetings. I want to run IDLE on my iBook running Mac OS X 10.3.9 (Panther). Per the instructions on "Python on the Macintosh" [1], I downloaded and installed TclTkAqua [2], then downloaded and installed Universal- MacPython-2.4.3 [3]. Python launch

Re: some question about python2.6 and python3k

2009-01-04 Thread Bruno Desthuilliers
Ken Seehart a écrit : Michael Yang wrote: Hi,guys i am a new guy for python world,i have some question want to ask 1.should i learn about python2.6 or python3k?i heard of it has some difference from them . I think you should go directly to 3K to save your self the extra work of learning the

Re: How to declare python ints in C extensions?

2009-01-04 Thread Philip Semanchuk
On Jan 4, 2009, at 1:20 PM, Tony Houghton wrote: I want to write python wrappers for the Linux DVB API. The underlying structures and constants may change from time to time, and some of the constants are generated from macros, so I think it would be better to write the module in C rather than j

Re: How to declare python ints in C extensions?

2009-01-04 Thread Saju Pillai
Tony Houghton wrote: I want to write python wrappers for the Linux DVB API. The underlying structures and constants may change from time to time, and some of the constants are generated from macros, so I think it would be better to write the module in C rather than just copying the constants into

How to declare python ints in C extensions?

2009-01-04 Thread Tony Houghton
I want to write python wrappers for the Linux DVB API. The underlying structures and constants may change from time to time, and some of the constants are generated from macros, so I think it would be better to write the module in C rather than just copying the constants into pure python code and u

IDLE spinning beach ball on OS X 10.3.9 Panther

2009-01-04 Thread kleefaj
Greetings. I want to run IDLE on my iBook running Mac OS X 10.3.9 (Panther). Per the instructions on "Python on the Macintosh" [1], I downloaded and installed TclTkAqua [2], then downloaded and installed Universal- MacPython-2.4.3 [3]. Python launches in Terminal. The version shown is 2.4.3. Wh

Re: some question about python2.6 and python3k

2009-01-04 Thread Ken Seehart
Michael Yang wrote: Hi,guys i am a new guy for python world,i have some question want to ask 1.should i learn about python2.6 or python3k?i heard of it has some difference from them . I think you should go directly to 3K to save your self the extra work of learning the differences. The mai

Re: Ideas to optimize this getitem/eval call?

2009-01-04 Thread Tino Wildenhain
mario wrote: On Jan 3, 7:16 am, Steven D'Aprano wrote: I was about to make a comment about this being a security hole, Strange that you say this, as you are also implying that *all* the widely-used templating systems for python are security holes... Well, you would be right to say that of co

Re: some question about python2.6 and python3k

2009-01-04 Thread Benjamin Kaplan
On Sun, Jan 4, 2009 at 12:14 PM, Michael Yang wrote: > Hi,guys > > i am a new guy for python world,i have some question want to ask > > 1.should i learn about python2.6 or python3k?i heard of it has some > difference from them > If you don't have to worry about external libraries, you should prob

TKinter and multiprocessing in GNU/Linux/X

2009-01-04 Thread Weeble
I'm using the multiprocessing module in Python 2.6 to run a pygame application. When errors occur, I create a new Process with the multiprocessing module and have it display a TKinter dialog. The pygame application can carry on happily without waiting for the dialog. This works fine on Windows. How

some question about python2.6 and python3k

2009-01-04 Thread Michael Yang
Hi,guys i am a new guy for python world,i have some question want to ask 1.should i learn about python2.6 or python3k?i heard of it has some difference from them 2.Do python3k has some good web framework(like web.py)? Thanks ! -- http://mail.python.org/mailman/listinfo/python-list

Re: Which SOAP module?

2009-01-04 Thread Pierre Hanser
Ralf Schoenian a écrit : > Roy Smith wrote: >> I'm starting to play with SOAP. The zeroth question that needs >> answering is, "Which SOAP module should I use?" There seem to be a >> number of different ones to pick from. Any suggestions? >> >> > It depends on whether you want to write a client

Re: Which SOAP module?

2009-01-04 Thread Stefan Behnel
Ralf Schoenian wrote: > Roy Smith wrote: >> I'm starting to play with SOAP. The zeroth question that needs >> answering is, "Which SOAP module should I use?" There seem to be a >> number of different ones to pick from. Any suggestions? > > for the server I think you > have to rely on the ZSI (ht

Re: Which SOAP module?

2009-01-04 Thread Roy Smith
On Jan 4, 10:41 am, Ralf Schoenian wrote: > It depends on whether you want to write a client or a server > application. At least for now, I'm only interesting in clients. -- http://mail.python.org/mailman/listinfo/python-list

Re: Which SOAP module?

2009-01-04 Thread Ralf Schoenian
Roy Smith wrote: I'm starting to play with SOAP. The zeroth question that needs answering is, "Which SOAP module should I use?" There seem to be a number of different ones to pick from. Any suggestions? It depends on whether you want to write a client or a server application. If you only wa

Which SOAP module?

2009-01-04 Thread Roy Smith
I'm starting to play with SOAP. The zeroth question that needs answering is, "Which SOAP module should I use?" There seem to be a number of different ones to pick from. Any suggestions? -- http://mail.python.org/mailman/listinfo/python-list

Re: Take the first n items of an iterator

2009-01-04 Thread Steven D'Aprano
On Sun, 04 Jan 2009 11:10:05 +, Marc 'BlackJack' Rintsch wrote: > On Sun, 04 Jan 2009 10:55:17 +, Steven D'Aprano wrote: > >> I thought there was an iterator in itertools for taking the first n >> items of an iterator, then halting, but I can't find it. Did I imagine >> such a tool, or am

Re: Using PythonPath under Windows Vista.

2009-01-04 Thread Steve Holden
Francesco Bochicchio wrote: [...] > AFAIK, PYTHONPATH only works for the imported modules. For the main > module, you have to do give the full path. > OR you could try out the new flag -m, which allows to run directly a > module from the standard library and - I guess - also user modules if > PYTHO

Re: Using PythonPath under Windows Vista.

2009-01-04 Thread Steve Holden
Morgul Banner Bearer wrote: > Hi Everybody, > > I was using the O'Reilly book from 1999 to look into Python and ran > into a problem with > the use of Pythonpath. > > I have Python installed under c:\python26. > I have the module "Brian.py" that i want to run installed under c > \python26\work >

Re: deleting a method

2009-01-04 Thread Steve Holden
Manish Sinha wrote: > Filip Gruszczyński wrote: >> I am trying to delete a method from a class. It's easy to delete other >> attributes, but when I try: >> >> > class A: > >> ... def foo(): >> ... pass >> ... >> > a = A() > del a.foo > >>

Re: Using PythonPath under Windows Vista.

2009-01-04 Thread Andrew Lewis
> In Windows Vista, I have set an environment variable "Pythonpath" > equal to c:\python26\work > (by using the "My computer", "Properties", "Advanced", "Environment > Variables". I always thought pythonpath was only for imports, try adding the location to the regular path variable. Andrew -- http

Re: Using PythonPath under Windows Vista.

2009-01-04 Thread Francesco Bochicchio
On Sun, 04 Jan 2009 04:56:51 -0800, Morgul Banner Bearer wrote: > Hi Everybody, > ... > > > The behaviour of the program is as follows : > In a Dos Box, the program executes nicely when i type : > "c\python26>python c:\python26\work\brian.py". > > Now i understand that- because I set the Pytho

Re: why cannot assign to function call

2009-01-04 Thread Steve Holden
Wolfgang Strobl wrote: > Derek Martin : > >> It took me about a half a second to grasp the "named bins" concept -- >> i.e. as soon as I was finished reading the words that explained it I >> understood it, so I'd say that based on your half-hour number, >> Python's model is substantially more compl

Using PythonPath under Windows Vista.

2009-01-04 Thread Morgul Banner Bearer
Hi Everybody, I was using the O'Reilly book from 1999 to look into Python and ran into a problem with the use of Pythonpath. I have Python installed under c:\python26. I have the module "Brian.py" that i want to run installed under c \python26\work In Windows Vista, I have set an environment var

Re: Noob question: Is all this typecasting normal?

2009-01-04 Thread alex goretoy
My gmail did that. FYI, it wasn't intentional. А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я Paula Poundstone - "I don't have a bank account because I don't know my mother's maiden name." On Sun, Jan 4, 2009 at

Re: deleting a method

2009-01-04 Thread alex goretoy
HAHAHAHA, I like your sig Ben. So much that I blogged about it. starnixalpha.blogspot.com Oh yeah, and the info on this thread was helpful. Thanks, -A А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я On Sun, Ja

Re: why cannot assign to function call

2009-01-04 Thread Hendrik van Rooyen
"Aaron Brady" wrote: >No; tuples are composite. If I flip one bit in a byte somewhere, is >it the same byte? Yes and No and No and Others: Yes it is the byte at the same somewhere in memory. No it is not the same as it was a moment ago, because the bit has flipped. No it is one of the bytes r

Re: Code coverage to Python code

2009-01-04 Thread skip
Hussein> What is the best code coverage tool available for Python? Probably Ned Batchelders coverage.py. There is a trace.py module which comes with Python as well. -- Skip Montanaro - s...@pobox.com - http://smontanaro.dyndns.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Memoizing and WeakValueDictionary

2009-01-04 Thread hsoft
On Jan 4, 5:55 am, Paul McGuire wrote: > Just wanted to share some experience I had in doing some memory and > performance tuning of a graphics script.  I've been running some long- > running scripts on high-resolution images, and added memoizing to > optimize/minimize object creation (my objects

Code coverage to Python code

2009-01-04 Thread Hussein B
Hey, What is the best code coverage tool available for Python? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

RE: How to find the beginning of last line of a big text file ?

2009-01-04 Thread Barak, Ron
Hi Tim, Thanks for the solution (and effort), and for teaching me some interesting new tricks. Happy 2009! Ron. -Original Message- From: Tim Chase [mailto:python.l...@tim.thechases.com] Sent: Thursday, January 01, 2009 20:04 To: Sebastian Bassi Cc: python-list@python.org Subject: Re: Ho

Re: Take the first n items of an iterator

2009-01-04 Thread Marc 'BlackJack' Rintsch
On Sun, 04 Jan 2009 10:55:17 +, Steven D'Aprano wrote: > I thought there was an iterator in itertools for taking the first n > items of an iterator, then halting, but I can't find it. Did I imagine > such a tool, or am I missing something? `itertools.islice()` Ciao, Marc 'BlackJack'

Re: math module for Decimals

2009-01-04 Thread Mark Dickinson
On Jan 4, 10:38 am, "alex goretoy" wrote: > haha python-svn # python Lib/decimal.py >   File "Lib/decimal.py", line 683 >     sign = 0 if _math.copysign(1.0, f) == 1.0 else 1 >               ^ > SyntaxError: invalid syntax > > Although, It may be only because I ran it through python 2.4.3 Ah yes,

Re: math module for Decimals

2009-01-04 Thread alex goretoy
No, I know there's a typo because python told me there is. If you have svn repo locally. then cd into Lib/ and run python decimal.py It will tell you line 683 has syntax error, please see below. haha python-svn # python Lib/decimal.py File "Lib/decimal.py", line 683 sign = 0 if _math.copysi

Re: math module for Decimals

2009-01-04 Thread Mark Dickinson
On Jan 4, 9:52 am, "alex goretoy" wrote: > Also, another reason why I'm posting to this thread. I noticed some > error/typo in line 683 of decimal.py located on public svn repo. This is > what is looks like. > >         sign = 0 if _math.copysign(1.0, f) == 1.0 else 1 This line looks okay to me;

Re: deleting a method

2009-01-04 Thread Ben Finney
"Filip Gruszczyński" writes: > Thanks, now I see, what happens, but don't exactly know why. Could > you point me to some good explanation how object creation is > performed in Python? Rather than “how object creation is performed”, I would recommend you get a better handle on how the object *mod

Re: deleting a method

2009-01-04 Thread Manish Sinha
Filip Gruszczyński wrote: I am trying to delete a method from a class. It's easy to delete other attributes, but when I try: class A: ... def foo(): ... pass ... a = A() del a.foo I get Traceback (most recent call last): File "", line 1, in Attrib

Re: Testing if an index is in a slice

2009-01-04 Thread Steven D'Aprano
On Sat, 03 Jan 2009 14:53:12 -0800, Bryan Olson wrote about testing whether or not an index is in a slice: > I'm leaning towards mmanns' idea that this should be built in. What's the use-case for it? > Handling > all the cases is remarkably tricky. Here's a verbose version, with a > little t

Re: math module for Decimals

2009-01-04 Thread alex goretoy
I've been watching this thread for couple days now. I followed the bug report and all that stuff. It's very interesting to me how you guys talk about this stuff. I like it alot. I a new guy to python, just fyi. I'm one of my current projects I'm using Decimal as well and I think it be a huge pain i

Re: deleting a method

2009-01-04 Thread Filip Gruszczyński
> To answer the second question: since 'foo' is an attribute of the > class 'A', you can delete the attribute from the class. > >>>> class A(object): >... def foo(self): >... pass >... >>>> a = A() >>>> 'foo' in dir(a) >True >>>> del A.foo >>>> 'foo'