Re: execfile locks file forever if there are any syntax errors - is it python bug?

2007-03-16 Thread Slawomir Nowaczyk
n SVN. https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1681020&group_id=5470 -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) Does a clean house indicate that there is a broken computer in it? -- http://mail.python.org/mailman/listinfo/python-list

execfile locks file forever if there are any syntax errors - is it python bug?

2007-03-14 Thread Slawomir Nowaczyk
unlock the file? It is annoying for me because I often execfile various temporary files and it is a nuisance not to be able to delete them. I have tested with Python 2.5 on Windows... do other versions of Python behave this way as well? -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED

Re: automatically grading small programming assignments

2006-12-20 Thread Slawomir Nowaczyk
about peer review in the education community, where you could get students to verify one another's programs... But this can sometimes be tricky. -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) Someone Else's Code - a commonly used synonym for "Bad Code" -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-17 Thread Slawomir Nowaczyk
Programs" states that "Programs should be written for people to read, and only incidentally for machines to execute." -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) If at first you do succeed, try not to look astonished. -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-16 Thread Slawomir Nowaczyk
lculations() if it: use(it) five (or even ten) times in a medium sized project than to have to figure out what "aif" means. If the idiom is used 100 times, then something is wrong: either system should be redesigned or introducing "aif" is a good idea (but then Pyt

Re: merits of Lisp vs Python

2006-12-15 Thread Slawomir Nowaczyk
it requires me to define function useit instead of embedding the code in aif call, but that has never been a problem for me: in reality, the code I would want to execute would be complex enough to warrant it's own function anyway. Of course, YMMV. -- Best wishes, Slawomir Nowaczyk ( [E

Re: merits of Lisp vs Python

2006-12-13 Thread Slawomir Nowaczyk
t; Two questions: do you really voluntarily use libraries from crappy #> developers? Voluntarily as in "in my work place"? I mean, I *am* voluntarily staying employed, if you wish look at it this way... #> Second, you think a language can stop people from writing bad code? N

Re: merits of Lisp vs Python

2006-12-13 Thread Slawomir Nowaczyk
ets out of sync with semantics? #> In Python, you group in your mind, and press indentation keys to make #> it happen in your editor. In Lisp, you group in your mind, and press parentheses keys to make it happen in your editor. #> The editor cannot help that much, because it cannot read

Re: merits of Lisp vs Python

2006-12-13 Thread Slawomir Nowaczyk
isp, why is Lisp a #> > fringe language? #> Because shifting to lisp somewhere in the middle of #> your project or carear is VERY EXPENSIVE STEP. Doesn't that say something about Lisp? Switching to most other useful languages is a nice experience. Luckily, that claim is obviously fals

Re: merits of Lisp vs Python

2006-12-13 Thread Slawomir Nowaczyk
wins. Including #> automatic indentation. :) Automatic indentation? Wow, that's cool... we in Python need to press RET and sometimes even use this ugly ":" or "" key to get proper indentation. Oh, wait, you mean you need to type "(" and ")" in Lisp?

Re: merits of Lisp vs Python

2006-12-13 Thread Slawomir Nowaczyk
- to find the matching #> paren and select everything contained between the two. Oh, you mean you have never seen a Python environment which could mark the current block of code? -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) Truth is stranger than fiction, because fiction has to make sense. -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-12 Thread Slawomir Nowaczyk
e taken before or #> after a superclass's method, rather than over-riding that method #> entirely? Sure, one can over-ride the method and then call it within #> one's own code, but that obscures the meaning of what one's doing. You can easily create a decorator which will do

Re: merits of Lisp vs Python

2006-12-12 Thread Slawomir Nowaczyk
example to 12 different control codes. What you say is right, but only for bad Python code. Want to bet I can write bad Lisp which will be just as unmaintainable? PS. Good sigmonster, have a cookie! -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) Get the facts first - you can distort them later! -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-12 Thread Slawomir Nowaczyk
is take a block from one branch of "if" statement and put it somewhere else (in a for loop, for example). Sure, this requires you indent the block properly, although I am 100% sure that I could teach emacs to adjust indentation automatically has I needed to. I just never felt the need. -

Re: merits of Lisp vs Python

2006-12-12 Thread Slawomir Nowaczyk
gt; primitiveness of Python makes editing easier. #> #> Why do you say that? Wouldn't a block in python be a "meaningful #> textual entity" in the same way a lisp form would be? No, it wouldn't, because that would make the argument false ;) -- Best wishes, Slawomir

Re: merits of Lisp vs Python

2006-12-12 Thread Slawomir Nowaczyk
sembler? -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) "Be strict when sending and tolerant when receiving." RFC 1958 - Architectural Principles of the Internet - section 3.9 -- http://mail.python.org/mailman/listinfo/python-list

Re: question about True values

2006-10-27 Thread Slawomir Nowaczyk
e those are pathological cases. -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) Programmer - A red-eyed, mumbling mammal capable of conversing with inanimate objects. -- http://mail.python.org/mailman/listinfo/python-list

Re: IDE that uses an external editor?

2006-10-14 Thread Slawomir Nowaczyk
er, I don't want to give up #> the text editing power of Emacs to get it. I don't know... I have never, personally, used Eclipse, so I cannot comment on that. It is highly dependent on what you are working on, I presume. -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) S

Re: IDE that uses an external editor?

2006-10-14 Thread Slawomir Nowaczyk
es pretty well with Emacs, and I suppose vi integrates pretty well with vi... Or do you mean something else by "IDE"? PS. Good sigmonster, have a cookie ;) -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) Vi is to emacs as masturbation is to making love: effective and alway

Re: hide python code !

2006-08-24 Thread Slawomir Nowaczyk
On Wed, 16 Aug 2006 18:35:37 -0700 enigmadude <[EMAIL PROTECTED]> wrote: #> Slawomir Nowaczyk wrote: #> > On Thu, 10 Aug 2006 17:35:27 -0700 #> > enigmadude <[EMAIL PROTECTED]> wrote: #> > #> > #> 2. I've never done this, but you might be able to enc

Re: Nested function scope problem

2006-08-11 Thread Slawomir Nowaczyk
On Wed, 09 Aug 2006 15:11:16 -0300 Gerhard Fiedler <[EMAIL PROTECTED]> wrote: #> On 2006-08-09 07:54:21, Slawomir Nowaczyk wrote: #> #> > Nope. Equivalence table can look like this: #> > #> >Python C #> > variable

Re: converting a nested try/except statement into try/except/else

2006-08-11 Thread Slawomir Nowaczyk
t point. Something about having fewer "code paths" to test or #> something. Number of return statements has absolutely *nothing* to do with number of code paths to test. -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) Only drug dealers and software compa

Re: hide python code !

2006-08-11 Thread Slawomir Nowaczyk
ort hook" is, it actually needs to know the way to *decrypt* the module (secret key or whatever). It means that if somebody decompiles the importing code, he can just as well decompile the "hidden" one. -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) Children are na

Re: easy string formating question

2006-08-11 Thread Slawomir Nowaczyk
if not data: #> break #> print >> out, data + "?\n", #> #> print out.getvalue() This looks slightly nicer, but still, I wish there was some kind of StringIO.isEOF() to put in while condition. Don't take me wrong, I love "while True" stuff, bu

Re: converting a nested try/except statement into try/except/else

2006-08-10 Thread Slawomir Nowaczyk
is *will* be a real ValueError for negative integers ;-) ;-) ;-) But no, I am not suggesting that... especially since "-0" is valid. -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) COMMAND: A suggestion made to a computer. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to execute a file outside module's namespace?

2006-08-10 Thread Slawomir Nowaczyk
On Fri, 11 Aug 2006 01:23:14 +0800 Angelo Zhou <[EMAIL PROTECTED]> wrote: #> Slawomir Nowaczyk wrote: #> > Hello, #> > #> > Let's say I have a module "emacs", defining function eexecfile(file): #> > #> > def eexecfile(file): #&

Re: easy string formating question

2006-08-10 Thread Slawomir Nowaczyk
On Thu, 10 Aug 2006 11:39:41 -0700 f pemberton <[EMAIL PROTECTED]> wrote: #> I have kind of an interesting string, it looks like a couple hundred #> letters bunched together with no spaces. Anyway, i'm trying to put a #> "?" and a (\n) newline after every 100th character of the string and #> the

Re: knowing when file is flushed to disk

2006-08-10 Thread Slawomir Nowaczyk
goals was to provide a replacement for file storage. There is python binding http://pysqlite.org which is, IIRC, supposed to be in stdlib for Python 2.5 That said, if your disk and/or OS is lying about the fact whether it has actually wrote the data or not, there is not much you can do. -- Bes

Re: converting a nested try/except statement into try/except/else

2006-08-10 Thread Slawomir Nowaczyk
I lost the test in the #> original if statement. #> #> So my question is, can I still retain this second structure and #> still test for > 0, but not have any extra nesting? How about try: if int(text) > 0: return True except ValueError: pass self.error_messag

Re: do people really complain about significant whitespace?

2006-08-10 Thread Slawomir Nowaczyk
fragment of my python-mode.el: Please note that this comment doesn't say anything about automatically inserting newlines, only about indenting (actually, dedenting) as needed. Anyway, this is probably becoming off-topic here. -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) C

How to execute a file outside module's namespace?

2006-08-10 Thread Slawomir Nowaczyk
o other stuff execfile(file, __main__.__dict__) # do other stuff seems to work, but it gives me a slightly uneasy feeling. Is this the right way? -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) Today advance is so rapid that even the astronauts who set foot on the moo

Re: do people really complain about significant whitespace?

2006-08-10 Thread Slawomir Nowaczyk
On Wed, 09 Aug 2006 07:33:41 -0700 Rob Wolfe <[EMAIL PROTECTED]> wrote: #> Slawomir Nowaczyk wrote: #> #> > Really, typing brace after function/if/etc should add newlines and #> > indent code as required -- automatically. Actually, for me, it is even #> > *less* typ

Re: do people really complain about significant whitespace?

2006-08-09 Thread Slawomir Nowaczyk
ode in any language. We should focus on making it easier to write good code, not to make writing bad code difficult. -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) The nice thing about standards is that there are so many of them to choose from. -- http://mail.python.org/mailman/listinfo/python-list

Re: do people really complain about significant whitespace?

2006-08-09 Thread Slawomir Nowaczyk
On Wed, 09 Aug 2006 05:00:20 -0700 "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: #> Slawomir Nowaczyk wrote: #> > #> > I must admit I do not get this "indicate intentions twice" argument, #> > even though I heard it a number of times now... It&#

Re: Question about using python as a scripting language

2006-08-09 Thread Slawomir Nowaczyk
al is like optimisation. There are two rules: Rule 1: Do not use it. Rule 2 (for experts only): Do not use it (yet). :) -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) The good people sleep much better at night than the bad people. Of course, the bad people enjoy the waking hours much more. -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested function scope problem

2006-08-09 Thread Slawomir Nowaczyk
On Sun, 06 Aug 2006 11:37:46 -0300 Gerhard Fiedler <[EMAIL PROTECTED]> wrote: #> On 2006-08-06 06:41:27, Slawomir Nowaczyk wrote: #> #> > Since Python doesn't (supposedly) have variables, it couldn't have come #> > from Python. #> #> The idea (of

Re: Nested function scope problem

2006-08-09 Thread Slawomir Nowaczyk
No I did not. At least not intentionally. #> > I just noticed that part of our disagreement comes from the fact that #> > I am talking about C variables as they look at runtime, while you seem #> > to also consider the source code to be relevant. Am I correct? #> #> You're correct in that I considered the source. But that's not really #> important. I could leave the C source and go to the C runtime. I think it would be easier to talk this way... After all, "int a=1" and "int b=1" are *exactly* equivalent in C, while "a=1" and "b=1" are not quite as equivalent in Python (consider if next line of program contains stuff like input() ) #> However, then we don't really have anymore a C variable 'a', we #> only have a memory location. I tend to disagree -- I would say that the term "variable" has meaning also at runtime. #> That's probably one more inconsistency in the analogy. Not really, that's exactly what makes the analogy work. -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) Don't personify computers. They hate that. -- http://mail.python.org/mailman/listinfo/python-list

Re: do people really complain about significant whitespace?

2006-08-09 Thread Slawomir Nowaczyk
with dictionary literals. Hmmm. -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) "Be strict when sending and tolerant when receiving." RFC 1958 - Architectural Principles of the Internet - section 3.9 -- http://mail.python.org/mailman/listinfo/python-list

Re: Proposal: [... for ... while cond(x)]

2006-08-06 Thread Slawomir Nowaczyk
t; gives different result: >>> [x for x in range(10) if x in a] [0, 1, 2, 3, 7, 8, 9] #> Your proposal adds nothing. Well, I am not sure how useful the proposal really is, but it seems to add *something* if it would allow for things like: [x for x in range(10) while x in a] -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) Women who seek to be equal to men lack ambition. -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested function scope problem

2006-08-06 Thread Slawomir Nowaczyk
id(), it couldn't have come from C... So? Obviously, if we use pythonic terminology of "binding", a statement would be that id(a) "is an id of a binding", which doesn't make much sense. Antoon is right, id(a) is an identifier _of an object bound to a_. Which translates into C++ as "an object pointed to by a", IMHO. -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) If at first you do succeed, try not to look astonished. -- http://mail.python.org/mailman/listinfo/python-list

Re: regex question

2006-08-06 Thread Slawomir Nowaczyk
#> Premature optimisation #> #> #>>> test('bcd') #> True #> #>>> Oooops... You are right. Should be format, index = 'abcd', -1 of course. Thanks. -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) I believe that math illiteracy affects 7 out of every 5 people. -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested function scope problem

2006-08-06 Thread Slawomir Nowaczyk
On Sat, 05 Aug 2006 02:55:03 -0700 Bill Pursell <[EMAIL PROTECTED]> wrote: #> Gerhard Fiedler wrote: #> > There's no Python equivalent to "int*p=345; *p++;". #> #> Sure there is: #> #> os.kill(os.getpid(), signal.SIGSEGV) LOL... that's a good

Re: Nested function scope problem

2006-08-04 Thread Slawomir Nowaczyk
On Fri, 04 Aug 2006 10:10:45 -0300 Gerhard Fiedler <[EMAIL PROTECTED]> wrote: #> On 2006-08-04 07:36:25, Slawomir Nowaczyk wrote: #> #> > #> The address operator is probably for a C programmer the closest to #> > #> what the id() function is to a Python program

Re: regex question

2006-08-04 Thread Slawomir Nowaczyk
at was made a dictionary or if one wanted to compare characters directly. Writing (and profiling) left as an exercise for a reader. -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) A mind is like a parachute. It doesn't work unless it's open. -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested function scope problem

2006-08-04 Thread Slawomir Nowaczyk
sentation (i.e. what you type, like "a") is in Python. Equivalent of id() is a dereference operator. Of course, there are probably other ways to look at this. But I still do not see why people claim that there is a significant difference between what variables are in Python and in C++

Re: Static Variables in Python?

2006-08-03 Thread Slawomir Nowaczyk
On Tue, 01 Aug 2006 07:37:20 -0400 Michael Yanowitz <[EMAIL PROTECTED]> wrote: #>I like the class idea, however I realize that the class object itself #> has to be global. But no more global than your original set_bit was... -- Best wishes, Slawomir Nowaczyk ( [EMA

Re: Nested function scope problem

2006-08-03 Thread Slawomir Nowaczyk
ble b to change with a simple #> assignment from a C/C++ point of view. That depends on your definition of "identity", of course. #> You also don't expect the "identity" of a and b to be the same #> after assigning one to the other. Don't I? -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) You can tell a bigot, but you can't tell him much. -- http://mail.python.org/mailman/listinfo/python-list

Re: How do you use this list ?

2006-06-27 Thread Slawomir Nowaczyk
On Tue, 27 Jun 2006 14:22:19 + Grant Edwards <[EMAIL PROTECTED]> wrote: #> Actually having mailing lists send you mail is insane. Just curious: what's insane about it? -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) Never attribute to malice that which can

Re: BeautifulSoup error

2006-06-16 Thread Slawomir Nowaczyk
cii', when it needs to #> decode the data in 'port' to Unicode. Some of the data in that #> object makes no sense in the 'ascii' encoding, so it barfs. In other words, this works for me: >>> soup.feed( unicode(port,"iso-8859-1") ) -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) ^[:wq! Crap! Thought I was in vi. -- http://mail.python.org/mailman/listinfo/python-list

Re: a good programming text editor (not IDE)

2006-06-15 Thread Slawomir Nowaczyk
wrapped if they extend beyond | `fill-column'. The soft newlines used for line wrapping will not | show up when the text is yanked or saved to disk. `- I do not use it, personally, but it does exist. -- Best wishes, Slawomir Nowaczyk (

Re: a good programming text editor (not IDE)

2006-06-15 Thread Slawomir Nowaczyk
Emacs anyway. We no longer feel the need to argue with people who praise various versions of notepad ;-) ;-) ;-) -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) Conscience is what hurts when everything else feels so good. -- http://mail.python.org/mailman/listinfo/python-list

Re: better Python IDE? Mimics Maya's script editor?

2006-06-09 Thread Slawomir Nowaczyk
rdly a substitute for PythonWin, though: the learning curve is quite steep. -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) If you're constantly looking behind you, you may miss the frontal attack. -- http://mail.python.org/mailman/listinfo/python-list

Re: CONSTRUCT - Python's way of Ruby's "alias_method"

2006-06-08 Thread Slawomir Nowaczyk
le -- I do not know if a good one -- here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52192 -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) Strange how people who don't even know their neighbors are extremely curious to know if there's extra-terrestrial

Re: CONSTRUCT - Python's way of Ruby's "alias_method"

2006-06-08 Thread Slawomir Nowaczyk
for this list and the question asked concerns *Python*, with django being only a use case. -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) Some drink at the fountain of knowledge. Others just gargle. -- http://mail.python.org/mailman/listinfo/python-list

Re: An oddity in list comparison and element assignment

2006-06-05 Thread Slawomir Nowaczyk
t;, I have in mind what happens with files... and I to me semantics of []*3 is more like symbolic linking, not copying. While I, personally, understand the sentence in question "The result of S*n or n*S is the concatenation of n copies of S" correctly, I *do* see how it might be misunder

Re: An oddity in list comparison and element assignment

2006-06-02 Thread Slawomir Nowaczyk
but then, I am not sure as I do not understand what his requirements actually are (they seem to make some sense for immutable objects, but how should they generalise to mutable stuff I have no idea). PS. Thanks for explanation about Bank of America: I had no clue how it works in realty, it just had

Re: An oddity in list comparison and element assignment

2006-06-01 Thread Slawomir Nowaczyk
ions" mean? In particular, what should be the results of each of the following three comparisons: x, y, z = [1],[1],[1] a, b = [x,y], [y,z] c, d = [[1],[1]], [[1],[1]] a == b c == d a[0].remove(1) b[0].remove(1) a == b So, do I understand correctly that you would like first comparison (a==b)

Re: An oddity in list comparison and element assignment

2006-06-01 Thread Slawomir Nowaczyk
t (modifiable) objects can ever be really equal. -- Best wishes, Slawomir Nowaczyk ( [EMAIL PROTECTED] ) I believe that math illiteracy affects 7 out of every 5 people. -- http://mail.python.org/mailman/listinfo/python-list