Re: Does '!=' equivelent to 'is not'

2008-06-18 Thread Lie
27;id() testing' isn't exactly the same either. > > Saying a flat "no" alone, without qualifying your statement is > > generally interpreted as rude in English...  It's kind of like how you > > talk to children when they're too young to understand th

Re: Does '!=' equivelent to 'is not'

2008-06-18 Thread Lie
e too young to understand the explanation. > >> Yucky. > > > I didn't meant to be rude at all - and I apologize to Mr. Lie. The > > explanation for such strong "No" was in the paragraph below it (the idea > > was to say: "No to this, yes to that") >

Re: python string comparison oddity

2008-06-18 Thread Lie
On Jun 19, 2:26 am, Faheem Mitha <[EMAIL PROTECTED]> wrote: > Hi everybody, > > I was wondering if anyone can explain this. My understanding is that 'is' > checks if the object is the same. However, in that case, why this > inconsistency for short strings? I would expect a 'False' for all three > c

Re: Does '!=' equivelent to 'is not'

2008-06-18 Thread Lie
On Jun 19, 2:51 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Jun 18, 2:22 pm, Lie <[EMAIL PROTECTED]> wrote: > > > > > I'm not a native English speaker, although I think my parents would > > have liked me to be more straightforward when talking, caus

Re: how to send a "Multiline" mail with smtplib?

2008-06-19 Thread Lie
On Jun 19, 4:02 pm, Justin Ezequiel <[EMAIL PROTECTED]> wrote: > perhaps change html > > body=MIMEText('hello,\r\n > ok',_subtype='html',_charset='windows-1255') > > to plain > > body=MIMEText('hello,\r\n > ok',_subtype='plain',_charset='windows-1255') If that was the case, and you needed a line b

Re: python string comparison oddity

2008-06-19 Thread Lie
On Jun 19, 5:13 am, Faheem Mitha <[EMAIL PROTECTED]> wrote: > On Wed, 18 Jun 2008 12:57:44 -0700 (PDT), Lie <[EMAIL PROTECTED]> wrote: > > On Jun 19, 2:26 am, Faheem Mitha <[EMAIL PROTECTED]> wrote: > >> Hi everybody, > > >> I was wondering if anyon

Re: Simple Python class questions

2008-06-19 Thread Lie
On Jun 19, 6:54 pm, John Dann <[EMAIL PROTECTED]> wrote: > A Python newbie, but some basic understanding of how classes, objects > etc work in eg VB.Net. However, I'm struggling a little to translate > this knowledge into the Python context. > > I'm trying to teach myself this aspect of Python by w

Re: Simple Python class questions

2008-06-19 Thread Lie
On Jun 19, 7:21 pm, Ulrich Eckhardt <[EMAIL PROTECTED]> wrote: > John Dann wrote: > > Let's say I define the class in a module called comms.py. The class > > isn't really going to inherit from any other class (except presumably > > in the most primitive base-class sense, which is presumably automat

Re: Simple Python class questions

2008-06-20 Thread Lie
On Jun 19, 10:49 pm, Ulrich Eckhardt <[EMAIL PROTECTED]> wrote: > Lie wrote: > > I think it's not that hard to see that it's just a pseudo code > > "...in comms.py I have: ..." actually explicitly says that it is actual code > from a file. > > *s

Re: Python "is" behavior

2008-06-21 Thread Lie
On Jun 21, 2:14 am, Gary Herron <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Jun 20, 9:38 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > > >> On Fri, 20 Jun 2008 09:31:57 -0700 (PDT), [EMAIL PROTECTED] wrote: > > >>> I am not certain why this is the case, but... > > >> a =

Re: An idiom for code generation with exec

2008-06-21 Thread Lie
On Jun 21, 2:02 pm, eliben <[EMAIL PROTECTED]> wrote: > On Jun 21, 8:52 am, Peter Otten <[EMAIL PROTECTED]> wrote: > > > > > eliben wrote: > > > On Jun 20, 2:44 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > > >> eliben wrote: > > >> > Additionally, I've found indentation to be a problem in such > >

Re: -1/2

2008-06-23 Thread Lie
On Jun 23, 1:32 am, "Serve Lau" <[EMAIL PROTECTED]> wrote: > What is the expected result of -1/2 in python? Operator precedence: Both python 2 and 3 follows the same rule for operator precedence, see: http://www.ibiblio.org/g2swap/byteofpython/read/operator-precedence.html . In -1/2, unary negati

Re: Storing value with limits in object

2008-06-23 Thread Lie
On Jun 23, 1:24 am, "Josip" <[EMAIL PROTECTED]> wrote: > > Why not make it a function? > > > function assignLimited(value, vmin, vmax): > >     value = max(vmin, value) > >     value = min(vmax, value) > >     return value > > > a = assignLimited(7, 0, 10) > > > Seems like it solves your problem re

Re: Storing value with limits in object

2008-06-23 Thread Lie
On Jun 23, 1:24 am, "Josip" <[EMAIL PROTECTED]> wrote: > > Why not make it a function? > > > function assignLimited(value, vmin, vmax): > >     value = max(vmin, value) > >     value = min(vmax, value) > >     return value > > > a = assignLimited(7, 0, 10) > > > Seems like it solves your problem re

Re: Storing value with limits in object

2008-06-23 Thread Lie
#!/usr/bin/env python ## VERSION 2 ## ## changelog: ## - Uses inheritance from _Limited ## - Added _LimitedLong and llong ## - limit choose between int, long, and float class _Limited(object): def setlimits(self, lim): ''' Set the limits and if value is not within limit, r

Re: Question: How do I format printing in python

2008-06-25 Thread Lie
On Jun 24, 12:12 am, [EMAIL PROTECTED] wrote: > Hi All, > > How do I format printed data in python? > I could not find this in the Python Reference > Manual:http://docs.python.org/ref/print.html > Nor could I find it in Matloff's great > tutorial:http://heather.cs.ucdavis.edu/~matloff/Python/Pyth

Re: reading from list with paths

2008-06-25 Thread Lie
On Jun 26, 1:59 am, antar2 <[EMAIL PROTECTED]> wrote: > Hello, > > I would like to  read and print files, of which the complete filepaths > are >  mentioned in another textfile. In this textfile (list.txt)  are for >  example the following paths: > > /data/chorec/chorec-nieuw/s01/S01C001M1/S01C001M

Re: help debugging noob code - converting binary data to images...

2008-06-29 Thread Lie
On Jun 29, 11:18 am, [EMAIL PROTECTED] wrote: > Ok I'm a Python noob, been doing OK so far, working on a data > conversion program and want to create some character image files from > an 8-bit ROM file. > > Creating the image I've got down, I open the file and use TK to draw > the images... but > >

Re: help debugging noob code - converting binary data to images...

2008-06-29 Thread Lie
On Jun 29, 4:47 pm, Lie <[EMAIL PROTECTED]> wrote: > On Jun 29, 11:18 am, [EMAIL PROTECTED] wrote: > > > > > Ok I'm a Python noob, been doing OK so far, working on a data > > conversion program and want to create some character image files from > > an 8-bi

Re: What is "@" used for ?

2008-06-29 Thread Lie
On Jun 29, 3:39 pm, gops <[EMAIL PROTECTED]> wrote: > Hi. > > I am noob in python. while reading some source code I came across , > this funny thing called @ in some function , > > def administrator(method): >     @functools.wraps(method) >     def wrapper(self, *args, **kwargs): >         user = u

Re: Beginner's Python development questions

2008-06-29 Thread Lie
On Jun 29, 12:46 am, "Łukasz Dąbek" <[EMAIL PROTECTED]> wrote: > Hello! > > I'm newcomer to Python development and I have some questions (I didn't > found answers for these): >     1. Some bugs at bugs.python.org are assigned but it didn't changed > for many months (example:http://bugs.python.org/i

Re: complex numbers should respect the "I" representation

2008-06-29 Thread Lie
On Jun 29, 8:39 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-06-29, Roy Smith <[EMAIL PROTECTED]> wrote: > > >> I think complex numbers should respect the "i" or "I" > >> representation, instead of "j". No reason being cute and using > >> a different character instead of the traditional >

Re: Confused yet again: Very Newbie Question

2008-07-08 Thread Lie
On Jul 7, 7:09 pm, Jeff <[EMAIL PROTECTED]> wrote: > When you call c3.createJoe(c1.fred), you are passing a copy of the > value stored in c1.fred to your function.  Python passes function > parameters by value. No, python doesn't pass variable either by value or by reference. The behavior in pytho

Re: how are strings immutable in python?

2008-07-08 Thread Lie
On Jul 7, 1:45 am, ssecorp <[EMAIL PROTECTED]> wrote: > >>> h = "aja baja" # 'aja baja' is created and assigned to the name h > >>> h += 'e' # Is the equivalent of: # h = h + 'e' # # In there, a h and 'e' is concatenated and assigned to # a new string object which is bound to h. The # original str

Re: Why is this blowing the stack, thought it was tail-recursive...

2008-07-16 Thread Lie
On Jul 13, 8:44 pm, Fuzzyman <[EMAIL PROTECTED]> wrote: > On Jul 13, 7:56 am, Steven D'Aprano <[EMAIL PROTECTED] > > > > cybersource.com.au> wrote: > > On Sat, 12 Jul 2008 19:25:18 -0400, Terry Reedy wrote: > > > ssecorp wrote: > > >> def fib(n): > > >>     def fibt(a, b, n): > > >>         if n <=

Re: Rotating a cube

2008-07-19 Thread Lie
On Jul 17, 3:11 pm, J-Burns <[EMAIL PROTECTED]> wrote: > On Jul 17, 12:53 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > J-Burns wrote: > > > Is there a built in Python function for this? > > > for answering questions that have nothing to do with programming, and > > looks quite a bit like home

Re: Change PC to Win or Windows

2008-07-19 Thread Lie
On Jul 19, 6:14 am, Derek Martin <[EMAIL PROTECTED]> wrote: > On Fri, Jul 18, 2008 at 03:46:13PM -0700, Joel Teichroeb wrote: > > Calling Windows PC seems to be something that Apple did so they would > > not have to directly mention Windows. > > Actually it's something IBM did when they created the

Re: Change PC to Win or Windows

2008-07-21 Thread Lie
rosoft starts to lose its total and complete dominance, i.e. around right now) the term's meaning become a huge matter because people associated the term with Microsoft Windows (i.e. software), not with IBM-PC and its clones anymore (i.e. hardware). On Jul 21, 11:50 pm, Derek Martin <[EMAI

Re: Change PC to Win or Windows

2008-07-21 Thread Lie
On Mon, 2008-07-21 at 16:45 -0400, Derek Martin wrote: > On Mon, Jul 21, 2008 at 12:32:00PM -0700, Lie wrote: > > > The term "PC" is commonly used in English, in the United States > > > and other English speaking countries, to mean a computer running > > > M

Re: Attack a sacred Python Cow

2008-07-25 Thread Lie
On Jul 24, 9:26 pm, Jordan <[EMAIL PROTECTED]> wrote: > In reality? I'll just keep writing Python (hopefully enough so that > explicit self become burned into muscle memory), and use other > languages when necessary (no more C than I have to, looking forward to > dabbling in Erlang soon, and one da

xml.dom's weirdness?

2008-07-25 Thread Lie
Why this generates AttributeError, then not? Python 2.5.2 (r252:60911, Apr 21 2008, 11:17:30) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import xml >>> xml.dom Traceback (most recent call last): File "", line 1, in At

Re: Insert character at a fixed position of lines

2008-07-26 Thread Lie
On Jul 26, 2:41 pm, "Francesco Pietra" <[EMAIL PROTECTED]> wrote: > How to insert letter "A" on each line (of a very long list of lines) > at position 22, i.e., one space after "LEU", leaving all other > characters at the same position as in the original example: > > ATOM      1  N   LEU     1    

Re: xml.dom's weirdness?

2008-07-26 Thread Lie
On Jul 26, 2:29 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Lie wrote: > > Why this generates AttributeError, then not? > > > Python 2.5.2 (r252:60911, Apr 21 2008, 11:17:30) > > [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 > > Type "help"

Re: re.findall(a patern,'function(dsf sdf sdf)')

2008-07-26 Thread Lie
On Jul 26, 5:03 pm, [EMAIL PROTECTED] wrote: > H! > > First I have some random string below. > > bla = """           >                 // >                 var bla = new Blaobject("argh 1a", "argh 2a", "24", 24, 345) > >                 function la( tec ) >                 { >          

Re: Insert character at a fixed position of lines

2008-07-26 Thread Lie
e similar behavior as regular files you opened with open(). stdin is a read-only file, while stdout is a write-only file. You already know how to make read-only file, f = open("xxx.pdb", "r"), to make it writable, you've got to use 'w' as the mode: f = open(

Re: print doesn't respect file inheritance?

2008-07-26 Thread Lie
On Jul 26, 8:50 am, bukzor <[EMAIL PROTECTED]> wrote: > I was trying to change the behaviour of print (tee all output to a > temp file) by inheriting from file and overwriting sys.stdout, but it > looks like print uses C-level stuff  to do its writes which bypasses > the python object/inhertiance s

Re: xml.dom's weirdness?

2008-07-26 Thread Lie
On Jul 26, 6:03 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Lie wrote: > > If you have any idea what black magic is happening in my computer > > right now, I'd appreciate it. > > command completion?  (no ubuntu within reach right now, so I cannot > check how t

Re: xml.dom's weirdness?

2008-07-27 Thread Lie
On Jul 27, 3:48 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Lie wrote: > > Question: Is there a way to list loaded modules, including those that > > aren't in my namespace? > > such as sys.modules? > > Modules are not unloaded automatically just because

Re: Attack a sacred Python Cow

2008-07-27 Thread Lie
On Jul 27, 2:48 am, "Russ P." <[EMAIL PROTECTED]> wrote: > > If, as I wrote, you permit the omission of "self" in method signatures > > defined within class definitions, then you could still insist on > > instance attribute qualification using "self" - exactly as one would > > when writing Java acc

Re: Insert character at a fixed position of lines

2008-07-30 Thread Lie
On Jul 27, 10:02 am, alex23 <[EMAIL PROTECTED]> wrote: > Ugh, and in pointing our your inaccurate code I posted my own: > > > >>> f = open('dummy.txt','w') > > >>> f.write(line = 'this doesn't work') > > >   File "", line 1 > >     f.write(line = 'this doesn't work') > >                            

Re: Print statement isn't showing up?

2008-08-06 Thread Lie
On Aug 6, 2:28 am, "Timothy Grant" <[EMAIL PROTECTED]> wrote: > On Tue, Aug 5, 2008 at 9:09 AM, Robert Dailey <[EMAIL PROTECTED]> wrote: > > Hi, > > > I have the following code: > > > def ReplaceExternalWithCopy( localDir, remoteDir ): > >     print "Removing external local directory:", localDir >

Re: small issue with Idle

2008-08-08 Thread Lie
On Aug 8, 9:41 pm, v4vijayakumar <[EMAIL PROTECTED]> wrote: > When you press 'home' button cursor goes before >>> prompt. This is > little uncomfortable. > > I am using Idle 1.2.2. (python 2.5.2.) This is IDLE's behavior, not really python's. Anyway, I don't really mind the minor annoyance as you

Re: Why prefer != over <> for Python 3.0?

2008-03-29 Thread Lie
On Mar 29, 5:55 pm, [EMAIL PROTECTED] wrote: > I don't know if this is the right place to discuss the death of <> in > Python 3.0, or if there have been any meaningful discussions posted > before (hard to search google with '<>' keyword), but why would anyone > prefer the comparison operator != ove

Re: Why prefer != over <> for Python 3.0?

2008-03-29 Thread Lie
On Mar 30, 1:24 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Lie <[EMAIL PROTECTED]> wrote: > > You're forcing your argument too much, both != and <> are NOT standard > > mathematics operators -- the standard not-equal operator is >< -- and >

Re: Problem with python

2008-03-29 Thread Lie
On Mar 30, 2:57 am, [EMAIL PROTECTED] wrote: > Hi there. > I downloaded python a couple of days ago from the official site and > have started writing simple programs in the python gui (this being my > first attempt at programming ever). The only thing is when I write > python code in a text editor

Re: Problem with python

2008-03-30 Thread Lie
[EMAIL PROTECTED] wrote to me: (snip) > OK thanks mate you're the man :) > One more question though :P > If I write a python script in a text editor (I use Programmers > Notepad), how do I write indentations properly? e.g.: > --- > temperature = input

Re: License of Python

2008-03-30 Thread Lie
On Mar 30, 6:42 pm, iu2 <[EMAIL PROTECTED]> wrote: > Hi guys, > > I'd like to use Python in a commercial application. In fact I would > like to write the application entirely in Python. > But I think I wouldn't like telling what language the application is > written in. Why is the reason for that?

Re: License of Python

2008-03-30 Thread Lie
On Mar 30, 10:28 pm, "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote: > On Sun, 30 Mar 2008 08:16:39 -0700 (PDT) > > iu2 <[EMAIL PROTECTED]> wrote: > > > > I'd like to use Python in a commercial application. In fact I would > > > > like to write the application entirely in Python. > > > > But I think

Re: Why prefer != over <> for Python 3.0?

2008-03-30 Thread Lie
On Mar 30, 7:48 pm, Bjoern Schliessmann wrote: > Torsten Bronger wrote: > > Maybe he means "?". > > Haven't seen this either, nor do I think it's the same than "<>". > From afar, it looks more like "><". Actually I meant an X-like symbol that is made not by crossing but by ><. I retracted saying

Re: Why prefer != over <> for Python 3.0?

2008-03-30 Thread Lie
On Mar 30, 5:25 pm, Bjoern Schliessmann wrote: > Lie wrote: > > Ah yes, that is also used (I completely forgot about that one, my > > math's aren't that sharp anymore) and I think it's used more > > frequently than ><. > > Where did you read that

Re: Why prefer != over <> for Python 3.0?

2008-03-30 Thread Lie
On Mar 30, 12:11 pm, hdante <[EMAIL PROTECTED]> wrote: (snip) > BTW, my opinion is that it's already time that programmer editors > have input methods advanced enough for generating this: > > if x ≠ 0: > ∀y ∈ s: > if y ≥ 0: f1(y) > else: f2(y) That would be a nightmare. Progr

Re: Newbie Question - Overloading ==

2008-04-04 Thread Lie
On Apr 1, 2:22 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > >> Surely an A isn't equal to every other object which just happens to > >> have the same attributes 'a' and 'b'? > > > And why not ?-) > > >> I would have thoughts the tests want to be > >

Re: Looking for Advanced Python Tutorials

2008-04-06 Thread Lie
On Apr 4, 6:58 pm, [EMAIL PROTECTED] wrote: > I was wondering if anyone knew of some online (free if possible) > advanced tutorials, especially ones that provides tasks and ideas for > small projects. The issue for myself is I want to improve my python > programming level, and my ability to program

Re: append to a sublist - please help

2008-04-06 Thread Lie
On Apr 6, 11:16 pm, Helmut Jarausch <[EMAIL PROTECTED]> wrote: > Hi, > > I must be blind but I don't see what's going wrong > with The reason is: > G=[[]]*2 is doing a "shallow copy" of the blank list. The corrected code is either: G = [[] for _ in xrange(2)] or G = [[], []] btw, this is a

Re: How To Uses Modules And Plugins

2008-04-06 Thread Lie
On Apr 7, 12:28 am, [EMAIL PROTECTED] wrote: > I am working on a client/server, computer role-play game using Python. > I want to gradually expand the game world by creating maps as > individual py files in a map directory. I am a little foggy of how to > do this. I have read about the __import__()

A funnily inconsistent behavior of int and float

2008-04-06 Thread Lie
I've noticed some oddly inconsistent behavior with int and float: Python 2.5.1 (r251:54863, Mar 7 2008, 03:39:23) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 >>> int('- 345') -345 works, but >>> float('- 345.083') Traceback (most recent call last): File

Re: First Python project - comments welcome!

2008-04-07 Thread Lie
On Apr 7, 3:03 pm, Paul Scott <[EMAIL PROTECTED]> wrote: > I have started, and made some progress (OK it works, but needs some > love) on my first real Python application. > > http://cvs2.uwc.ac.za/trac/python_tools/browser/podder > > I would love some feedback on what I have done. In total this ha

Re: A funnily inconsistent behavior of int and float

2008-04-07 Thread Lie
ough, I think it should say "may be surrounded by whitespace" as opposed to "optionally surrounded by whitespace". On Apr 7, 1:55 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-04-06, Lie <[EMAIL PROTECTED]> wrote: > > > I've noticed some od

Re: Translating keywords

2008-04-08 Thread Lie
On Apr 7, 9:54 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Ronn Ross wrote: > > This is my first post and I'm new to Python. How would someone go about > > adding keywords to Python? It would be great to add support for > > Esperanto keywords in the language instead of English being the only > >

Re: Rounding a number to nearest even

2008-04-11 Thread Lie
On Apr 11, 10:19 pm, Mikael Olofsson <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] commented about rounding towards even numbers > from mid-way between integers as opposed to for instance always rounding > up in those cases: > > > Strange request though, why do you need it that way, because 2.5 is

Re: Rounding a number to nearest even

2008-04-13 Thread Lie
On Apr 12, 3:44 am, hdante <[EMAIL PROTECTED]> wrote: (snip) > > In this table, we consider that a number is rounded down when the > > But then, the "Round up" table gives inconsistent results if, by the > same argument, we consider 2.0 -> 2 rounding up. (you get 12 round ups > and 8 round downs j

Re: from __future__ import print

2008-04-13 Thread Lie
On Apr 11, 7:26 pm, Bruno Desthuilliers wrote: > [EMAIL PROTECTED] a écrit : > > > Am I the only one that thinks this would be useful? :) > > > I'd really like to be able to use python 3.0's print statement in > > 2.x. > > > FWIW, the whole point is that in 3.0, print stop being a statement to >

Re: Rounding a number to nearest even

2008-04-17 Thread Lie
On Apr 13, 7:20 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Lie wrote: > > On Apr 12, 3:44 am, hdante <[EMAIL PROTECTED]> wrote: > [snip] > > > In short, choosing that x.0 is rounded down and x.5 is rounded up is > > arbitrary but not without a reason. &

Re: Python 2.5 adoption

2008-04-20 Thread Lie
On Apr 19, 1:08 am, Joseph Turian <[EMAIL PROTECTED]> wrote: > How widely adopted is python 2.5? > > We are doing some development, and have a choice to make: > a) Use all the 2.5 features we want. > b) Maintain backwards compatability with 2.4. > There is another choice: Develop with future in mi

Re: python setup.py install on Vista?

2008-04-20 Thread Lie
On Apr 19, 6:29 am, globalrev <[EMAIL PROTECTED]> wrote: > type "python setup.py install" > > that is used in most "addons" for python. > > well using windows vista, where the h*** am i supposed to type this? > > if it is not doable in windows, what do i have to do instead? just > clicking the setu

Re: from __future__ import print

2008-04-20 Thread Lie
On Apr 13, 7:23 pm, Roy Smith <[EMAIL PROTECTED]> wrote: > In article > <[EMAIL PROTECTED]>, > > Lie <[EMAIL PROTECTED]> wrote: > > I wish py3k > > would make it an option whether to treat print as statement or > > function though. > > Arrrgg

Re: python setup.py install on Vista?

2008-04-20 Thread Lie
On Apr 20, 9:59 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > It seems that quite a lot of people wondered why python doesn't set > > the environment variable to Python Path in the default installation. > > For several reasons, one being that it's not needed. Just run setup.py > as a program

Re: question about the mainloop

2008-04-22 Thread Lie
On Apr 21, 6:24 am, globalrev <[EMAIL PROTECTED]> wrote: > in C?? java etc there is usually: > > procedure 1 > procedure 2 > procedure 3 > > main { > procedure 1 > procedure 2 > procedure 3 > > } > > i dont get the mainloop() in python. i mean i have written some > programs, for example a calculato

Re: Alternate indent proposal for python 3000

2008-04-22 Thread Lie
On Apr 21, 7:04 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > Off the top of my head: copy C and use {} to demarcate blocks and ';' to > end statements, so that '\n' is not needed and is just whitespace when > present. So, repeatedly scan for the next one of '{};'. try this: from __future__ impo

Re: "Help needed - I don't understand how Python manages memory"

2008-04-22 Thread Lie
On Apr 21, 1:14 am, "Hank @ITGroup" <[EMAIL PROTECTED]> wrote: > Christian Heimes wrote: > > Gabriel Genellina schrieb: > > >> Apart from what everyone has already said, consider that FreqDist may > >> import other modules, store global state, create other objects... whatever. > >> Pure python cod

Re: Python script to automate use of Google Translate? (or other translator)

2008-04-22 Thread Lie
On Apr 21, 8:58 am, Kenneth McDonald <[EMAIL PROTECTED]> wrote: > I have the need to occasionally translate a single word > programatically. Would anyone have a Python script that would let me > do this using Google (or another) translation service? > > Thanks, > Ken Are you sure you want to use G

Re: Explicit variable declaration

2008-04-23 Thread Lie
On Apr 23, 4:52 pm, "Filip Gruszczyński" <[EMAIL PROTECTED]> wrote: > > You mean the type? Not in 2.x, but in 3.x, there are function > > annotations: > > > def a_function(arg1: int, arg2: str) -> None: pass > > Nope, I don't like types ;-) 3.x seems pretty revolutionary, and this > typing can b

Re: function that accepts any amount of arguments?

2008-04-26 Thread Lie
On Apr 25, 2:12 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 24 avr, 14:28, malkarouri <[EMAIL PROTECTED]> wrote: > > > On Apr 24, 12:43 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > > > [...] > > > > Not quite sure what's the best thing to do in the second case - raise a > > > Va

Re: DO YOU KNOW ANY THING ABOUT ISLAM???

2008-04-27 Thread Lie
On Apr 24, 1:40 pm, ABDULLAH <[EMAIL PROTECTED]> wrote: > What you are about to read might sound unusual but it could be very > enlightened. So I would be thankful if you give my article 5 minute > of > your value time. THANK YOU No, it is not unusual at all, it's very normal. The only thing that

Re: removing extension

2008-04-27 Thread Lie
On Apr 27, 5:34 pm, wilson <[EMAIL PROTECTED]> wrote: > i was trying to convert all images in a folder to another type and > save the new images in a separate folder.for that i wrote a class and > coded some part > > class ConvertImgs: > def __init__(self,infldr,outfldr): >

Re: removing extension

2008-04-27 Thread Lie
On Apr 27, 6:05 pm, Lie <[EMAIL PROTECTED]> wrote: > On Apr 27, 5:34 pm, wilson <[EMAIL PROTECTED]> wrote: > > > > > i was trying to convert all images in a folder to another type and > > save the new images in a separate folder.for that i wrote a class

Re: Loading associated files

2008-04-27 Thread Lie
On Apr 24, 10:14 pm, [EMAIL PROTECTED] wrote: > I am trying to make a a simple databasing GUI interface and and have > created a module to deal with parsing the data from a file and a GUI > based program that displays this data using PyQt4, i know how to > register files in the system registry usin

Re: How do I say "Is this a function"?

2008-04-27 Thread Lie
On Apr 27, 11:01 am, John Henry <[EMAIL PROTECTED]> wrote: > On Apr 26, 6:08 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > > > > > def f1(): > > >    print "In f1" > > > > def f3(): > > >    print "In f3" > > > > def others(): > > >    print "In others" > > > > for i in xrange(1,3): > > >  

Re: Loading associated files

2008-04-27 Thread Lie
On Apr 27, 8:21 pm, [EMAIL PROTECTED] wrote: > Yep, thats pretty much exactly what i had done, those exact settings, > and it still doesnt work. As i said i looked at the other keys to > check i had done it right and a i said the settings are fine because i > can send the file to python.exe and it

Re: Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-04-27 Thread Lie
On Apr 27, 6:28 am, n00m <[EMAIL PROTECTED]> wrote: > No so simple, guys. > E.g., I can't solve (in Python) this:http://www.spoj.pl/problems/INTEST/ > Keep getting TLE (time limit exceeded). Any ideas? After all, it's > weekend. > > 450. Enormous Input Test > Problem code: INTEST > > The purpose of

Re: Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-04-29 Thread Lie
On Apr 28, 2:14 am, n00m <[EMAIL PROTECTED]> wrote: > Lie wrote: > > On Apr 27, 6:28�am, n00m <[EMAIL PROTECTED]> wrote: > > > No so simple, guys. > > > E.g., I can't solve (in Python) this:http://www.spoj.pl/problems/INTEST/ > > > Keep getting

Re: Suggestion for improved ImportError message

2008-08-15 Thread Lie
On Aug 14, 5:10 pm, Wojtek Walczak <[EMAIL PROTECTED]> wrote: > On Thu, 14 Aug 2008 01:35:44 + (UTC), Kent Tenney wrote: > >> > Then go for it  You can prepare a patch and ask on python-dev > >> > if the developers are interested. > > > hehe, I'll get a C level patch accepted right after I > >

Re: You advice please

2008-08-15 Thread Lie
On Aug 13, 6:14 pm, Hussein B <[EMAIL PROTECTED]> wrote: > Hey, > I'm a Java/Java EE developer and I'm playing with Python these days. > I like the Python language so much and I like its communities and the > Django framework. > My friends are about to open a Ruby/Rails shop and they are asking me

Re: Fixed-length text file to database script

2008-08-15 Thread Lie
On Aug 15, 7:12 am, John Machin <[EMAIL PROTECTED]> wrote: > On Aug 15, 4:55 am, [EMAIL PROTECTED] wrote: > > > #your thought is right. > > === > > def sizes2fields(sizes): > >    d = [] > >    begin = 0 > >    for i in sizes: > >       if begin:

Early halt for iterating a_list and iter(a_list)

2008-08-15 Thread Lie
When you've got a nested loop a StopIteration in the Inner Loop would break the loop for the outer loop too: a, b, c = [1, 2, 3], [1, 2, 3, 4], [1, 2, 3, 4, 5] def looper(a, b, c): for a_ in a: for b_ in b: for c_ in c: print a_, b_, c_ looper(a, b, c) #

Re: how many nested for can we utilize?

2008-08-18 Thread Lie
On Aug 17, 4:23 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Patrol Sun wrote: > > when I use 20 for ,"SystemError: too many statically nested blocks" > > When I use 100 for ,"IndentationError: too many levels of indentation" > > How to handle these errors? > > so why exactly are you trying to ne

Re: Programming Languages Decisions

2008-08-19 Thread Lie
On Aug 19, 1:45 pm, "E.D.G." <[EMAIL PROTECTED]> wrote: > "Terry Reedy" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > Rather than explain further, I suggest that you visit python.org and read > > some of the tutorial to see what *you* think. > >http://docs.python.org/tut/tut

Re: exception handling in complex Python programs

2008-08-22 Thread Lie
On Aug 21, 12:59 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 20 Aug 2008 09:23:22 -0700, [EMAIL PROTECTED] wrote: > > On Aug 19, 4:12 pm, Steven D'Aprano <[EMAIL PROTECTED] > > cybersource.com.au> wrote: > >> On Tue, 19 Aug 2008 11:07:39 -0700, [EMAIL PROTECTED] wrot

Re: exception handling in complex Python programs

2008-08-22 Thread Lie
On Aug 21, 2:34 pm, Bruno Desthuilliers wrote: > [EMAIL PROTECTED] a écrit : > > > > > On Aug 19, 4:12 pm, Steven D'Aprano <[EMAIL PROTECTED] > > cybersource.com.au> wrote: > >> On Tue, 19 Aug 2008 11:07:39 -0700, [EMAIL PROTECTED] wrote: > >>>   def do_something(filename): > >>>     if not os.acc

Re: Early halt for iterating a_list and iter(a_list)

2008-08-22 Thread Lie
On Aug 15, 9:55 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Lie wrote: > > When you've got a nested loop a StopIteration in the Inner Loop would > > break the loop for the outer loop too: > > > a, b, c = [1, 2, 3], [1, 2, 3, 4], [1, 2, 3, 4, 5] > > &

Re: Should Python raise a warning for mutable default arguments?

2008-08-23 Thread Lie
On Aug 22, 10:32 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > Christian Heimes wrote: > > Steven D'Aprano wrote: > >> I suggest that Python should raise warnings.RuntimeWarning (or similar?) > >> when a function is defined with a default argument consisting of a list, > >> dict or set. (This is not

Re: Generators can only yield ints?

2008-08-23 Thread Lie
On Aug 23, 5:44 am, defn noob <[EMAIL PROTECTED]> wrote: > def letters(): >         a = xrange(ord('a'), ord('z')+1) >         B = xrange(ord('A'), ord('Z')+1) >         while True: >                 yield chr(a) >                 yield chr(B) > > >>> l = letters() > >>> l.next() > > Traceback (mos

Re: Suggestion for improved ImportError message

2008-08-23 Thread Lie
On Aug 15, 7:42 pm, [EMAIL PROTECTED] wrote: > Lie: > > >I'm not sure there are any reason to test for failed import in doctest)< > > I have code that uses numpy if available, otherwise uses slower normal > Python code. Inside the doctests I'd like to test b

Re: why in returns values for array and keys for dictionary

2008-08-26 Thread Lie
On Aug 26, 4:04 pm, "++imanshu" <[EMAIL PROTECTED]> wrote: > On Aug 26, 11:52 am, Erik Max Francis <[EMAIL PROTECTED]> wrote: > > > ++imanshu wrote: > > >     Wouldn't it be nicer to have 'in' return values (or keys) for both > > > arrays and dictionaries. Arrays and Dictionaries looked so similar

Re: Filling in Degrees in a Circle (Astronomy)

2008-08-26 Thread Lie
On Aug 23, 6:12 am, "W. eWatson" <[EMAIL PROTECTED]> wrote: > The other night I surveyed a site for astronomical use by measuring the > altitude (0-90 degrees above the horizon) and az (azimuth, 0 degrees north > clockwise around the site to 360 degrees, almost north again) of obstacles, > trees. M

Re: Function References

2008-08-28 Thread Lie
On Aug 1, 6:35 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > On Jul 31, 10:47 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> I take the freedom to do so as I see fit - this is usenet... > > > Fine, then keep beating a dead horse by replying to this thr

Re: eval() == evil? --- How to use it safely?

2008-08-29 Thread Lie
On Aug 29, 8:14 pm, Fett <[EMAIL PROTECTED]> wrote: > On Aug 29, 7:42 am, Fett <[EMAIL PROTECTED]> wrote: > > > On Aug 28, 7:57 pm, Paul Rubin wrote: > > > So long story short: if I am expecting a dictionary of strings, I > > should make a parser that only accepts a dicti

Re: Which is faster?

2008-08-30 Thread Lie
On Aug 30, 5:30 pm, cnb <[EMAIL PROTECTED]> wrote: > how does doing something twice not change complexity? yes it maybe > belongs to the same complexity-class but is still twice as slow no? Who is doing something twice? Definitely not sum(). sum() does not create intermediate list, and if you pas

Re: How to write verbose scripts

2008-09-06 Thread Lie
On Sep 3, 6:31 pm, Uwe Schmitt <[EMAIL PROTECTED]> wrote: > On 2 Sep., 18:55, Steven D'Aprano <[EMAIL PROTECTED] > > > > cybersource.com.au> wrote: > > I find myself writing command line tools in Python where I wish to > > include "verbose" output to stdout. > > > I start with a helper function: >

Re: append on lists

2008-09-17 Thread Lie
On Sep 16, 3:20 pm, Armin <[EMAIL PROTECTED]> wrote: > John Machin wrote: > > On Sep 16, 6:45 am, Armin <[EMAIL PROTECTED]> wrote: > > >> Yes, but this is very unconvenient. > >> If d should reference the list a extended with a single list element > >> you need at least two lines > > >> a.append(7)

<    1   2   3   4   5   6   7   8   9   10   >