Re: Python strings and coding conventions

2009-01-10 Thread koranthala
On Jan 11, 9:26 am, Robert Kern wrote: > koranth...@gmail.com wrote: > > Hi, > >    Python Coding Convention (PEP 8) suggests : > >   Maximum Line Length > > >     Limit all lines to a maximum of 79 characters. > > >   I have a string which is ~110 char long. It is a string which I am > > going to

parsing javascript generated files...

2009-01-10 Thread bruce
Hi. Looking to parse some web pages that have javascript (jquery) embedded/used in the pages. I'm trying to get a better understanding of exactly how the page is generated, and displayed in the browser. I've seen various references to python-spidermonkey, as well as watir/firewatir. Is there a wa

Re: urlopen exception

2009-01-10 Thread alex goretoy
oops, remove the ,80 since port is not needed. Well, in my case it wasn't working with port. notice it gives me 404, but this with my domain >>> att=urllib2.urlopen(site+payload,80).readlines() Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.6/urllib2.py",

Re: urlopen exception

2009-01-10 Thread alex goretoy
I would try: site="http://www.bput.org/"; payloads="alert('xss')" attack= urllib2.urlopen(site+payloads,80).readlines() -Alex Goretoy http://www.alexgoretoy.com somebodywhoca...@gmail.com On Sun, Jan 11, 2009 at 2:49 AM, Steve Holden wrote: > Paul Rubin wrote: > > asit writes: > >> site="ww

Re: Python 2.6.1 @executable_path

2009-01-10 Thread Michael Torrie
googler.1.webmas...@spamgourmet.com wrote: > Thanks for the link but I don't want to do a make a python script as > an applicatin, I want to embedd python into a C++ app so thats the > reason why I have to compile Python. If you are embedding python, then all you have to do is stick the python mo

Re: import relative (with a directory)

2009-01-10 Thread Kay Schluehr
On 11 Jan., 03:27, Chris Rebert wrote: > You should probably check out the relative import syntax introduced in > PEP 328:http://www.python.org/dev/peps/pep-0328/ > It should be able to do exactly what you want. This should exactly lead to exceptions in all of his demo code because the modules a

Re: Python strings and coding conventions

2009-01-10 Thread Mensanator
On Jan 10, 10:26�pm, Robert Kern wrote: > koranth...@gmail.com wrote: > > Hi, > > � �Python Coding Convention (PEP 8) suggests : > > � Maximum Line Length > > > � � Limit all lines to a maximum of 79 characters. > > > � I have a string which is ~110 char long. It is a string which I am > > going t

Re: Python strings and coding conventions

2009-01-10 Thread Robert Kern
koranth...@gmail.com wrote: Hi, Python Coding Convention (PEP 8) suggests : Maximum Line Length Limit all lines to a maximum of 79 characters. I have a string which is ~110 char long. It is a string which I am going to print in a text file as a single string. i.e. in that text file

Python strings and coding conventions

2009-01-10 Thread koranthala
Hi, Python Coding Convention (PEP 8) suggests : Maximum Line Length Limit all lines to a maximum of 79 characters. I have a string which is ~110 char long. It is a string which I am going to print in a text file as a single string. i.e. in that text file, each line is taken as a diff

Re: "python -3" not working as expected

2009-01-10 Thread Benjamin
On Jan 9, 10:19 pm, John Machin wrote: > On Jan 10, 2:55 pm, Benjamin wrote: > > > We'll need good documentation. Unfortunately, as you > > note below, this isn't exactly the case yet. > > So is there a plot to remedy this? Where do we sign up? Feel free to contribute to the wiki page: http://w

Re: why cannot assign to function call

2009-01-10 Thread rurpy
Mark Wooding wrote: > ru...@yahoo.com wrote: > >> What is the observable difference between converting an >> array to a reference (pointer) to that array and passing >> the reference by value, and passing the array by reference? > > For one: > > #include > static size_t foo(char v[]) { return siz

Re: Regex for unicode letter characters

2009-01-10 Thread MRAB
Steve Holden wrote: MRAB wrote: schickb wrote: I need a regex that will match strings containing only unicode letter characters (not including numeric or the _ character). I was surprised to find the 're' module does not include a special character class for this already (python 2.6). Or did I

Re: State of the art: Tkinter, Tk 8.5, Tix?

2009-01-10 Thread Дамјан Георгиевски
> The themed Tk widgets (ttk) that come with Tk 8.5 add a lot of the > same things that Tix does, but they do so in a more modern way, > hooking into platform-specific themes and API's wherever possible (XP, > Vista, Mac) and updating the generic X11 look as well. As such, they > are more appropria

Re: why cannot assign to function call

2009-01-10 Thread Mark Wooding
Steven D'Aprano wrote: > I don't believe it is a red-herring. As I understand it, Mark and Joe > insist that C is pass-by-value *even in the case of arrays*, despite the > semantics of array passing being identical to the semantics of pass-by- > reference in (say) Pascal. But they aren't. I'

Re: Regex for unicode letter characters

2009-01-10 Thread Steve Holden
MRAB wrote: > schickb wrote: >> I need a regex that will match strings containing only unicode letter >> characters (not including numeric or the _ character). I was surprised >> to find the 're' module does not include a special character class for >> this already (python 2.6). Or did I miss somet

Re: urlopen exception

2009-01-10 Thread Steve Holden
Paul Rubin wrote: > asit writes: >> site="www.bput.org" >> payloads="alert('xss')" >> attack= urllib2.urlopen(site+payloads,80).readlines() >> >> according to my best knowledge, the above code is correct. >> but why it throws exceptio > > The code is incorrect. Look at the string ou are sen

Re: why cannot assign to function call

2009-01-10 Thread Steven D'Aprano
On Sun, 11 Jan 2009 01:22:48 +, Rhodri James wrote: > On Sat, 10 Jan 2009 18:44:37 -, wrote: > >> What is the observable difference between converting an array to a >> reference (pointer) to that array and passing the reference by value, >> and passing the array by reference? > > This i

Re: why cannot assign to function call

2009-01-10 Thread Mark Wooding
Steven D'Aprano wrote: > There are actually three fundamental characteristics of pass-by-reference: > > * passing a value by reference does not lead to the value being copied, > in contrast with pass-by-value where it does; > > * modifications to the value passed by reference are visible to th

Re: Python 2.6.1 @executable_path

2009-01-10 Thread googler . 1 . webmaster
hmm.. very strange. Is it so complicated to compile python that I can move the framework to the app folder? hmm. thats really strange :-( /myapp.app /subfolder/Python.framework any suggestions? Thank you very muc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Regex for unicode letter characters

2009-01-10 Thread MRAB
schickb wrote: I need a regex that will match strings containing only unicode letter characters (not including numeric or the _ character). I was surprised to find the 're' module does not include a special character class for this already (python 2.6). Or did I miss something? It seems like thi

Re: import relative (with a directory)

2009-01-10 Thread Chris Rebert
On Sat, Jan 10, 2009 at 6:11 PM, rocky wrote: > Import relative? > > Recently for fun I've been working on a large Python program. It has > many files/modules spread over several directories/submodules. > > Each module has some "demo" code at the end that I can use to run or > experiment with that

import relative (with a directory)

2009-01-10 Thread rocky
Import relative? Recently for fun I've been working on a large Python program. It has many files/modules spread over several directories/submodules. Each module has some "demo" code at the end that I can use to run or experiment with that module. Of course, modules often refer to others; dependin

Regex for unicode letter characters

2009-01-10 Thread schickb
I need a regex that will match strings containing only unicode letter characters (not including numeric or the _ character). I was surprised to find the 're' module does not include a special character class for this already (python 2.6). Or did I miss something? It seems like this would be a very

Re: why cannot assign to function call

2009-01-10 Thread Rhodri James
On Sat, 10 Jan 2009 18:44:37 -, wrote: What is the observable difference between converting an array to a reference (pointer) to that array and passing the reference by value, and passing the array by reference? This is a red herring, though. From either viewpoint, C arrays are anomalous

Pickling classes (not class instances)

2009-01-10 Thread Nicolas M . Thiéry
Dear python developers, Purpose of this e-mail: --- How to customize how a class (not an instance of a class!!!) is pickled? Example: == class metaclass(type): def __new__(mcs, name, base

Re: Looking for an efficient Python script to download and save a .zip file programmatically

2009-01-10 Thread MrJean1
Here are some examples using urllib.urlretrieve(): /Jean Brouwers On Jan 10, 2:23 pm, Chris Rebert wrote: > On Sat, Jan 10, 2009 at 9:12 AM, David Shi wrote: > > I am looking for an ef

Re: urlopen exception

2009-01-10 Thread Paul Rubin
asit writes: > site="www.bput.org" > payloads="alert('xss')" > attack= urllib2.urlopen(site+payloads,80).readlines() > > according to my best knowledge, the above code is correct. > but why it throws exceptio The code is incorrect. Look at the string ou are sending into urlopen. What on e

Re: why cannot assign to function call

2009-01-10 Thread Steven D'Aprano
On Sat, 10 Jan 2009 12:52:47 -0700, Joe Strout wrote: >> What is the observable difference between converting an array to a >> reference (pointer) to that array and passing the reference by value, >> and passing the array by reference? > > The difference is whether an assignment to the formal par

Re: type conversion

2009-01-10 Thread Lie
On Jan 3, 10:23 am, r wrote: > On Jan 2, 7:46 pm, Steven D'Aprano > wrote: > > ...incessant rambling about a news reader , 101 excuses for butting > into a thread > [snip] ... public display of ignorance of newsgroup ethics, 101 excuses for not knowing proper terminologies. > Throw your newsre

Re: State of the art: Tkinter, Tk 8.5, Tix?

2009-01-10 Thread Kevin Walzer
excord80 wrote: On Jan 10, 11:45 am, r wrote: We need TK 8.5's themes. This will bring Tkinter out of the dark ages and into the 21st Century! And improve the shine of the Python base distro. Python could use a good boost right now! Could someone please explain what Tix provides compared to w

Re: State of the art: Tkinter, Tk 8.5, Tix?

2009-01-10 Thread Kevin Walzer
excord80 wrote: Could someone please explain what Tix provides compared to what the new stuff in Tk 8.5 provides? Is there much overlap? Tix is a compiled Tk extension that adds a good number of widgets to the base set, such as a notebook tab, treeview, combobox, and others; Python includes

Re: urlopen exception

2009-01-10 Thread Chris Rebert
On Sat, Jan 10, 2009 at 9:56 AM, asit wrote: > site="www.bput.org" > payloads="alert('xss')" > attack= urllib2.urlopen(site+payloads,80).readlines() > > according to my best knowledge, the above code is correct. > but why it throws exceptio Because it's not correct. It's trying to load www.b

Re: State of the art: Tkinter, Tk 8.5, Tix?

2009-01-10 Thread r
On Jan 10, 3:05 pm, excord80 wrote: > On Jan 10, 11:45 am, r wrote: > > > We need TK 8.5's themes. This will bring Tkinter out of the dark ages > > and into the 21st Century! And improve the shine of the Python base > > distro. Python could use a good boost right now! > > Could someone please exp

Re: Python 2.6.1 @executable_path

2009-01-10 Thread googler . 1 . webmaster
Thanks for the link but I don't want to do a make a python script as an applicatin, I want to embedd python into a C++ app so thats the reason why I have to compile Python. -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for an efficient Python script to download and save a .zip file programmatically

2009-01-10 Thread Chris Rebert
On Sat, Jan 10, 2009 at 9:12 AM, David Shi wrote: > I am looking for an efficient Python script to download and save a .zip file > programmatically (from http or https call). You want urllib.urlretrieve(): http://docs.python.org/library/urllib.html#urllib.urlretrieve Cheers, Chris -- Follow th

Re: Python 2.6.1 @executable_path

2009-01-10 Thread Ned Deily
In article , googler.1.webmas...@spamgourmet.com wrote: > I want to embedd it into my app so on the 'customers'-mac I want > to put python into a subdirectory of my app. > > and with the configure command above, that will not work > because the library has to be on every system in /Library/Fram

Re: Python 2.6.1 @executable_path

2009-01-10 Thread googler . 1 . webmaster
I want to embedd it into my app so on the 'customers'-mac I want to put python into a subdirectory of my app. and with the configure command above, that will not work because the library has to be on every system in /Library/Framework/ so I found out that @executable_path is replaced by the path o

Re: Python 2.6.1 @executable_path

2009-01-10 Thread googler . 1 . webmaster
I want to embedd it into another app so on the 'customers'-mac I want to put python into a subdirectory of my app. bye -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.6.1 @executable_path

2009-01-10 Thread Martin v. Löwis
> I asked something similar a few days ago. Is it possible to compile > Python 2.6.1 with a dynamic path? What is a "dynamic path"? Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: are there some special about '\x1a' symbol

2009-01-10 Thread John Machin
On Jan 11, 2:45 am, "sim.sim" wrote: > Hi all! > > I had touch with some different python behavior: I was tried to write > into a file a string with the '\x1a' symbol, and for FreeBSD system, > it gives expected result: > > >>> open("test", "w").write('before\x1aafter') > >>> open('test').read() >

Python 2.6.1 @executable_path

2009-01-10 Thread googler . 1 . webmaster
Hi! I asked something similar a few days ago. Is it possible to compile Python 2.6.1 with a dynamic path on Mac OSX Leopard 10.5.x. I found out that I could use @executable_path but I don't know how the configure command would look like. This is my current configure command for the default /Libra

Python 2.6.1 @executable_path

2009-01-10 Thread googler . 1 . webmaster
Hi! I asked something similar a few days ago. Is it possible to compile Python 2.6.1 with a dynamic path on MacOSX? I don't know how the configure command would look like. This is my current configure command for the default /Library/ Frameworks/ path: ./configure --with-framework-name=Python --

Python 2.6.1 @executable_path

2009-01-10 Thread googler . 1 . webmaster
Hi! I asked something similar a few days ago. Is it possible to compile Python 2.6.1 with a dynamic path? I don't know how the configure command would look like. This is my current configure command for the default /Library/ Frameworks/ path: ./configure --with-framework-name=Python --with-unive

Re: distinction between unzipping bytes and unzipping a file

2009-01-10 Thread John Machin
On Jan 11, 6:15 am, webcomm wrote: > On Jan 9, 6:07 pm, John Machin wrote: > > > Yup, it looks like it's encoded in utf_16_le, i.e. no BOM as > > God^H^H^HGates intended: > > > >>> buff = open('data', 'rb').read() > > >>> buff[:100] > > > '<\x00R\x00e\x00g\x00i\x00s\x00t\x00r\x00a\x00t\x00i\x00o\

Re: State of the art: Tkinter, Tk 8.5, Tix?

2009-01-10 Thread excord80
On Jan 10, 11:45 am, r wrote: > We need TK 8.5's themes. This will bring Tkinter out of the dark ages > and into the 21st Century! And improve the shine of the Python base > distro. Python could use a good boost right now! Could someone please explain what Tix provides compared to what the new st

Re: urlopen exception

2009-01-10 Thread Steve Holden
asit wrote: > site="www.bput.org" > payloads="alert('xss')" > attack= urllib2.urlopen(site+payloads,80).readlines() > > according to my best knowledge, the above code is correct. > but why it throws exceptio what exception it throw? -- Steve Holden+1 571 484 6266 +1 800 494 3119 H

Re: if-else statement

2009-01-10 Thread bearophileHUGS
Scott David Daniels: >       if checking: >           my_var = 'string' >       else: >           my_var = 'other string' > > remember, vertical space only kills trees if printed. I value clarity a lot. But this is more DRY, sometimes it's almost equally clear, and you reduce vertical space, packi

Re: download timeout vs. socket timeout

2009-01-10 Thread Giampaolo Rodola'
I'm sorry. I realized they had already replied when it was too late. --- Giampaolo http://code.google.com/p/pyftpdlib -- http://mail.python.org/mailman/listinfo/python-list

Re: if-else statement

2009-01-10 Thread Scott David Daniels
Duncan Booth wrote: Gandalf wrote: other languages ... [have an] if-else operator like... myVar = checking == 1? 'string': 'other string' See http://docs.python.org/reference/expressions.html#boolean-operations ... The expression x if C else y first evaluates C (not x); if C is true, x i

Re: why cannot assign to function call

2009-01-10 Thread Joe Strout
Aaron Brady wrote: Aaron Brady wrote: Possible compromise. You can think of functions as mutation-only. You pass the object, and it gets a new (additional) name. The old name doesn't go in. That's correct. The reference itself is passed in, not the variable (or expression) that held or ge

Re: why cannot assign to function call

2009-01-10 Thread Joe Strout
ru...@yahoo.com wrote: What is the observable difference between converting an array to a reference (pointer) to that array and passing the reference by value, and passing the array by reference? The difference is whether an assignment to the formal parameter (within the function) affects the

Re: why cannot assign to function call

2009-01-10 Thread Mark Wooding
ru...@yahoo.com wrote: > What is the observable difference between converting an > array to a reference (pointer) to that array and passing > the reference by value, and passing the array by reference? For one: #include static size_t foo(char v[]) { return sizeof v; } int main(void) { char

Re: download timeout vs. socket timeout

2009-01-10 Thread Giampaolo Rodola'
On 10 Gen, 03:07, "p." wrote: > i'm using urllib2 in python 2.4 > > wondering how people typically deal with the case in which a download > is too slow. setting the socket timeout only covers those cases where > there is no response in the socket for whatever the timeout period is. > what if, howe

Re: BadZipfile "file is not a zip file"

2009-01-10 Thread webcomm
On Jan 9, 7:33 pm, John Machin wrote: > It is not impossible for a file with dummy data to have been > handcrafted or otherwise produced by a process different to that used > for a real-data file. I knew it was produced by the same process, or I wouldn't have shared it. : ) But you couldn't have

Re: distinction between unzipping bytes and unzipping a file

2009-01-10 Thread webcomm
On Jan 9, 6:07 pm, John Machin wrote: > Yup, it looks like it's encoded in utf_16_le, i.e. no BOM as > God^H^H^HGates intended: > > >>> buff = open('data', 'rb').read() > >>> buff[:100] > > '<\x00R\x00e\x00g\x00i\x00s\x00t\x00r\x00a\x00t\x00i\x00o\x00n\x00> > \x00<\x00B\x0 > 0a\x00l\x00a\x00n\x00c

Re: why cannot assign to function call

2009-01-10 Thread rurpy
On Jan 9, 6:47 am, Mark Wooding wrote: > ru...@yahoo.com wrote: > > As a side comment (because it always bugs me when I read this, even > > though I read it in very authoritative sources), ISTM that C passes > > everything by value except arrays; they are passed by reference (by > > passing a poi

Re: if-else statement

2009-01-10 Thread Philip Semanchuk
On Jan 10, 2009, at 9:26 AM, Duncan Booth wrote: Gandalf wrote: other languages like PHP or javascript as this if-else operator like this myVar = checking == 1? 'string': 'other string' is this stuff exist in python? See http://docs.python.org/reference/expressions.html#boolean-operati

Re: Looking for an efficient Python script to download and save a .zip file programmatically

2009-01-10 Thread Albert Hopkins
On Sat, 2009-01-10 at 17:12 +, David Shi wrote: > I am looking for an efficient Python script to download and save > a .zip file programmatically (from http or https call). > > Regards. > > David urllib? -a -- http://mail.python.org/mailman/listinfo/python-list

Re: Implementing file reading in C/Python

2009-01-10 Thread Francesco Bochicchio
On Fri, 09 Jan 2009 15:34:17 +, MRAB wrote: > Marc 'BlackJack' Rintsch wrote: >> On Fri, 09 Jan 2009 04:04:41 +0100, Johannes Bauer wrote: >> >>> As this was horribly slow (20 Minutes for a 2GB file) I coded the whole >>> thing in C also: >> >> Yours took ~37 minutes for 2 GiB here. This "j

Looking for an efficient Python script to download and save a .zip file programmatically

2009-01-10 Thread David Shi
I am looking for an efficient Python script to download and save a .zip file programmatically (from http or https call).   Regards.   David -- http://mail.python.org/mailman/listinfo/python-list

Re: State of the art: Tkinter, Tk 8.5, Tix?

2009-01-10 Thread r
We need TK 8.5's themes. This will bring Tkinter out of the dark ages and into the 21st Century! And improve the shine of the Python base distro. Python could use a good boost right now! -- http://mail.python.org/mailman/listinfo/python-list

Re: are there some special about '\x1a' symbol

2009-01-10 Thread Mel
sim.sim wrote: > Hi all! > > I had touch with some different python behavior: I was tried to write > into a file a string with the '\x1a' symbol, and for FreeBSD system, > it gives expected result: > open("test", "w").write('before\x1aafter') open('test').read() > 'before\x1aafter' >

Re: are there some special about '\x1a' symbol

2009-01-10 Thread Marc 'BlackJack' Rintsch
On Sat, 10 Jan 2009 07:45:53 -0800, sim.sim wrote: > I had touch with some different python behavior: I was tried to write > into a file a string with the '\x1a' symbol, and for FreeBSD system, it > gives expected result: > open("test", "w").write('before\x1aafter') open('test').read() > 'be

Re: why cannot assign to function call

2009-01-10 Thread Mel
Aaron Brady wrote: > Lastly, I don't see any reason why we couldn't make both explanations > available. 'For those coming from Java/etc; for those coming from > C++/etc.' They would both get read. That's what I was just thinking .. there are lots of others, too: "for those coming from r

Re: why cannot assign to function call

2009-01-10 Thread Mark Wooding
ru...@yahoo.com wrote: > Agreed. I think the docs, especially those that develop > the conceptual model of how Python work at runtime, could > use some major attention. If we can achieve consensus in this (still remarkably civil) discussion, we might be able to amend the docs. > I would be wil

Re: why cannot assign to function call

2009-01-10 Thread Mark Wooding
[Another tome. I hope this contains sufficient new material to continue to be of interest to other readers.] Steven D'Aprano wrote: > On Fri, 09 Jan 2009 20:23:11 +, Mark Wooding wrote: > > > No: not directly. The Python program deals solely with references; > > anything involving actual ob

NorthwestPythonDay, 31 Jan 2009

2009-01-10 Thread James Thiele
Posted for Brian Dorsey Hello everyone, On behalf of the Seattle Python Interest Group, I'd like to invite you to join us for an informal day of Python talks & socializing. When: January, 31st 9am - 5pm Where: University of Washington campus, Seattle, Washington Price: Free! Details and updated

Re: Mocking `from foo import *` functions

2009-01-10 Thread hsoft
On Jan 10, 4:19 pm, Rob Williscroft wrote: > Note that doing the above *before* any other module imports > from sender, will be sufficient in *any* case, though it won't > help if the tested code calls reload( sender ). Yeah, of course, but most of the time, you want to mock at the *test* level,

are there some special about '\x1a' symbol

2009-01-10 Thread sim.sim
Hi all! I had touch with some different python behavior: I was tried to write into a file a string with the '\x1a' symbol, and for FreeBSD system, it gives expected result: >>> open("test", "w").write('before\x1aafter') >>> open('test').read() 'before\x1aafter' but for my WinXP box, it gives so

Re: Mocking `from foo import *` functions

2009-01-10 Thread Rob Williscroft
wrote in news:a9ed10ff-d907-46f0-8c6a- c3d95579a...@k1g2000prb.googlegroups.com in comp.lang.python: > To answer to Rob: yeah, sure that would work, but I always thought Just to note: you're answering a question about testing, but I answered how to alter the alerter module *for* testing. given

Re: if-else statement

2009-01-10 Thread Duncan Booth
Gandalf wrote: > other languages like PHP or javascript as this if-else operator like > this > > myVar = checking == 1? 'string': 'other string' > > is this stuff exist in python? > See http://docs.python.org/reference/expressions.html#boolean-operations conditional_expression ::= or_test

if-else statement

2009-01-10 Thread Gandalf
other languages like PHP or javascript as this if-else operator like this myVar = checking == 1? 'string': 'other string' is this stuff exist in python? thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: why cannot assign to function call

2009-01-10 Thread Aaron Brady
On Jan 9, 9:30 am, Joe Strout wrote: > Aaron Brady wrote: > > Possible compromise.  You can think of functions as mutation-only. > > You pass the object, and it gets a new (additional) name.  The old > > name doesn't go in.   > > That's correct.  The reference itself is passed in, not the variable

Re: why cannot assign to function call

2009-01-10 Thread Steven D'Aprano
On Fri, 09 Jan 2009 20:23:11 +, Mark Wooding wrote: > Steven D'Aprano wrote: > >> I'm pretty sure that no other pure-Python coder has manipulated >> references either. They've manipulated objects. > > No: not directly. The Python program deals solely with references; > anything involving a

Re: Detecting open files and forcing closure

2009-01-10 Thread Steven D'Aprano
On Fri, 09 Jan 2009 22:06:03 -0500, Andrew Robert wrote: > Is there a way to detect the open files and close them out? You can detect open files by trying to move them and catching the exception when you can't. You may wish to distinguish permission errors. As far as forcing the file to close,

Re: Force exception on attribute write access only one object

2009-01-10 Thread Peter Otten
Thomas Guettler wrote: > Peter Otten schrieb: >> Thomas Guettler wrote: >> >>> for debugging I want to raise an exception if an attribute is >>> changed on an object. Since it is only for debugging I don't want >>> to change the integer attribute to a property. >> class A(object): >> def __i