Re: How to test if an object IS another object?

2005-06-12 Thread Roose
This isn't a good example to test with, since 3 is an immutable object, as is 300 and all ints. It's more meaningful if the objects are mutable. Why do you want to test identity in the first place? Roose <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Sorr

Re: What language to manipulate text files

2005-06-12 Thread Roose
Why do people keep asking what language to use for certain things in the Python newsgroup? Obviously the answer is going to biased. Not that it's a bad thing because I love Python, but it doesn't make sense if you honestly want an objective opinion. R ross wrote: > I want to do some tricky te

Re: random module question

2005-06-06 Thread Roose
Raymond Hettinger wrote: > The answer is a qualified Yes. While the core generator (currently Thanks! That is the answer I'm looking for. And to Paul Rubin, it is a good point that Jython might not support it, but at this point it doesn't interest me. The program is only for myself anyway.

Re: Destructive Windows Script

2005-06-05 Thread Roose
My guess would be: extremely, extremely easy. Since you're only writing 30 bytes for each file, the vast majority of the data will still be present on disk, just temporarily inaccessible because of the del command. And more than likely it will be possible to recover 100% if they are using a j

random module question

2005-06-05 Thread Roose
Can I rely on the random.py module to produce the same series of numbers for future/past versions of Python, given the same seed? Can I rely on it across different architectures and operating systems? I looked at the docs and couldn't find this stated anywhere. My feeling is yes, but it's a f

Re: Getting the word to conventional programmers

2005-03-22 Thread Roose
> Except from a the standard, powerful, > looks-good-everywhere-and-has-a-tree-widget GUI toolkit? :) > > Seriously, I think this is *very* important. Yes, and a modern toolset/IDE. Generators and decorators and all that are nice, but their usefulness pales in comparison to having a decent IDE or

Re: Pre-PEP: Dictionary accumulator methods

2005-03-21 Thread Roose
something like the Dict with Default approach which encompasses all possibilities. Roose > I am more than sure you are right about this. But, please keep in mind > that you and we all have come very, very accustomed to using lists for > everything and the kitchen sink in Python. > > Li

Re: Pre-PEP: Dictionary accumulator methods

2005-03-20 Thread Roose
> Another option with no storage overhead which goes part way to reducing > the awkwardness would be to provide a decorator class accessible through > dict. The decorator class would take a value or function to be used as > the default, but apart from __getitem__ would simply forward all other > me

Re: Pre-PEP: Dictionary accumulator methods

2005-03-20 Thread Roose
> How about the alternative approach of allowing the user to override the > action to be taken when accessing a non-existent key? > >d.defaultValue(0) I like this a lot. It makes it more clear from the code what is going on, rather than having to figure out what the name appendlist, count, ta

Re: any() and all() Was: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread Roose
Ah OK, I stand corrected. Whoops. I just read the web page and thought the wrong thing, that makes sense. > Think about it. A key= function is quite a different thing. It provides a > *temporary* comparison key while retaining the original value. IOW, your > re-write is incorrect: > > >>> L =

Re: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread Roose
want a PEP for this... such a trivial thing can produce a lot of opinions. : ) Roose -- http://mail.python.org/mailman/listinfo/python-list

Re: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread Roose
> Py2.5 is already going to include any() and all() as builtins. The signature > does not include a function, identity or otherwise. Instead, the caller can > write a listcomp or genexp that evaluates to True or False: > > any(x >= 42 for x in data) > > If you wanted an identify function, tha

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Roose
> +1 for inc instead of count. > appendlist seems a bit too specific (I do not use dictionaries of lists > that often). No way, I use that all the time. I use that more than count, I would say. Roose -- http://mail.python.org/mailman/listinfo/python-list

Re: Pre-PEP: Dictionary accumulator methods

2005-03-18 Thread Roose
I like this, it is short, low impact, and makes things more readable. I tend to go with just the literal way of doing it instead of using get and setdefault, which I find awkward. But alas I had a my short, low impact, useful suggestion and I think it died. It was for any() and all() for lists.

Re: builtin functions for and and or?

2005-02-13 Thread Roose
> Previous discussion on this topic: > http://groups-beta.google.com/group/comp.lang.python/msg/a76b4c2caf6c435c > > Michael > OK, well then. That's really the exact same thing, down to the names of the functions. So what ever happened to that? That was over a year ago! I don't see any mention

Re: builtin functions for and and or?

2005-02-13 Thread Roose
As usual tests are required to measure the faster one. > I agree with Roose, there are are some "primitive" operations (like > this, and flatten, partition, mass removal of keys from a dictionary, > and few others) that can be added to the language (but I'm still not > capa

Re: builtin functions for and and or?

2005-02-13 Thread Roose
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > So usually I just write a little function any( L, boolean_function = > > identity ) or all( ... ). But I am kind of sick of doing that all the > > time -- does it exist anywhere in the Python libraries? It seems r

builtin functions for and and or?

2005-02-13 Thread Roose
I need this a lot: a one line way to do a n-ary and or 'or'. e.g., result = True for x in L: if not boolean_function(x): result = False or >>> reduce(operator.__and__, [boolean_function(x) for x in L) So usually I just write a little function any( L, boolean_function = identity ) or all(

Re: Python Operating System???

2005-01-11 Thread Roose
> Huh? I'm just baffled why you think writing a scheduler in an OS is > harder than writing one in an application. You have some means of > doing a coroutine switch in one situation, and some means of doing a > hardware context switch in the other. Aside from that the methods are > about the sa

Re: Python Operating System???

2005-01-10 Thread Roose
"Paul Rubin" <http://[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Roose" <[EMAIL PROTECTED]> writes: > > Are you actually going to answer any of my questions? Let's see > > this "JavaScript task scheduler" you have

Re: Python Operating System???

2005-01-09 Thread Roose
"Paul Rubin" <http://[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Roose" <[EMAIL PROTECTED]> writes: > > > I've written file systems in Python, and task schedulers in > > > Javascript, and they were fine for their pur

Re: Python Operating System???

2005-01-09 Thread Roose
> I've written file systems in Python, and task schedulers in > Javascript, and they were fine for their purposes Uh, not to be rude, but what are you talking about? If I'm not mistaken Javascript is that scripting language that runs inside a browser, an application. How are you going to save an

Re: Python Operating System???

2005-01-08 Thread Roose
"Paul Rubin" <http://[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Roose" <[EMAIL PROTECTED]> writes: > > My point was that you can't do a lot of hardware interface programming in > > pure Python -- there would be so much non-tr

Re: Python Operating System???

2005-01-08 Thread Roose
OS? or it part of the OS? Either way you've got tons of non-trivial code in C/C++/assembly. "Paul Rubin" <http://[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Roose" <[EMAIL PROTECTED]> writes: > > > Is an OS written in Lisp also

Re: Python Operating System???

2005-01-08 Thread Roose
Well can you describe what kind of things you want to do exactly? My guess is you are not out to develop a new algorithm for virtual memory or task scheduling. There are many parts to an OS shell. An example is the command line, i.e. bash and the like in Unix, and cmd.exe in Windows. In Windows

Re: Python Operating System???

2005-01-08 Thread Roose
> Is an OS written in Lisp also ludicrous? Because it's been done. Can you point me to this? I'd like to see how "truly" Lisp it is. My first guess would be -- not very. And I'd like to install it on my PC. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Operating System???

2005-01-08 Thread Roose
> But I thought Python was an all-purpose language. After all, OS's > have been written in Lisp before too. It is a general purpose APPLICATION language. I am surprised that this hasn't been mentioned on this thread. An OS is NOT an application. It is a completely different kind of program. D

Re: Python Operating System???

2005-01-08 Thread Roose
"Michael Hobbs" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > David Brown <[EMAIL PROTECTED]> wrote: > > Hello. I recently came across a free operating system called Unununium (or > > something like that) and it was developed in Python and Assembly. > > > > Now, I have been looking

Re: Python Operating System???

2005-01-06 Thread Roose
What exactly do you mean by an operating system? If you don't want to program in C/C++ then you're going to have a hard time. I don't want to be too discouraging, but with that attitude I doubt you would get very far. It sounds like you want to make more of an OS shell -- no? You can implement a

Re: simple GUI question

2004-12-07 Thread Roose
> You want somthing like: > > root = Tkinter.Tk() > root.withdraw() > msg = tkMessageBox.showwarning("Ooops", "Some warning") Awesome thanks! Any chance you know about the font thing : ) Nah I'll stop being lazy and hack it... but for some reason Tkinter doesn't jive with the way I think at all.

simple GUI question

2004-12-07 Thread Roose
Thanks for any help. Roose -- http://mail.python.org/mailman/listinfo/python-list