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
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
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.
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
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
> 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
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
> 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
> 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
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 =
want a PEP for this... such a trivial
thing can produce a lot of opinions. : )
Roose
--
http://mail.python.org/mailman/listinfo/python-list
> 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
> +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
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.
> 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
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
"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
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(
> 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
"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
"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
> 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
"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
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
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
> 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
> 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
"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
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
> 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.
Thanks for any help.
Roose
--
http://mail.python.org/mailman/listinfo/python-list
31 matches
Mail list logo