> Note, however, that there are more pythonic ways to perform this task.
> You might try:
>
> for index in range(len(fruit)):
>letter = fruit[-index-1]
>print letter
Or, if you're *really* just trying to reverse the string, then the
following might read more easily (although it's probably
> I was wondering how i could parse the contents of a file into an array.
> the file would look something like this:
>
> gif:image/gif
> html:text/html
> jpg:image/jpeg
Try something like this:
d = {}
for line in open("input.txt").readlines():
ext, mime = line.strip().split(":")
d[ext] = mim
Hi,
For strings of > 1 character, what are the chances
that hash(st) and hash(st[::-1]) would return the
same value?
My goal is to uniquely identify multicharacter strings,
all of which begin with "/" and never end with "/".
Therefore, st != st[::-1].
Thanks,
John
--
http://mail.python.org/mail
Scott David Daniels wrote:
> John Marshall wrote:
>
>>For strings of > 1 character, what are the chances
>>that hash(st) and hash(st[::-1]) would return the
>>same value?
>
>
> Why not grab a dictionary and do the stats yourself?
I was actually interested
Tim Peters wrote:
> [John Marshall]
> Second, what are your assumptions about (a) the universe of strings;
> and, (b) the hash function?
My assumptions are:
(a) valid and "reasonable" pathnames (e.g., 1024
characters long)
(b) just the builtin hash().
The goal is to b
Hi,
Does anyone see a problem with doing:
data = file("tata").read()
Each time this is done, I see a new file
descriptor allocated (Linux) but not
released.
1) Will there ever be a point where I
will have a problem with file
descriptors because the garbage
collector has _not_ yet co
On Thu, 2004-12-09 at 08:41 -0500, Peter Hansen wrote:
> John Marshall wrote:
> > Hi,
> >
> > Does anyone see a problem with doing:
> > data = file("tata").read()
> >
> > Each time this is done, I see a new file
> > descriptor allocat
On Thu, 2004-12-09 at 10:33 -0500, Peter Hansen wrote:
> John Marshall wrote:
> > It seems to me that a file.__del__() _should_
> > call a file.close() to make sure that the file
> > is closed as a clean up procedure before
> > releasing the object.
>
> I
Jeremy Bowers <[EMAIL PROTECTED]> writes:
> On Thu, 31 Mar 2005 23:30:42 -0800, Erik Max Francis wrote:
>
>> Daniel Silva wrote:
>>
>>> Shriram Krishnamurthi has just announced the following elsewhere; it might
>>> be of interest to c.l.s, c.l.f, and c.l.p:
>>> http://list.cs.brown.edu/pipermail/
On Thursday, April 25, 2013 6:46:01 AM UTC-4, ஆமாச்சு wrote:
> Hi,
>
>
>
> Are there equivalent in any Python libraries that could match function
>
> like PMT in libreoffice?
>
>
>
> Refer: https://help.libreoffice.org/Calc/Financial_Functions_Part_Two#PMT
>
>
>
> --
>
>
>
> Amachu
Th
On Saturday, May 4, 2013 11:37:17 PM UTC-4, Michael Marshall wrote:
> On Thursday, April 25, 2013 6:46:01 AM UTC-4, ஆமாச்சு wrote:
> If the number of periods have a fractional part such as 10.5 years of 119.25
> months then besides the initial periodic payment, there may be 4 differen
On Saturday, May 4, 2013 11:37:17 PM UTC-4, Michael Marshall wrote:
> 4) Partial period payment
>
> But then if the NPER has a fraction, you may still opt to pay or collect the
> payment at the actual time period but the amount you pay is the fraction of
> time period time
Marshall wrote:
>
> Again, I disagree: it is posible to have mutability without
> pointers/identity/objects.
I think you are wrong, but before I make a complete ass out of myself,
I have to ask what you mean by `mutability'. (And
pointers/identity/objects, for that matter.
Marshall wrote:
>
> Consider the following Java fragment:
>
> void foo() {
> int i = 0;
> int j = 0;
>
> // put any code here you want
>
> j = 1;
> i = 2;
> // check value of j here. It is still 1, no matter what you filled in
> above.
>
Marshall wrote:
> Joe Marshall wrote:
> > Marshall wrote:
> > >
> > > Consider the following Java fragment:
> > >
> > > void foo() {
> > > int i = 0;
> > > int j = 0;
> > >
> > > // put any code here you want
Marshall wrote:
>
> I am having a hard time with this very broad definition of aliasing.
How about this definition: Consider three variables, i, j, and k, and
a functional equivalence predicate (EQUIVALENT(i, j) returns true if
for every pure function F, F(i) = F(j)). Now suppose i and
t;, "credits" or "license" for more information.
>>>
So nothing that tries to use it works.
Any assistance would be appreciated.
Thanks,
Marshall
--
http://mail.python.org/mailman/listinfo/python-list
Sorry, this is a FreeBSD system 4.8-RELEASE
I found another set of documents that say to use the following to
install::
python setup.py install
but after running it, I still have the same problem.
Marshall
Marshall Dudley wrote:
> I am trying to install python, but am having problems. I
Fredrik Lundh wrote:
> Marshall Dudley wrote:
> > I am trying to install python, but am having problems. I did what the
> > README file said, and it created an executible code in the current
> > directory as it said it would when I typed "make".
>
> &quo
Warren Block wrote:
> Marshall Dudley <[EMAIL PROTECTED]> wrote:
> > Sorry, this is a FreeBSD system 4.8-RELEASE
> >
> > I found another set of documents that say to use the following to
> > install::
> >
> > python setup.py install
> >
>
Fredrik Lundh wrote:
> Marshall Dudley wrote:
>
> > Is it not possible to install the latest version of python on my FreeBSD
> > system? Upgrading the FreeBSD is not an option since this is a production
> > system and everything else is working fine.
>
> that'
Fredrik Lundh wrote:
Marshall Dudley wrote:
> That is what I did originally, downloaded the latest version from
the main
> python site. I compiled by the README file instructions, and
I compiled by the
> instructions on the python url which are different, but both gave
identical
Xah Lee wrote:
> in March, i posted a essay "What is Expressiveness in a Computer
> Language", archived at:
> http://xahlee.org/perl-python/what_is_expresiveness.html
>
> I was informed then that there is a academic paper written on this
> subject.
>
> On the Expressive Power of Programming Langua
Chris Smith wrote:
>
> Knowing that it'll cause a lot of strenuous objection, I'll nevertheless
> interject my plea not to abuse the word "type" with a phrase like
> "dynamically typed".
Allow me to strenuously object. The static typing community has its
own set of
terminology and that's fine.
Chris Smith wrote:
> Joe Marshall <[EMAIL PROTECTED]> wrote:
> >
> > Chris Smith wrote:
> > >
> > > Knowing that it'll cause a lot of strenuous objection, I'll nevertheless
> > > interject my plea not to abuse the word "type&quo
Chris Smith wrote:
> Joe Marshall <[EMAIL PROTECTED]> wrote:
> >
> > Agreed. That is why there is the qualifier `dynamic'. This indicates
> > that it is a completely different thing from static types.
>
> If we agree about this, then there is no need to con
Marshall wrote:
>
> That's really coming home to me in this thread: the terminology is *so*
> bad. I have noticed this previously in the differences between
> structural
> and nominal typing; many typing issues associated with this distinction
> are falsely labeled as a s
Chris Smith wrote:
> Joachim Durchholz <[EMAIL PROTECTED]> wrote:
> > Assume a language that
> > a) defines that a program is "type-correct" iff HM inference establishes
> > that there are no type errors
> > b) compiles a type-incorrect program anyway, with an establishes
> > rigorous semantics fo
Marshall wrote:
> Joe Marshall wrote:
> >
> > That's the important point: I want to run broken code.
>
> I want to make sure I understand. I can think of several things
> you might mean by this. It could be:
> 1) I want to run my program, even though I know par
Marshall wrote:
> Timo Stamm wrote:
> >
> > This is actually one of the most interesting threads I have read in a
> > long time. If you ignore the evangelism, there is a lot if high-quality
> > information and first-hand experience you couldn't find in a dozen
Marshall wrote:
>
> I stand corrected: if one is using C and writing self-modifying
> code, then one *can* zip one's pants.
Static proofs notwithstanding, I'd prefer a dynamic check just prior to
this operation.
I want my code to be the only self-modifying thing aro
David Hopwood wrote:
> > Joe Marshall wrote:
> >>
> >>I do this quite often. Sometimes I'll develop `in the debugger'. I'll
> >>change some piece of code and run the program until it traps. Then,
> >>without exiting the debugger, I
Marshall wrote:
>
> Yes, an important question (IMHO the *more* important question
> than the terminology) is what *programs* do we give up if we
> wish to use static typing? I have never been able to pin this
> one down at all.
It would depend on the type system, naturally.
It
Marshall wrote:
> Joe Marshall wrote:
> > Looking back in comp.lang.lisp, I see these examples:
> >
> > (defun noisy-apply (f arglist)
> > (format t "I am now about to apply ~s to ~s" f arglist)
> > (apply f arglist))
> >
> > (def
QCD Apprentice wrote:
> Joe Marshall wrote:
> > Marshall wrote:
> >>
> >> The real question is, are there some programs that we
> >> can't write *at all* in a statically typed language, because
> >> they'll *never* be typable?
> >
>
David Hopwood wrote:
> Joe Marshall wrote:
>
> > (defun blackhole (argument)
> > (declare (ignore argument))
> > #'blackhole)
>
> This is typeable in any system with universally quantified types (including
> most practical systems with parametric poly
David Hopwood wrote:
> Joe Marshall wrote:
> >
> > The point is that there exists (by construction) programs that can
> > never be statically checked.
>
> I don't think you've shown that. I would like to see a more explicit
> construction of a dy
Andreas Rossberg wrote:
>
>~/> ocaml -rectypes
> Objective Caml version 3.08.3
>
># let rec blackhole x = blackhole;;
>val blackhole : 'b -> 'a as 'a =
>
> The problem is, though, that almost everything can be typed once you
> have unrestricted recursive types (e.g. missing a
Xah Lee wrote:
> Computer Language Popularity Trend
>
> This page gives a visual report of computer languages's popularity, as
> indicated by their traffic level in newsgroups. This is not a
> comprehensive or fair survey, but does give some indications of
> popularity trends.
Suggestions:
Prov
Hi,
I am reposting this message from python-dev.
Could someone please test the code below
to verify that there is indeed a problem
with eval() under python 2.3.5. I have
rebuilt python 2.3.5 under the latest debian
and under RH 7.3 (in case the problem is
in system libraries).
The following code
On Wed, 29 Aug 2007, Steve Holden wrote:
>
> Lawrence Oluyede wrote:
>> Grant Edwards <[EMAIL PROTECTED]> wrote:
>>> Posting that were made to mailing lists via gmane?
>>
>> That, I do not know
>>
> Given that I have now read a reply to my post-via-gmane on gmane
> before seeing the original post
On Fri, 09 Mar 2007, Bruno Desthuilliers wrote:
>
> Nick Craig-Wood a écrit :
>> [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>>> What if 2 new 'special' comment-like characters were added to
>>> Python?:
>>>
>>>
>>> 1. The WIP (Work In Progress) comment:
>>
>> I use # FIXME for this purpose o
On 09 Mar 2007, Matthew Woodcraft wrote:
> Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
> Nick Craig-Wood a ecrit :
>> I use # FIXME for this purpose or /* FIXME */ in C etc.
>>
>> I have an emacs macro which shows it up in bright red / yellow
>> text so it is easy to see
>
On Fri, 19 Jan 2007, Steven D'Aprano wrote:
> On Fri, 19 Jan 2007 12:22:04 +1100, Ben Finney wrote:
>
>> tubby <[EMAIL PROTECTED]> writes:
>>
>>> Silly question, but here goes... what's a good way to determine
>>> when a file is an Open Office document? I could look at the file
>>> extension, bu
Alex Martelli wrote:
> Ken Tilton <[EMAIL PROTECTED]> wrote:
>...
> > But the key in the whole thread is simply that indentation will not
> > scale. Nor will Python.
>
> Absolutely. That's why firms who are interested in building *seriously*
> large scale systems, like my employer (and suppli
Alex Martelli wrote:
>
> Your "pragmatic benefits", if such they were, would also apply to the
> issue of "magic numbers", which was discussed in another subthread of
> this unending thread; are you therefore arguing, contrary to widespread
> opinion [also concurred in by an apparently-Lisp-orient
Pisin Bootvong wrote:
> Is this a Slippery Slope fallacious argument?
> (http://c2.com/cgi/wiki?SlipperySlope)
>
> "if python required you to name every function then soon it will
> require you to name every number, every string, every immediate result,
> etc. And we know that is bad. Therefore re
Alex Martelli wrote:
>
> I think it's reasonable to make a name a part of functions, classes and
> modules because they may often be involved in tracebacks (in case of
> uncaught errors): to me, it makes sense to let an error-diagnosing
> tracebacks display packages, modules, classes and functions
Alex Martelli wrote:
> Joe Marshall <[EMAIL PROTECTED]> wrote:
>...
> > The problem is that a `name' is a mapping from a symbolic identifier to
> > an object and that this mapping must either be global (with the
> > attendant name collision issues) or withi
This is just for fun, in case someone would be interested and because
I haven't had the pleasure of posting anything here in many years ...
http://derek.marshall.googlepages.com/pythonsudokusolver
Appreciate any feedback anyone who takes the time to have a look would
want to give ...
Yours
Dan Bishop wrote:
> I will say, however, that hasattr(item, '__iter__') isn't a perfect
> way of checking whether an object is iterable: Objects that just
> define __getitem__ are iterable too (e.g., UserList).
Speaking of which, what *is* the best way to check if an object is
iterable?
I always
I can already program in a few languages (but not C++) and, since Python
comes to highly recommended, I figured to venture into it.
I'm used to using an IDE.
So, after some web browsing and reading, I did the following:
Installed Python
Installed EasyEclipse
Installed wxPython
Installed wxGlad
On 2/16/2011 11:45 AM, Grant Edwards wrote:
Thanks for the advice!
Is it the intent to generate code with wxGlade and then rather
"import" that code into an Eclipse project context? Or, should
one expect to be able to create hooks (e.g. for Tools) in Eclipse
that will do that? If so, how?
Tha
How do I use wxPython or wxGlade in the context of Eclipse?
A link to a howto would be great!
Thanks,
Fred
--
http://mail.python.org/mailman/listinfo/python-list
I asked earlier:
How do I use wxPython or wxGlade in the context of Eclipse?
A link to a howto would be great!
I guess nobody knows or cares to answer?
:-(
--
http://mail.python.org/mailman/listinfo/python-list
My goal is to use Tkinter on a ScientificLinux machine for a GUI I wrote. I
installed Python 2.6.2, then built Tcl and Tk 8.5.7 from source. The final
step is to configure Python 2.6 to run Tk. When I use the "make" command in
the Python 2.6.2 directory, all is well until it tries to built _t
On 24 Aug 2009, Paul Rubin wrote:
> Esmail writes:
>> What is your favorite tool to help you debug your
>> code? I've been getting along with 'print' statements
>> but that is getting old and somewhat cumbersome.
>
> Beyond print statements, I use pdb a lot. Winpdb (www.winpdb.org) is
> even be
Roedy Green said something like:
> On 9 Dec 2005 11:15:16 -0800, "Xah Lee" <[EMAIL PROTECTED]> wrote, quoted
> or indirectly quoted someone who said :
>
>> recently i got a project that involves the use of php. In 2 days, i
>> read almost the entirety of the php doc. Finding it a breeze because it
Lars Rune Nøstdal said something like:
> hi,
> everyone thinks youreoay faggot and that youreh stupid .. now go
> fugkght yourselfes
>
> peasse out .. yo!
Idiot.
--
http://mail.python.org/mailman/listinfo/python-list
Paul McGuire coughed up:
> Is this supposed to be some sort of wake-up call or call-to-arms to
> all the CS lemmings who have been hoodwinked by Sun into the realm of
> jargon over substance?
...[rip]...
> You certainly seem to have a lot of energy and enthusiasm for these
> topics. It would be
John W. Kennedy coughed up:
> alex goldman wrote:
>> John W. Kennedy wrote:
>>
>>
>>> Strong
>>> typing has been a feature of mainstream programming languages since
>>> the late 1950's.
>>
>>
>> Is Fortran a strongly typed language? I don't think so. Strong
>> typing has been invented in the 70's,
[EMAIL PROTECTED] coughed up:
> Thomas G. Marshall wrote:
>
*Missattributed* --Thomas G. Marshall (I) did /not/ write the following:
>>> I am not familiar with modern Fortran. Surely it at least has
>>> argument prototyping by now?
>
> Since the 1990 standa
Xah Lee coughed up:
> The Rise of "Static" versus "Instance" variables
You are clearly unable to form a proper argument, *AND* you have irritated
nearly everyone frequently.
Ahthe blessed silence
--
http://mail.python.org/mailman/listinfo/python-list
ntical block in
the input stream to result in an identical block in the output
stream, which opens the door for all sorts of attacks.
Hope this helps!
-Marshall
--
http://mail.python.org/mailman/listinfo/python-list
create and track a generator when I need a function with
generator-like properties.
Thanks!
-Marshall
--
http://mail.python.org/mailman/listinfo/python-list
# => [0, 1]
print gen.send(3) # => [2, 3, 4]
print gen.send(1) # => [5]
The former is just that smidgen nicer, and allows you to continue to
make use of argument defaults and varadic arguments if so desired.
-Marshall
--
http://mail.python.org/mailman/listinfo/python-list
his])
while this:
if len(data) == size:
_, size = (yield data)
data = ''
this = file.read(size - len(data))
data = ''.join([data, this])
yield data
while True:
ded my
ArgPacker is worth it, the complete code for my coroutine decorator
follows.
-Marshall
import inspect
import types
import functools
from itertools import izip
__all__ = [ 'coroutine' ]
class ArgPacker(object):
def __init__(self, function):
args, varargs, varkw, default
of Rijndael as Crypto.Cipher.AES
and the 256-bit version of SHA-2 as Crypto.Hash.SHA256.
-Marshall
--
http://mail.python.org/mailman/listinfo/python-list
def __enter__(self):
return self
def __exit__(self, *exc_info):
self.close()
return False
Then the users of this class can freely do any of:
f = fout(filename)
...
f.close()
with fout(filename) as f:
...
with closing(fout(filename))
LocalApplication and RemoteApplication.
HTH!,
-Marshall
--
http://mail.python.org/mailman/listinfo/python-list
gt; print "(w still is:", w
>
print "after iadd, v: ", v
>
> # - running it:
v starts: [0.0, 0.0]
(w is: [1.0, 2.0] which is fine)
right now, v is: [1.0, 2.0] as you'd expect
(w still is: [1.0, 2.0]
after iadd, v: [1.0, 2.0]
-Marshall
--
http://mail.python.org/mailman/listinfo/python-list
o provide both as well, but it provides only `index()`.
Anyone know the reason for this lack of parallelism?
-Marshall
--
http://mail.python.org/mailman/listinfo/python-list
I'm not 100% sure
what the best-practices are for representing monetary values in Python,
but the `decimal` module is probably a good start.
HTH,
-Marshall
--
http://mail.python.org/mailman/listinfo/python-list
.
Ruby might be a bad example here. Although the Ruby language syntax
only supports single inheritance, mixins are implemented as multiple
inheritance under the hood. That is, inheriting from a class and
including a class as a mixin modifies the sub-/mixing class in exactly
the same way.
-
101 - 175 of 175 matches
Mail list logo