Re: How to get the ascii code of Chinese characters?

2006-08-20 Thread Gerhard Fiedler
On 2006-08-20 10:31:20, Fredrik Lundh wrote: >> "range is least 0..65535" : upper_bound >= 65535 >> "goes beyond 65535" : upper_bound > 65535 >> >> For some discussions (like how to represent code points etc) this >> distinction is crucial. > > do you know anything about how Unicode is used in r

Re: sum and strings

2006-08-20 Thread Gerhard Fiedler
On 2006-08-20 07:18:44, Rhamphoryncus wrote: >> shallow = [] >> [shallow.extend(i) for i in deep] > > I'm sure this has been mentioned before, but listcomps are for when you > want to store the list and use it for further things, not for when you > want a side effect. TOOWTDI. Can you please ex

Re: How to get the ascii code of Chinese characters?

2006-08-20 Thread Gerhard Fiedler
On 2006-08-20 05:56:05, Fredrik Lundh wrote: >>> No. ASCII characters range is 0..127 while Unicode characters range is >>> at least 0..65535. >> >> Actually, Unicode goes beyond 65535. > > you may want to look up "at least" in a dictionary. As a homework, try to parse "at least until" and "goe

Re: How to get the ascii code of Chinese characters?

2006-08-19 Thread Gerhard Fiedler
On 2006-08-19 16:54:36, Peter Maas wrote: > Gerhard Fiedler wrote: >> Well, ASCII can represent the Unicode numerically -- if that is what the OP >> wants. > > No. ASCII characters range is 0..127 while Unicode characters range is > at least 0..65535. Actually, Unicod

Re: How to get the ascii code of Chinese characters?

2006-08-19 Thread Gerhard Fiedler
On 2006-08-19 12:42:31, Marc 'BlackJack' Rintsch wrote: > many_years_after wrote: > >> what I want to do is just to make numbers as people input some Chinese >> character(hanzi,i mean).The same character will create the same >> number.So I think ascii code can do this very well. > > No it can't.

Re: hide python code !

2006-08-17 Thread Gerhard Fiedler
On 2006-08-17 16:27:46, danielx wrote: > A second point to consider: The chip is patentable (I think this is the > case legally, as well as in the court of public opinion), No. A chip is not patentable. In your scenario, the /idea/ behind the chip's functionality may be patentable, but for a pat

Re: hide python code !

2006-08-15 Thread Gerhard Fiedler
On 2006-08-15 12:04:18, Alex Martelli wrote: > It just isn't worth Microsoft's while to take the public-relations hit > of such a fight: much cheaper for them to re-implement your ideas than > to copy your GPL'd code. Exactly. So by publishing the ideas as GPL code, the author presents them not o

Re: hide python code !

2006-08-15 Thread Gerhard Fiedler
On 2006-08-15 05:40:31, Armin Steinhoff wrote: >> First Iranian Open Source Community : www.python.ir > > Interesting ... but you are not a member of this community. Right? You know how to read a thread, right? :) Gerhard -- http://mail.python.org/mailman/listinfo/python-list

Re: hide python code !

2006-08-14 Thread Gerhard Fiedler
On 2006-08-14 20:48:45, Damjan wrote: > I think you increase your chances of Microsoft not even being in the same > room with your software 100-fold if you release it under.. say GPL. ... and have the money to run a law suit? Patents, licenses etc are only as strong as the money that backs them,

Re: Nested function scope problem

2006-08-11 Thread Gerhard Fiedler
On 2006-08-11 07:48:33, Slawomir Nowaczyk wrote: > But let me try again, please (just one more time, if this doesn't work > either I am willing to admit I do not see a simple analogy between > Python and C variables :-) > >Python C > variable: a

Re: using python to edit a word file?

2006-08-10 Thread Gerhard Fiedler
On 2006-08-10 15:15:34, John Salerno wrote: > I figured my first step is to install the win32 extension, which I did, > but I can't seem to find any documentation for it. A couple of the links > on Mark Hammond's site don't seem to work. > > Anyway, all I need to do is search in the Word docume

Re: do people really complain about significant whitespace?

2006-08-10 Thread Gerhard Fiedler
On 2006-08-10 06:44:04, Stephen Kellett wrote: > Just found this on c.l.ruby. Seems kind of relevant. > http://www.americanscientist.org/template/AssetDetail/assetid/51982 > > The Semicolon Wars Good reading :) Thanks. Gerhard -- http://mail.python.org/mailman/listinfo/python-list

Re: do people really complain about significant whitespace?

2006-08-10 Thread Gerhard Fiedler
On 2006-08-10 07:40:01, Stephen Kellett wrote: > To answer your first question: In C++/Ruby/Pascal you'd have something > like this > > function() > { > loop1() > { > [...] > } > } > I really dislike that the end of loop2 is implicit rather than > explicit. Since in th

Re: do people really complain about significant whitespace?

2006-08-09 Thread Gerhard Fiedler
On 2006-08-09 11:10:20, Stephen Kellett wrote: > If you mean, should code be well written, thought about, well formatted, > sensible class/variable names, redesigned if you find a better way, sure > no problem with that. I mean the code should be written so that as few as possible comments are

Re: Nested function scope problem

2006-08-09 Thread Gerhard Fiedler
On 2006-08-09 07:54:22, Slawomir Nowaczyk wrote: > But I do not believe there is any "identity of a variable" > which corresponds to "id()". Still, you used such term -- repeatedly. > > I do not know what do you mean by it. In C, the "identity" of anything is usually the memory location. Same l

Re: Nested function scope problem

2006-08-09 Thread Gerhard Fiedler
On 2006-08-09 07:54:22, Slawomir Nowaczyk wrote: > It was never my goal to show that Python and C variables behave the > same way or anything. > > So it seems like we misunderstood each others intents. That seems to be the case :) I never really meant to say that I think that Python does not ha

Re: Nested function scope problem

2006-08-09 Thread Gerhard Fiedler
On 2006-08-09 07:54:21, Slawomir Nowaczyk wrote: > Nope. Equivalence table can look like this: > >Python C > variable:a variable: a > textual representation: "a" address operator: &a > id of object: id

Re: do people really complain about significant whitespace?

2006-08-08 Thread Gerhard Fiedler
On 2006-08-08 19:02:27, Stephen Kellett wrote: > In message <[EMAIL PROTECTED]>, > Gerhard Fiedler <[EMAIL PROTECTED]> writes >>conclusion for me: they must not like self-documenting code... :) > > Oh dear. So if the code is wrong it is self documenting? ??

Re: do people really complain about significant whitespace?

2006-08-08 Thread Gerhard Fiedler
On 2006-08-08 12:49:35, Aahz wrote: >>Where are they-who-hate-us-for-our-whitespace? Are "they" really that >>stupid/petty? Are "they" really out there at all? "They" almost sound >>like a mythical caste of tasteless heathens that "we" have invented. >>It just sounds like so much trivial nitpic

Re: Nested function scope problem

2006-08-06 Thread Gerhard Fiedler
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 this part of the thread) was to find the analogy between C variables and Python variables, at least that's what you said a few messages ago. >

Re: Thread Question

2006-08-06 Thread Gerhard Fiedler
On 2006-08-04 04:22:59, Ritesh Raj Sarraf wrote: > Gerhard Fiedler wrote: >> Rather than downloading and zipping in the same thread, you could run >> multiple threads like you're doing that only download files, and one >> zip-it-all-up thread. After downloading a

Re: Nested function scope problem

2006-08-05 Thread Gerhard Fiedler
On 2006-08-05 09:30:59, Antoon Pardon wrote: >> But this means that C variables are not analog to Python variables, >> [...] > > Yes they are. Nobody so far has been able to create a simple table with analog operations Python vs C that operates on C /variables/ (not dereferenced pointers) and m

Re: Nested function scope problem

2006-08-05 Thread Gerhard Fiedler
On 2006-08-05 02:02:03, Dennis Lee Bieber wrote: > I've not disagreed with you, but wanted to correct the > associations... It is others who may disagree... I know. It's just that your explicit analogy made this better visible, so I wanted to add that to it. But I guess this thing is gettin

Re: Nested function scope problem

2006-08-04 Thread Gerhard Fiedler
On 2006-08-04 15:21:52, Dennis Lee Bieber wrote: > On Fri, 4 Aug 2006 14:09:15 -0300, Gerhard Fiedler <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> Python === C >> Textual representation a === Address operator (&a) >> id(a) === Deref

Re: Nested function scope problem

2006-08-04 Thread Gerhard Fiedler
On 2006-08-04 11:41:03, Slawomir Nowaczyk wrote: > #> > I disagree. At least in my understanding, which, up to now, was > #> > perfectly enough to explain everything about how Python variables > #> > behave: > #> > > #> > The address operator in C is what textual representation (i.e. what > #> >

Re: Nested function scope problem

2006-08-04 Thread Gerhard Fiedler
On 2006-08-04 12:12:44, Antoon Pardon wrote: >> That's possible. I wouldn't expect too many C programmers to have any >> notion of "id of a variable". I, for example, never thought about such >> thing before this thread. > > But even in Python we don't speak of "id of a variable". It is not the >

Re: Windows vs. Linux

2006-08-04 Thread Gerhard Fiedler
On 2006-08-04 09:58:34, Sybren Stuvel wrote: >> They all (well, most of them) use computers in their administration; >> /that's/ the cost I was talking about, not the cost for the software >> industry :) > > Good point. Time more people started using Open Source :) Definitely. But don't hold you

Re: Nested function scope problem

2006-08-04 Thread Gerhard Fiedler
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 programmer. > > I disagree. At least in my understanding, which, up to now, was > perfectly enough to explain everything about how Py

Re: How to force a thread to stop

2006-08-04 Thread Gerhard Fiedler
On 2006-08-04 02:33:07, H J van Rooyen wrote: > The next step above the 555 is a PIC... then you can steal power from the > RS-232 line - and its a small step from "PIC" to "PIG"... I see... you obviously know what to do, if you want to :) But I'm not sure such a device alone is of much help in

Re: Windows vs. Linux

2006-08-04 Thread Gerhard Fiedler
On 2006-08-04 05:30:00, Sybren Stuvel wrote: >> Besides, you probably don't know whether it's not one of your direct >> suppliers who's affected. You're sure you don't buy from anybody >> running a Windows system? I'd bet against that, and I only bet when >> I know I win :) > > Good point. I don'

Re: Windows vs. Linux

2006-08-04 Thread Gerhard Fiedler
On 2006-08-03 04:53:11, Sybren Stuvel wrote: >> Pretty much every production cost increase gets in the end paid by >> the consumer. With some localized changes, you may be lucky and >> don't buy any products that are affected, but with such a widespread >> change as this would be, it is more like

Re: Nested function scope problem

2006-08-03 Thread Gerhard Fiedler
On 2006-08-03 10:57:22, Slawomir Nowaczyk wrote: > #> In any case, the following doesn't seem to be implementation detail > #> (and rather a part of the language), but it's not really > #> understandable with a C++ concept of "variable": > #> > #> >>> a=3 > #> >>> id(a) > #> 3368152 > #> >>> b=a

Re: OS independent files

2006-08-03 Thread Gerhard Fiedler
On 2006-08-03 16:21:13, crystalattice wrote: > I'm sure this has been addressed before but it's difficult to search > through several thousand postings for exactly what I need, so I > apologize if this a redundant question. > > I've figured out how to use os.path.join to make a file or directory

Re: How to force a thread to stop

2006-08-03 Thread Gerhard Fiedler
On 2006-08-03 06:07:31, H J van Rooyen wrote: > Thanks - will check it out - seems a lot of money for 555 functionality > though > > Especially if like I, you have to pay for it with Rand - I have started > to call the local currency Runt... Depending on what you're up to, you can make suc

Re: Thread Question

2006-08-03 Thread Gerhard Fiedler
On 2006-08-03 08:49:45, Ritesh Raj Sarraf wrote: > I implemented it but am seeing some issues. > If I use a single thread, all files are zipped to the archive. > Obviously this has to work. > > If threads are 2 or 3 or 4 in numbers, some of the files don't show up > in the archive. > > What woul

Re: opposite of import

2006-08-03 Thread Gerhard Fiedler
On 2006-08-03 09:26:54, Simon Brunning wrote: >> import amodule >> amodule.afunction() # Works fine >> >> del amodule >> amodule.afunction() # Will die now > > Note that this doesn't get rid of a module entirely. Python will still > holds on to the module, and if you just import it again at this

Re: Using Python for my web site

2006-08-02 Thread Gerhard Fiedler
On 2006-08-02 22:17:38, Cliff Wells wrote: > On the other hand, had I appended "So I'd like some other opinions > because I don't know." to the end, it would probably cut the irritation > down considerably (or at least be in a much more defensible position if > it didn't). Thanks, that's one of t

Re: Windows vs. Linux

2006-08-02 Thread Gerhard Fiedler
On 2006-08-02 21:09:43, Sybren Stuvel wrote: > Microsoft could provide an emulated environment for backward > compatability, just like Apple did. Wouldn't know what that would cost, > though. Possibly. Rather than waiting for that, I think that languages that want a degree of portability should s

Re: Windows vs. Linux

2006-08-02 Thread Gerhard Fiedler
On 2006-08-02 17:36:06, Sybren Stuvel wrote: > IMO it's too bad that "they" chose \r\n as the standard. Having two > bytes as the end of line marker makes sense on typewriters and > similarly operating printing equipment. I may well be mistaken, but I think at the time they set that standard, s

Re: Windows vs. Linux

2006-08-02 Thread Gerhard Fiedler
On 2006-08-02 17:38:54, Sybren Stuvel wrote: > Gerhard Fiedler enlightened us with: >>> Microsoft did *NOT* write DOS >> >> Well, they didn't write most of DOS 1.0. But it seems they did write >> (or at least specify) most if not all of the rest up to D

Re: Windows vs. Linux

2006-08-02 Thread Gerhard Fiedler
On 2006-08-02 12:41:44, Alex Martelli wrote: > Microsoft did *NOT* write DOS Well, they didn't write most of DOS 1.0. But it seems they did write (or at least specify) most if not all of the rest up to DOS 6.22 or so. Which is possibly considerable. > Part of the CP/M compatibility did include

Re: Windows vs. Linux

2006-08-02 Thread Gerhard Fiedler
On 2006-08-02 13:24:10, Dennis Lee Bieber wrote: > Change Directory may work... but > > C:\Documents and Settings\Dennis Lee Bieber>cd c:\ > > C:\>cd /windows/system32 > > C:\WINDOWS\SYSTEM32>cd c:\ > > C:\>dir /windows/system32 > Parameter format not correct - "windows". Since '/' is u

Re: Windows vs. Linux

2006-08-02 Thread Gerhard Fiedler
On 2006-08-02 11:29:18, Sybren Stuvel wrote: > John Salerno enlightened us with: >> But of course I still agree with you that in either case it's not a >> judgment you can fairly make 30 years after the fact. > > I don't see Microsoft changing it the next 30 years either... Apple > moved from \r

Re: Windows vs. Linux

2006-08-02 Thread Gerhard Fiedler
On 2006-08-02 04:42:31, Sybren Stuvel wrote: > I never said "I would have known it better". I just said that IMO it > was a bad design choice ;-) Well, and I question your qualification to judge that. In order to say that, you would have to know the reasoning, would have to put it in the histor

Re: Using Python for my web site

2006-08-01 Thread Gerhard Fiedler
On 2006-08-01 21:04:07, Conrad wrote: >> A few years ago I did some research, and the result was that while >> PostgreSQL was claimed to have more features and a better design, the >> reports of database corruption seemed to have been more frequent than with >> MySQL. > I can't claim to have don

Re: Windows vs. Linux

2006-08-01 Thread Gerhard Fiedler
On 2006-08-01 16:29:54, Sybren Stuvel wrote: >> - Mac OS: ':' > > It's a slash too, at least on non-obsolete Mac OS versions. I wrote "Mac OS". That's not "Mac OSX". Ask Apple... :) And Mac OSX is quite arguably a Unix-type system. >> Maybe someone else can fill in some of the missing OSes. It

Re: Windows vs. Linux

2006-08-01 Thread Gerhard Fiedler
On 2006-08-01 12:31:01, Sybren Stuvel wrote: > Ehm... replace that with "the latter with bonk on every OS except > Microsoft Windows". Windows is the weird one in OS-land, because they > are the only one that use the most widely used escape-character (the > backslash) as path separator. Is that r

Re: code to retrieve web mail?

2006-08-01 Thread Gerhard Fiedler
On 2006-08-01 13:41:47, Terry Reedy wrote: >> Instead of mimicking a browser to access this e-mail account through the >> web interface, see if there is a POP3 access to your free e-mail (I'd >> be surprised if there isn't). > > To the contrary: Yahoo, for instance, charges for POP3 access; for '

Re: Nested function scope problem

2006-08-01 Thread Gerhard Fiedler
On 2006-07-31 23:52:07, danielx wrote: >> You don't expect the "identity" of the variable b to change with a >> simple assignment from a C/C++ point of view. You also don't expect the >> "identity" of a and b to be the same after assigning one to the other. >> You can create C++ classes that behav

Re: Using Python for my web site

2006-08-01 Thread Gerhard Fiedler
On 2006-08-01 04:11:18, Cliff Wells wrote: > You say that you haven't tried Django or any other Python framework. > Perhaps you should. You seem to have at least the start of the right > idea about web application organization, so I think you'd be pleasantly > surprised with what you'll find alre

Re: Using Python for my web site

2006-07-31 Thread Gerhard Fiedler
On 2006-07-31 18:23:17, Cliff Wells wrote: > My point is to stop FUD right at that comment. I don't doubt your > research from "a few years ago", but ancient research is entirely > irrelevant for making a decision *today*. That's exactly the reason why I added this information. It might not be f

Re: Using Python for my web site

2006-07-31 Thread Gerhard Fiedler
On 2006-07-31 17:28:00, Cliff Wells wrote: >> I assume you don't agree... :) > > I certainly don't. [...] > Also, saying "a few years ago I did some research" in software terms is > pretty much equivalent to saying "I don't know". Exactly. So what's your point with this comment? I stated what

Re: Using Python for my web site

2006-07-31 Thread Gerhard Fiedler
On 2006-07-31 15:00:15, Bruno Desthuilliers wrote: > In fact, the real question IMHO is: what would MySQL advantage over > PostgreSQL be ?-) A few years ago I did some research, and the result was that while PostgreSQL was claimed to have more features and a better design, the reports of databas

Re: Need a compelling argument to use Django instead of Rails

2006-07-31 Thread Gerhard Fiedler
On 2006-07-31 14:37:26, Bruno Desthuilliers wrote: >> So, if mod_python provides the same functionality, it's not the main >> reason why Python developers use application servers while PHP users >> still program with page codes in /htdocs. >> >> Why do PHP users stick to that old way of things? B

Re: Need a compelling argument to use Django instead of Rails

2006-07-31 Thread Gerhard Fiedler
On 2006-07-29 01:07:12, Tim Roberts wrote: > Vincent Delporte <[EMAIL PROTECTED]> wrote: >> >>BTW, what is the advantage of running a CherryPy/Django server instead >>of the regular way of code in pages? Improved performance because the >>Python interpreter is already up and running? > > Exactly.

Re: Nested function scope problem

2006-07-30 Thread Gerhard Fiedler
On 2006-07-30 12:45:50, Antoon Pardon wrote: >> [...] we'd have to use a common definition of "variable". This is a term >> so widely used that I'm not sure there is a useful single definition of >> it; do you know one? > > A name in a scope to which is attached some value/object. Now whether > t

Re: Nested function scope problem

2006-07-30 Thread Gerhard Fiedler
On 2006-07-30 09:54:14, Antoon Pardon wrote: > Aren't you looking too much at implementation details now? Possibly, but at this point I'm still trying to understand how Python does these things, and what the useful abstraction level is for me. I also still have very little experience how I'll put

Re: Nested function scope problem

2006-07-29 Thread Gerhard Fiedler
On 2006-07-29 13:47:37, Antoon Pardon wrote: > I think the important thing to remember is that the assignment in Python > is a alias maker and not a copy maker. In languages like C, Fortran, > pascal, the assignment makes a copy from what is on the righthand and > stores that in the variable on th

Re: Nested function scope problem

2006-07-28 Thread Gerhard Fiedler
On 2006-07-28 14:32:59, Dennis Lee Bieber wrote: > On Fri, 28 Jul 2006 11:41:30 -0300, Gerhard Fiedler <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> wondered (this is slightly related) is whether it wouldn't be really good >> to make th

Re: Nested function scope problem

2006-07-28 Thread Gerhard Fiedler
On 2006-07-28 15:20:52, Antoon Pardon wrote: >> Typically, "variable" implies a data storage location that can take on >> different values. Emphasis on "location" -- the name is fixed to a >> memory location whose contents can be varied. > > That is not true. It may be the case in a number of lan

Re: Nested function scope problem

2006-07-28 Thread Gerhard Fiedler
On 2006-07-28 04:07:20, Bruno Desthuilliers wrote: > Gerhard Fiedler a écrit : >> Isn't being on the LHS (of an assignment) the only way to (re)bind a >> variable? > > > s/variable/name/ > Ok, I missed this one :) >> Are there situations whe

Re: Nested function scope problem

2006-07-27 Thread Gerhard Fiedler
On 2006-07-27 17:10:55, Bruno Desthuilliers wrote: >> Isn't being on the LHS the only way to write to a non-mutable object? > > You *don't* "write to a non-mutable object". You rebind the name to > another object (mutable or not, that's not the problem). Ok, sloppy writing (sloppy thinking, or

Re: Nested function scope problem

2006-07-27 Thread Gerhard Fiedler
On 2006-07-27 14:15:34, Dennis Lee Bieber wrote: >> In a language like C the name doesn't hold anything either. The name is >> just a way for refering to a memory space which will hold something. >> > Except for one difference... In C (and most other languages) that > memory space is FIXED

Re: Nested function scope problem

2006-07-27 Thread Gerhard Fiedler
On 2006-07-27 13:44:29, Bruno Desthuilliers wrote: > What bother me with the "hold" term is that I understand it as meaning > that the name is some kind of container by itself - which it is not. > Consider the following: > > d = dict() > d['name'] = 'parrot' > > Would you say that the string "na

Re: Nested function scope problem

2006-07-27 Thread Gerhard Fiedler
On 2006-07-27 09:42:16, Bruno Desthuilliers wrote: >> Are you saying Python variables don't hold references to "actual" Python >> objects? > > Exactly. > >> That idea has been working well for me so far. > > It can only take you so far. Now it's time you know the truth: there are > *no* 'varia

Re: Threads vs Processes

2006-07-27 Thread Gerhard Fiedler
On 2006-07-26 19:10:14, Carl J. Van Arsdall wrote: > Ah, alright. So if that's the case, why would you use python threads > versus spawning processes? If they both point to the same address space > and python threads can't run concurrently due to the GIL what are they > good for? Nothing run

Re: How to force a thread to stop

2006-07-26 Thread Gerhard Fiedler
On 2006-07-26 21:38:06, Carl J. Van Arsdall wrote: >>> Also, threading's condition and event constructs are used a lot >>> (i talk about it somewhere in that thing I wrote). They are easy to use >>> and nice and ready for me, with a server wouldn't I have to have things >>> poll/wait for messa

Re: How to force a thread to stop

2006-07-26 Thread Gerhard Fiedler
On 2006-07-26 19:08:44, Carl J. Van Arsdall wrote: > Also, threading's condition and event constructs are used a lot > (i talk about it somewhere in that thing I wrote). They are easy to use > and nice and ready for me, with a server wouldn't I have to have things > poll/wait for messages? Ho

Re: Threads vs Processes

2006-07-26 Thread Gerhard Fiedler
On 2006-07-26 21:02:59, John Henry wrote: > Granted. Threaded program forces you to think and design your > application much more carefully (to avoid race conditions, dead-locks, > ...) but there is nothing inherently *non-robust* about threaded > applications. You just need to make sure that ev

Re: How to force a thread to stop

2006-07-26 Thread Gerhard Fiedler
On 2006-07-26 17:33:19, Carl J. Van Arsdall wrote: > Alright, if you read all that, thanks, and thanks for your input. Whether > or not I've agreed with anything, me and a few colleagues definitely > discuss each idea as its passed to us. For that, thanks to the python > list! I think you should

Re: How to find difference in years between two dates?

2006-07-26 Thread Gerhard Fiedler
On 2006-07-26 17:50:43, thebjorn wrote: > I don't agree that the irregular sized months cause a problem in this > case. They do cause a problem if you're asking "when is today + one > month?", i.e. there isn't an unambiguous answer to that question in > general (e.g. if today was January 31). We'r

Re: Coding style

2006-07-25 Thread Gerhard Fiedler
On 2006-07-25 17:59:22, Antoon Pardon wrote: >> My view is: I ask for help on a public forum. I get what I get... and if >> I consider that someone who responded with something that's not >> immediately helpful has a potential to help me better, I try to get in >> a dialog and address what has bee

Re: Nested function scope problem

2006-07-25 Thread Gerhard Fiedler
On 2006-07-25 13:33:40, Dennis Lee Bieber wrote: >> Surprising for me are actually two things: 1- the fact itself, and 2- that >> term "binding", and that whatever it means (I'll have to read more on that, >> now that I know the term) is different for read-only and read/write access. >> > Binding

Re: How to force a thread to stop

2006-07-25 Thread Gerhard Fiedler
On 2006-07-25 13:55:39, Carl J. Van Arsdall wrote: > I'd be all for using processes but setting up communication between > processes would be difficult wouldn't it? I mean, threads have shared > memory so making sure all threads know the current system state is an > easy thing. I'm not sure ab

Re: How to force a thread to stop

2006-07-25 Thread Gerhard Fiedler
On 2006-07-25 13:30:22, Carl J. Van Arsdall wrote: >> Running os.system() in multiple threads strikes me as kind of whacked. >> Won't they all compete to read and write stdin/stdout simultaneously? >> > Unfortunately this is due to the nature of the problem I am tasked with > solving. I have a

Re: function v. method

2006-07-25 Thread Gerhard Fiedler
On 2006-07-25 05:16:04, Wesley Brooks wrote: >> prefix your names with _ or __. Both are ommited from autogenerated >> docuementation and both are OFFICALLY not supposed to be used. >> > > Could you elaborate on that a little or point me in the right direction to > read up on it? I'm currently re

Re: Nested function scope problem

2006-07-25 Thread Gerhard Fiedler
On 2006-07-25 04:06:24, Steve Holden wrote: > Dennis Lee Bieber wrote: >> On Mon, 24 Jul 2006 17:35:50 -0300, Gerhard Fiedler <[EMAIL PROTECTED]> >> declaimed the following in comp.lang.python: >> >>> It is surprising in the sense that binding seems not

Re: Nested function scope problem

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 17:09:24, Steve Holden wrote: > Would I do? It seems so :) > If there's a binding to a name *anywhere* in the function's body then > that name is treated as local to the function. > > This is a matter of static analysis, and is irrespective of where in the > body the assignment

Re: Nested function scope problem

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 16:51:56, danielx wrote: > Gerhard's reply sounded not so confident. Yes, it is not. It's just the conclusion I drew from my experiments. (I'm still all wet behind the ears WRT Python...) As long as there was no write access to the variable, the inner function could read the value

Re: Functions, Operators, and Overloading?

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 15:05:53, Stefan Behnel wrote: Maybe I am missing something, but from what I've seen, it is not possible to overload functions in Python. That is I can't have a def func1 (int1, string1): and a def func1 (int1, int3, string1, string2):

Re: pyserial to read from DS1615 temperature recorder chip

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 14:03:30, [EMAIL PROTECTED] wrote: > To read from the chip, one must issue the "read page" command (33h), > followed by the two-byte address of the requested page (pages are 32 > bytes long). After receiving this, the DS1615 will send the data in a > burst of (up to) 32 bytes. I'm

Re: Functions, Operators, and Overloading?

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 14:30:31, Brian Beck wrote: > Michael Yanowitz wrote: >>Maybe I am missing something, but from what I've seen, >> it is not possible to overload functions in Python. That >> is I can't have a >> def func1 (int1, string1): >>and a >> def func1 (int1, int3, string1, string2

Re: function v. method

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 14:41:02, Gerhard Fiedler wrote: > (I actually think that possibly the current way of embedding javadoc-like > documentation into sources is only a stepping stone into the direction > generally pointed to by what Wirth called "literate programming". That was Kn

Re: function v. method

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 13:25:14, fuzzylollipop wrote: >> So... the final authority /is/ the code. I don't see an alternative. For >> me, good abstraction doesn't mean I don't have to read the sources; good >> abstraction means (among other things) that I can read the sources easily. > having auto generate

Re: Which Pyton Book For Newbies?

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 13:39:20, John Salerno wrote: > But I think the usual caveat for GUI programming is, is it necessary? > Would it work just as well to make a website interface to do your work, > rather than spend the time learning a GUI toolkit and creating a GUI > app? While I don't doubt that ther

Re: How to generate geometric random numbers?

2006-07-23 Thread Gerhard Fiedler
On 2006-07-23 17:12:20, [EMAIL PROTECTED] wrote: > I am a newbie to Python and would like to genereate some numbers > according to geometric distribution. However, the Python Random package > seems do not have implemented functionality. I am wondering is there > exist any other libraries that can

Re: Nested function scope problem

2006-07-23 Thread Gerhard Fiedler
On 2006-07-23 14:53:33, danielx wrote: > I can't figure out why Josiah's breakLine function won't work either. I > know Josiah has had his problem resolved, but I'd still like to know > why his func won't work. I'd like to redirect this discussion in that > direction, if I may. I think what happe

Re: Coding style

2006-07-23 Thread Gerhard Fiedler
On 2006-07-23 06:24:09, Antoon Pardon wrote: >> In general, I'd say that in this case the example was not well-chosen. >> After such a "shudder removal", a poster should IMO review what caused >> the shudder, and rephrase the original problem without the shudder. > > The shudder is not with the p

Re: function v. method

2006-07-23 Thread Gerhard Fiedler
On 2006-07-22 16:32:38, danielx wrote: ...and source code... >>> >>> *shudders* What happened to all the goodness of abstraction? >> >> Abstraction as you seem to use it requires complete docs of the interface. >> Which is what you said you don't have... So the original abstractor broke >> th

Re: Nested function scope problem

2006-07-21 Thread Gerhard Fiedler
On 2006-07-21 21:05:22, Josiah Manson wrote: > I found that I was repeating the same couple of lines over and over in > a function and decided to split those lines into a nested function > after copying one too many minor changes all over. The only problem is > that my little helper function doesn

Re: How to automate user input at the command prompt?

2006-07-21 Thread Gerhard Fiedler
On 2006-07-21 19:39:52, [EMAIL PROTECTED] wrote: > Cameron Laird wrote: >> I suspect there are easier approaches--but probably won't have time >> before Monday to explain. For now, I counsel the original poster >> not to be discouraged. > > Although I have not find the solution I need yet, thank

Re: function v. method

2006-07-21 Thread Gerhard Fiedler
On 2006-07-20 18:10:21, danielx wrote: >>> When supporting documents aren't sufficient to learn an api (I'm sure >>> this never happens, so just humor me), you can always turn to >>> interactive Python. >> >> ...and source code... > > *shudders* What happened to all the goodness of abstraction?

Re: Coding style

2006-07-21 Thread Gerhard Fiedler
On 2006-07-21 09:00:43, Antoon Pardon wrote: > So we have code with certain shudder characteristics. And instead > of trying to help the OP with his problem, some people react > to the shudder and come with all sort of comments that might be > true if the code as shown was production code, but whi

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Gerhard Fiedler
On 2006-07-20 09:40:31, Bruno Desthuilliers wrote: >> I'm not sure, but there's one thing that has a potential to be the real >> issue: what's the common way to create a property that is read-write >> for the implementation and "read-only" for the interface? > > class Foo(object): > @apply >

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Gerhard Fiedler
On 2006-07-20 04:15:33, Steve Holden wrote: > mystilleef wrote: > [...] >> >> I don't know it's your code not mine. >> >> class Robust(object): >> >> def __init__(self): >> # Arbitrarily changing this state to False will crash app or >> will >> # corrupt the whol

Re: Accessors in Python (getters and setters)

2006-07-19 Thread Gerhard Fiedler
On 2006-07-19 14:12:33, Tobias Brox wrote: > "Code generation" springs into my mind. IMO, if the code needs to be > generated, the language is not sufficiently advanced. Isn't that just a question of level? I'm sure there are editors that generate Python class stubs, GUI builders that generate P

Re: Accessors in Python (getters and setters)

2006-07-16 Thread Gerhard Fiedler
On 2006-07-15 19:46:16, Ben C wrote: > There isn't any practical difference, as you say, if all the setter does > is set. But it might easily do a few other subtle things, in particular > wait for a good moment to actually effect the change. I agree. But even then, for me there's no practical dif

Re: Letting a Python application phone home

2006-07-15 Thread Gerhard Fiedler
On 2006-07-15 12:45:16, Nils Oliver Kröger wrote: > This is surely possible. You need to define a protocol for the communication > between client and server. As you are planning to send data over the internet > you should build it on top of tcp. Look at the python module "socket" resp. > "Socke

Re: How to lock files (the easiest/best way)?

2006-07-15 Thread Gerhard Fiedler
On 2006-07-15 18:52:10, Sybren Stuvel wrote: > Elmo Mäntynen enlightened us with: >> Only locally. I want to be able to read/write to a single file from >> multiple possibly parallel processes. Would 'touch lock' (or >> something like that) work reliably (this just occured to me)? > > I use a loc

Re: Accessors in Python (getters and setters)

2006-07-15 Thread Gerhard Fiedler
On 2006-07-15 12:04:20, mystilleef wrote: > State - behavior is not something I made up, so it isn't subjective. It > is a common term used in OO literature. In fact, the only reason I used > it is because I thought is was common knowledge. Of course. But your association of state with attribute

  1   2   >