Re: more newbie help needed

2005-11-14 Thread Craig Marshall
> 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

Re: Parse file into array

2005-11-14 Thread Craig Marshall
> 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

hash()

2005-12-05 Thread John Marshall
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

Re: hash()

2005-12-05 Thread John Marshall
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

Re: hash()

2005-12-06 Thread John Marshall
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

Questions about file object and close()

2004-12-09 Thread John Marshall
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

Re: Questions about file object and close()

2004-12-09 Thread John Marshall
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

Re: Questions about file object and close()

2004-12-09 Thread John Marshall
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

Re: Lambda: the Ultimate Design Flaw

2005-04-01 Thread Joe Marshall
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/

Re: Libroffice PMT equivalent in python

2013-05-04 Thread Michael Marshall
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

Re: Libroffice PMT equivalent in python

2013-05-04 Thread Michael Marshall
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

Re: Libroffice PMT equivalent in python

2013-05-04 Thread Michael Marshall
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

Re: What is a type error?

2006-07-13 Thread Joe Marshall
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.

Re: What is a type error?

2006-07-13 Thread Joe Marshall
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. >

Re: What is a type error?

2006-07-14 Thread Joe Marshall
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

Re: What is a type error?

2006-07-17 Thread Joe Marshall
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

Installation Problem

2006-06-04 Thread Marshall Dudley
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

Re: Installation Problem

2006-06-04 Thread Marshall Dudley
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

Re: Installation Problem

2006-06-04 Thread Marshall Dudley
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

Re: Installation Problem

2006-06-04 Thread Marshall Dudley
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 > > >

Re: Installation Problem

2006-06-05 Thread Marshall Dudley
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'

Re: Installation Problem

2006-06-05 Thread Marshall Dudley
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

Re: What is Expressiveness in a Computer Language

2006-06-09 Thread Joe Marshall
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

Re: What is Expressiveness in a Computer Language

2006-06-19 Thread Joe Marshall
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.

Re: What is Expressiveness in a Computer Language

2006-06-19 Thread Joe Marshall
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

Re: What is Expressiveness in a Computer Language

2006-06-20 Thread Joe Marshall
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

Re: What is Expressiveness in a Computer Language

2006-06-21 Thread Joe Marshall
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

Re: What is Expressiveness in a Computer Language

2006-06-22 Thread Joe Marshall
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

Re: What is Expressiveness in a Computer Language

2006-06-23 Thread Joe Marshall
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

Re: What is Expressiveness in a Computer Language

2006-06-23 Thread Joe Marshall
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

Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Joe Marshall
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

Re: What is Expressiveness in a Computer Language

2006-06-26 Thread Joe Marshall
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&#x

Re: What is Expressiveness in a Computer Language

2006-06-27 Thread Joe Marshall
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

Re: What is Expressiveness in a Computer Language

2006-06-27 Thread Joe Marshall
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

Re: What is Expressiveness in a Computer Language

2006-06-27 Thread Joe Marshall
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? > > >

Re: What is Expressiveness in a Computer Language

2006-06-27 Thread Joe Marshall
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

Re: What is Expressiveness in a Computer Language

2006-06-28 Thread Joe Marshall
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

Re: What is Expressiveness in a Computer Language [correction]

2006-06-28 Thread Joe Marshall
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

Re: Computer Language Popularity Trend

2006-09-27 Thread Joe Marshall
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

Apparent eval() leak for python 2.3.5

2006-02-17 Thread John Marshall
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

Re: Gmane's been quiet ...

2007-08-29 Thread Robert Marshall
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

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Robert Marshall
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

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Robert Marshall
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 >

Re: Determining when a file is an Open Office Document

2007-01-19 Thread Robert Marshall
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

Re: A critic of Guido's blog on Python's lambda

2006-05-08 Thread Joe Marshall
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

Re: A critic of Guido's blog on Python's lambda

2006-05-08 Thread Joe Marshall
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

Re: A critic of Guido's blog on Python's lambda

2006-05-09 Thread Joe Marshall
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

Re: A critic of Guido's blog on Python's lambda

2006-05-09 Thread Joe Marshall
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

Re: A critic of Guido's blog on Python's lambda

2006-05-10 Thread Joe Marshall
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

sudoku solver in Python ...

2008-01-23 Thread Derek Marshall
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

Re: Critique of first python code

2008-02-17 Thread Matthew Marshall
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

Python Newbie needs some context

2011-02-16 Thread Fred Marshall
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

Re: Python Newbie needs some context

2011-02-16 Thread Fred Marshall
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

wxPython in Eclipse?

2011-02-17 Thread Fred Marshall
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

wxPython in the context of Eclipse

2011-02-19 Thread Fred Marshall
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

Configuring Python for Tcl/Tk in UNIX

2009-06-29 Thread Chris Marshall
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

Re: your favorite debugging tool?

2009-08-24 Thread Robert Marshall
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

Re: PHP = Perl Improved

2005-12-09 Thread Thomas G. Marshall
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

Re: Xah's Edu Corner: Examples of Quality Technical Writing

2005-12-18 Thread Thomas G. Marshall
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

Re: What are OOP's Jargons and Complexities?

2005-05-23 Thread Thomas G. Marshall
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

Re: What are OOP's Jargons and Complexities?

2005-05-24 Thread Thomas G. Marshall
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,

Re: What are OOP's Jargons and Complexities?

2005-05-25 Thread Thomas G. Marshall
[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

Re: What are OOP's Jargons and Complexities?

2005-05-25 Thread Thomas G. Marshall
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

Re: encrypting files + filestreams?

2007-08-15 Thread Marshall T. Vandegrift
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

Coroutines and argument tupling

2007-08-15 Thread Marshall T. Vandegrift
create and track a generator when I need a function with generator-like properties. Thanks! -Marshall -- http://mail.python.org/mailman/listinfo/python-list

Re: Coroutines and argument tupling

2007-08-15 Thread Marshall T. Vandegrift
# => [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

Re: Coroutines and argument tupling

2007-08-15 Thread Marshall T. Vandegrift
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:

Re: Coroutines and argument tupling

2007-08-16 Thread Marshall T. Vandegrift
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

Re: Encryption and hashing

2007-08-17 Thread Marshall T. Vandegrift
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

Re: Class destruction

2007-08-22 Thread Marshall T. Vandegrift
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))

Re: Code design problem

2007-08-29 Thread Marshall T. Vandegrift
LocalApplication and RemoteApplication. HTH!, -Marshall -- http://mail.python.org/mailman/listinfo/python-list

Re: Short, crazy example: list-derived class, with __iadd__

2007-08-29 Thread Marshall T. Vandegrift
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

Re: list index()

2007-08-30 Thread Marshall T. Vandegrift
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

Re: strings (dollar.cents) into floats

2007-08-30 Thread Marshall T. Vandegrift
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

Re: super() doesn't get superclass

2007-09-20 Thread Marshall T. Vandegrift
. 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. -

<    1   2