Re: get rid of duplicate elements in list without set

2009-03-20 Thread Scott David Daniels
Alexzive wrote: I'd like to get the same result of set() but getting an indexable object. How to get this in an efficient way? Go look at Ray Hettinger's recently announced recipe for 'OrderedSet': http://code.activestate.com/recipes/576694/ --Scott David Daniels S

Re: Organize large DNA txt files

2009-03-20 Thread Scott David Daniels
le hb <= ha: # again your comparison here yield hb hb = next(b) except StopIteration: pass if first is not flag: yield first for first in remainder: yield first --Scott David Daniels scott.dani...@a

Re: Another of those "is" issues.

2009-03-20 Thread Scott David Daniels
. def myMethod(self): ... pass c = MyClass() m = c.myMethod m is c.myMethod False <--- What? Why is that? Method access binds the instance in dynamically. Comparing m is c.myMethod is like comparing m is partial(MyClass.method, c) --Scott David Daniels scott.da

Re: Ordered Sets

2009-03-20 Thread Scott David Daniels
times are recorded in a dictionary, then the insertion order has to be sorted prior to iteration which makes iteration go from O(n) to O(n log n). The double-linked list part could be done with weakrefs and perhaps Aahz would relax a bit. --Scott David Daniels scott.dani...@acm.org --

Re: Async serial communication/threads sharing data

2009-03-21 Thread Scott David Daniels
t as many resources as you like; it really only decides who gets the lock; you decide what you only do while holding the lock (the other threads are running, except those waiting for the lock). --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: python 3, subclassing TextIOWrapper.

2009-03-22 Thread Scott David Daniels
lamber...@corning.com wrote: ... Removing the comment character to increase the stream reference count fixes the program, at the expense of an extra TextIOWrapper object. But you do create that extra TextIOWrapper, so there should be no crying about its existence. If you rely on the d

Re: python 3, subclassing TextIOWrapper.

2009-03-22 Thread Scott David Daniels
o make this more obvious, I'm sure we'd be happy to "fix" the documentation. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: decorators tutorials

2009-03-23 Thread Scott David Daniels
is can be very useful for certain kinds of table-driven code (where you may want to be able to efficiently store lists of functions to call in data files). --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Translating unicode data

2009-03-23 Thread Scott David Daniels
ay what version of Python you are working with, how the code you tried, and the results you got. Using Python 3.1, I get: >>> "\u003cb\u003eMar 17\u003c/b\u003e" == 'Mar 17' True --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: file open fails.

2009-03-24 Thread Scott David Daniels
racter), not two characters long. I think its sad that 'C:\Thesis' doesn't cause an error because there is no such character as '\T', but I am probably excessively pedantic. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: file open fails.

2009-03-25 Thread Scott David Daniels
ste rather than type. If you do that, you get the backslashes (and you better be prepared for that by using r'' to paste into). --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Ordered Sets

2009-03-26 Thread Scott David Daniels
sense? Sorry, this latter rant has been building up for a while (spurred on by a sojourn into the unittest code where they have the private disease in spades. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Introducing Python to others

2009-03-26 Thread Scott David Daniels
short time. Perhaps a "strange variable model," huge integers, defining a function, class, using modules, what "global" does and means (if you have time) and a hand-wave about types. [other excellent choices deleted] --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: difflib and intelligent file differences

2009-03-26 Thread Scott David Daniels
hayes.ty...@gmail.com wrote: Any suggestions where to start? Start by reading the docs on the difflib module, perform some of the examples, and attempt to solve it yourself. Once you get in trouble, show a clear example of what you think went wrong. --Scott David Daniels scott.dani...@acm.org

Re: Introducing Python to others

2009-03-26 Thread Scott David Daniels
f)(x - y for x, y in zip(self, other)) def __repr__(self): return '%s(%s)' % ( type(self).__name__, list.__repr__(self)) x = Vector([1,2]) x + x + x --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Python print and types selection

2009-03-28 Thread Scott David Daniels
rn BigNumber.__new__(class_, something * 3) then you can do something like: print 'dog = %r = %016X' % (HugeNumber(123), HugeNumber(123)) Hope that helps. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Confused with csv.reader copies

2009-03-28 Thread Scott David Daniels
T/Method/SpaceImpact/code/tools/ProfileViewer/" "performance_profile.csv", "rb") pass1(csv.reader(source)) source.seek(0) pass2(csv.reader(source)) --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: PyFits for Windows?

2009-03-29 Thread Scott David Daniels
extract the contents, Or, you can use the tarfile module to extract it using Python. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: tkinter questions: behavior of StringVar, etc

2009-03-29 Thread Scott David Daniels
ng you how to get to some of what you are looking for is assistance. If you want exact answers to an array of questions, pay someone to fetch you the answers, or do your own homework. Clearly I am too grumpy this weekend. Sorry about that, --Scott David Daniels scott.dani...@acm.org -- http:

Re: PyFits for Windows?

2009-03-29 Thread Scott David Daniels
ish, while reducing its utility as a clickie. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: tkinter questions: behavior of StringVar, etc

2009-03-29 Thread Scott David Daniels
Alan G Isaac wrote: On 3/29/2009 3:43 AM Scott David Daniels apparently wrote: OK, that was plain rude. a couple of questions is not six questions. A reply telling you how to get to some of what you are looking for is assistance. If you want exact answers to an array of questions, pay someone

Re: tkinter questions: behavior of StringVar, etc

2009-03-29 Thread Scott David Daniels
Alan G Isaac wrote: Alan asked: - Why does a Variable need a master? - If s is a StringVar instance, why is str(s) its name rather than its value? On 3/29/2009 2:46 PM Scott David Daniels apparently wrote: The answer to that, grasshopper, lies in the answer to the question, "Wha

Re: 2.5/2.4 multiprocessing backport doc typo

2009-03-29 Thread Scott David Daniels
Aahz wrote: In article , Daniel Fetchinson wrote: === Changes === 2.6.1.1 -- 2009-12-07 I guess it should be 2008-12-07 :) That's just the time machine in operation. I thought I smelled ozone. -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing PLPython - Version Problem

2009-03-29 Thread Scott David Daniels
hoping for 2.6.2 final on 10-April). --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Python print and types selection

2009-03-29 Thread Scott David Daniels
mark.sea...@gmail.com wrote: ... I'm not sure what the "something * 3" does? Here is the printout: dog = HugeNumber(369) = 0171 But I was able to put the concept into practice. It was simply meant to be an absurd example. If you could apply it, you've got the

Re: global name 'self' is not defined - noob trying to learn

2009-03-29 Thread Scott David Daniels
t_val, reg_info): self.reg_info = reg_info --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: global name 'self' is not defined - noob trying to learn

2009-03-30 Thread Scott David Daniels
st of which were subclasses of the base RegisterValue class with different bit name lists. Remember that just because a Register might have a name, doesn't mean its string representations don't necessarily reflect the contents of the register (lists show their contents, for example). I think you&

Re: running pyhton IDLE on windows vista

2009-03-30 Thread Scott David Daniels
b.org/~esr/faqs/smart-questions.html We need more information. You can oen a command window (run cmd.exe) and type C:> python -m idlelib.idle This may give details about exactly what is happening in output in that command window. --Scott David Daniels scott.dani...@acm.org -- http://ma

Re: List of paths

2009-04-01 Thread Scott David Daniels
'/desktop', /desktop/pc', '/desktop/mac'] Should the answer be ['/desk'] or ['/desk', '/desktop'] ? --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: statvfs clearance

2009-04-05 Thread Scott David Daniels
"A wizard is someone who can fix his own mistakes quickly." Heaven save us from wizards. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Generators/iterators, Pythonicity, and primes

2009-04-05 Thread Scott David Daniels
break else: raise Exception("Shouldn't have run out of primes!") --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: On Integration Testing

2009-04-07 Thread Scott David Daniels
fetime. Make some clients slow and others fast in your mix. Performance testing (seeing how much you can accomplish in a second) is, I'd argue, a later phase (where you need a good model of actual use). First, go for correctness under "strange" interactions. --Scott David Daniels

Re: Adding method to class at run-time: bad style?

2009-04-07 Thread Scott David Daniels
entForm.Control = FancyControl ClientForm.HTMLForm = FancyHTMLForm But substituting monkey-patching for class method insertion seems like you are going from one quick and dirty technique to a slightly nicer quick and dirty technique. --Scott David Daniels scott.dani...@acm.org -- http://mail.pyth

Re: Adding method to class at run-time: bad style?

2009-04-07 Thread Scott David Daniels
Grant Edwards wrote: On 2009-04-07, Grant Edwards wrote: On 2009-04-07, Scott David Daniels wrote: Grant Edwards wrote: I realize that technically all methods are added to classes at "run-time", but what I'm talking about is this: ... ClientForm.Control.__eq__

Re: 3D plotting in a GUI

2009-04-07 Thread Scott David Daniels
VPython. Especially if MayaVi is too much. It has provisions for running with cross-eyed and wall-eyed 3-D as well as the cheapo colored paper glasses and the seriously not cheapo shuttered-glasses / special display card option. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org

Re: Adding method to class at run-time: bad style?

2009-04-07 Thread Scott David Daniels
Grant Edwards wrote: On 2009-04-07, Scott David Daniels wrote: File "/usr/lib/python2.5/site-packages/ClientForm.py", line 2016, in add_to_form Control.add_to_form(self, form) TypeError: unbound method add_to_form() must be called with FancyControl instance as firs

Re: Decompression with zlib

2009-04-08 Thread Scott David Daniels
print "decompressed: %d+%d+%d: %r %r %r" % ( len(a), len(b), len(c), a, b, c) --Scott David Daniels scott.dani...@acm.org > decompressor = zlib.decompressobj() # wbits -- http://mail.python.org/mailman/listinfo/python-list

Re: How to import a module so that the current globals are available to the module?

2009-04-09 Thread Scott David Daniels
, and start each use with something like: from base_functions import bibble, babble, bobble, bome --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: How to create a virtual serial port?

2009-04-10 Thread Scott David Daniels
erial port data, particularly pySerial results... Cheers Stu Well, search for Smart Questions. I have no idea what your OS is, nor what level of "virtual serial port" you want/need. All anyone could do with your current request is guess what you need and try to steer you towards it. -

Re: How to create a virtual serial port?

2009-04-11 Thread Scott David Daniels
n _any_ language (likely they'll have an Objective C way). Then pop back over here (or even better a python-mac list, where they'll be familiar with how to do lots of stuff) and you can get help getting python to either do the same thing or talk to a bit of code that does the byte-trans

Re: How to create a virtual serial port?

2009-04-11 Thread Scott David Daniels
Stuart Davenport wrote: On 11 Apr, 08:52, Scott David Daniels wrote: Stuart Davenport wrote: ... I'm on a OS X, python 2.5 Then the GPS program I have running on my MAC, RouteBuddy, can read the data from that serial port as standard. I'ms confused by this statement. Wha

Re: How to create a virtual serial port?

2009-04-11 Thread Scott David Daniels
I could plug in anything but a USB connector, an ethernet connector, a firewire connector, headphones, speakers, a display connector, or a power cord. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: How to create a virtual serial port?

2009-04-11 Thread Scott David Daniels
hy I was trying to figure that out. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and XML Help

2009-04-13 Thread Scott David Daniels
) use something like: from xml.etree import cElementTree as ET ... parsed = ET.parse('CharacterID.xml') for node in parsed.getiterator('osArchitecture'): print node.text or if you have the data in a string, root = ET.fromstring('string') print root[

Re: Overflow error (was Vol 67, Issue 192)

2009-04-13 Thread Scott David Daniels
length, you using the magic constant for practically everything, "42", can give you the chunk size to use: ord("4") * ord("2") * int("42") == 109200 :-) --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and XML Help

2009-04-15 Thread Scott David Daniels
ookrin wrote: I am still learning. And it's not that I won't take the advice for using ElementTree, I just currently don't know anything about it. I just didn't want to say, "I have no idea what you're talking about!" to Scott cause I figured that would be

Re: Play sound at wanted frequency

2009-04-15 Thread Scott David Daniels
s cut into pygame to see how _it_ accomplishes your task, and mimic that. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: How to query object of GUI?

2009-04-15 Thread Scott David Daniels
e, label): # here you know it was the (sequence+1)th entry named label ... --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Unable to abort a FTP command?

2009-04-15 Thread Scott David Daniels
on as why:" if >= Py2.6 logging.error('%s: %s encountered' % ( (why.__class__.__name__, why)) if not isinstance(why, Exception): raise data = conn

Re: Equivalent to C bitmasks and enumerations

2009-04-15 Thread Scott David Daniels
parts.append(hex(v)) return '%s(%s)' % (self.__class__.__name__, '|'.join(parts)) for _name, _value in Status._bits: setattr(Status, _name, Status(_value)) --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Testing in Python mailing list broken?

2009-04-15 Thread Scott David Daniels
Does anyone know if the Testing in Python mailing list is broken or turned off? It was running almost too many messages, but now there has been a _huge_ silence. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: RELEASED Python 2.6.2

2009-04-15 Thread Scott David Daniels
file for all the gory details. Congratulations. A great success. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Testing in Python mailing list broken?

2009-04-15 Thread Scott David Daniels
Scott David Daniels wrote: Does anyone know if the Testing in Python mailing list is broken or turned off? It was running almost too many messages, but now there has been a _huge_ silence. --Scott David Daniels scott.dani...@acm.org Never mind, I've seen a couple posts. --

Re: How to check all elements of a list are same or different

2009-04-15 Thread Scott David Daniels
for "is" comparison, how about: max(id(x) for x in mylist) == min(id(x) for x in mylist) It has the advantage that if [id(x) for x in mylist] = [2N, 1N, 3N], you get the answer you desire. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: What IDE support python 3.0.1 ?

2009-04-15 Thread Scott David Daniels
Ben Finney wrote: ... the upgrade police have not been given your address yet Don't be so sure! We of the Python Secret Upgradepolice ... -- http://mail.python.org/mailman/listinfo/python-list

Re: What IDE support python 3.0.1 ?

2009-04-16 Thread Scott David Daniels
one great editor and one abomination. Opinions differ, however, on which one is the abomination. :-) --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading an exact number of characters from input

2009-04-16 Thread Scott David Daniels
d you that behavior allow the other answer to someone who wanted the opposite. sys.stdin is not a keyboard driver. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: compiler package vs parser

2009-04-17 Thread Scott David Daniels
; for k in D: > exec '%s=D[%r]' % (k,k) > print i, j, k --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: script question

2009-04-17 Thread Scott David Daniels
: function() --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: script question

2009-04-17 Thread Scott David Daniels
gitulyar wrote: On Apr 17, 5:23 pm, Scott David Daniels wrote: Marco Mariani wrote: Piet van Oostrum wrote: funclist = [func01, func02, func03, ... ] for i in range(1,n): funclist[i]() Or myscript.funclist[i]() from another module. ... For example, you could do it like: funclist

Re: script question

2009-04-17 Thread Scott David Daniels
pyt...@bdurham.com wrote: Scott, Newbie question (and I'm not the OP): What are your thoughts on having your decorator add an attribute to the functions vs. placing the functions in a global variable? def _included(f): f._included = True return f I tried experimenting with

Re: unpythonic use of property()?

2009-04-17 Thread Scott David Daniels
hung up on terms like "Pythonic". Treat such labels are more of a red flag and get people who throw out the term to explain why. Think of it as a comment like "that has a bad code smell" -- you can do it if you like, but you should have satisfied yourself that your case is su

Re: Is there a programming language that is combination of Python and Basic?

2009-04-17 Thread Scott David Daniels
changed. The changes to Python 3.x is a language change, but Python has been _very_ conservative about changing (as opposed to extending) the language. There are only a few languages that might plausibly called "Basic", and Dartmouth Basic has maybe the best claim to that name. --Scott Dav

Re: Is there a programming language that is combination of Python andBasic?

2009-04-19 Thread Scott David Daniels
it." How did you manage to keep your reply so meek? You must be a really well brought up person. :-) Possibly because the proper reply was probably, "You only THINK you know how it works. _I_, on the other hand, know how it behaves, even if I don't know how it was supposed to wor

Re: Is there a programming language that is combination of PythonandBasic?

2009-04-19 Thread Scott David Daniels
good or evil. The goto is a sharp, spiky dangerous tool that seduces people into thinking of using it far too often. It should be used with the same respect you approach beautiful well- armed people of questionable morals who you find attractive. --Scott David Daniels scott.dani...@acm.org

Re: Is there a programming language that is combination of PythonandBasic?

2009-04-19 Thread Scott David Daniels
called "immune to programming." --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Interest in generational GC for Python

2009-04-19 Thread Scott David Daniels
look for that work (and perhaps FePy or unladen swallow). --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: The Python standard library and PEP8

2009-04-20 Thread Scott David Daniels
wrote a book entitled "My Cat is Object-Oriented." His basic premise is that, while everyone understands what you mean when you say something is object-oriented, everyone's understanding is different. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Programming in Python with a view to extending in C at a later date.

2009-04-20 Thread Scott David Daniels
ll be good enough. This technique takes advantage of the fact that trying several different algorithms will be much easier in Python than in C or C++. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: rectangles, or cavases, or ... ?

2009-04-20 Thread Scott David Daniels
iteration, which is placed on a canvas. Other? Are there obvious considerations in the choice? (Right now I do not need to interact with the squares, but in the future I may need to.) You should have said, but I'll guess you are using Tkinter. I'd put the rectangles on a canvas, myself. --S

Re: Python, MS SQL, and batch inserts

2009-04-21 Thread Scott David Daniels
data, then do UPDATEs and INSERTs to get the data spread out into the main tables. You (the OP) might try a scheme like that. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Python, MS SQL, and batch inserts

2009-04-21 Thread Scott David Daniels
ericwoodwo...@gmail.com wrote: On Apr 21, 4:01 pm, ericwoodwo...@gmail.com wrote: On Apr 21, 3:36 pm, Scott David Daniels wrote: I forget the name of the SQL Server bulk loader, bcp (bulk copy) was the name of the bulk loader. I just remembered. Sorry, no more exciting advice

Re: python command not working

2009-04-22 Thread Scott David Daniels
C:\WhereEver> python25 Personally, I would use the name "python25.cmd", but that may just be superstition on my part about the difference between .bat and .cmd files. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Weird lambda behavior

2009-04-22 Thread Scott David Daniels
confuse your reader (they may be fooled into looking up what the "__callFn__" special method does in addition to normal method behaviors. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Ending data exchange through multiprocessing pipe

2009-04-22 Thread Scott David Daniels
it, while the parent process will get() them as long as there is an active subprocess Well, if the protocol for a worker is: : queue.put(result) queue.put() queue.close() Then you can keep count of how many have finished in the consumer. --Scott David Daniels

Re: Python Packages : A looming problem? packages might no longer work? (well not on your platform or python version anyway)

2009-04-23 Thread Scott David Daniels
ening. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Large data arrays?

2009-04-23 Thread Scott David Daniels
someone else's trade-offs, which likely fail to match your use case. You might check gmane.comp.python.scientific.user which I think is gmane's mirror of comp.python.scipy.user, but I'm not certain of the mailing list name. Certainly the people over there regularly deal with accessi

Re: JOB: Statistical Programmer | LOCATION: London, England, UK

2009-04-23 Thread Scott David Daniels
jt wrote: JOB: Statistical Programmer ... Job postings are not in order here, they are off-topic. If you go to http://www.python.org/community/jobs/ You will see a jobs posting board that will happily post your job. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Scott David Daniels
function. Right now you can get the function name and (with a bit more effort) its module. Imagine debugging a pile of code that includes a module with: import random def random.random(): return .42 --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Presentation software for Python code

2009-04-23 Thread Scott David Daniels
early version of Crunchy are demonstrated in this screencast. http://showmedo.com/videos/video?name=143&fromSeriesID=143 --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: first, second, etc line of text file

2009-04-23 Thread Scott David Daniels
most likely a single comparison for a dict whether it is a hit or a miss. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Large data arrays?

2009-04-24 Thread Scott David Daniels
file(src, count=128 * 128) block.shape = (128, 128) and then you've got your sub-block. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-24 Thread Scott David Daniels
Marco Mariani wrote: Scott David Daniels wrote: I am afraid it will make it too easy to define functions in other modules remotely, a tempting sharp stick to poke your eye out with. Imagine debugging a pile of code that includes a module with: import random def random.random

Re: confused with so many python package locations for imports

2009-04-26 Thread Scott David Daniels
otherwise unchanged. But the compiled C extension modules are called ".pyd" files and they are built separately from the execution time and thus do not suffer the faults of which you complain. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Scott David Daniels
Travis wrote: ... I've noticed that every one of you is wrong about programming. Since I can't say it effectively, here's someone who can: http://www.youtube.com/watch?v=XHosLhPEN3k That's the answer. That is a wonderful link. Thanks for sharing. --Scott David Daniels s

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Scott David Daniels
ode before it works fully correctly. Therefore, you had better write code so simple that you can know what is going wrong with it. If your code is too hard to understand for the average programmer, you are either four times as brilliant as those "average" progr

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Scott David Daniels
ct, is what would happen if you could kill it). --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Web based application development using python

2009-04-27 Thread Scott David Daniels
. It should be more based on framework type. b. It should have all the features present in mod_python. These two goals conflict. You'll need to use your brain to discover what is best for your application. In general "have all the features of" and "but better"

Re: CSV performance

2009-04-27 Thread Scott David Daniels
block.append(numpy.array(cx)) block.append(numpy.array(px)) return (''.join(block[0::3]), numpy.concatenate(block[1::3]), numpy.concatenate(block[2::3])) # The following repeats 128, to avoid initial read issues. # Treat the diff twixt the

Re: inside-out range function

2009-04-28 Thread Scott David Daniels
shiny fun!!! How's this for that: def monge_shuffle2(deck): even = (len(deck) ^ 1) & 1 return deck[even::2] + deck[-2::-2] --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Why bool( object )?

2009-04-28 Thread Scott David Daniels
t; If you define the short-circuit boolean operators "and" and "or" as Python does, the idea of "most anything is True" menas you can have code that does: v = look('here') or look('there') or look('everywhere') or default This is

Re: Web framework for embedded system

2009-04-28 Thread Scott David Daniels
alk from PyCon: Title: Batteries Included! Python on Low Cost Tiny Embedded Wireless Devices http://blip.tv/file/1947528 You might want to try contacting them. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: How to retry something with a timeout in Python?

2009-04-28 Thread Scott David Daniels
else: return # success -- have the lock raise ImTiredError --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: dict is really slow for big truck

2009-04-29 Thread Scott David Daniels
Bruno Desthuilliers wrote: d = {} for line in open(thefile): arr = line.strip().split() d[arr[0]] = arr Sorry, not picking on Bruno in particular, but I keep seeing this formulation around various places. When does line.strip().split() ever differ from line.split()? --Scott David

Re: import and package confusion

2009-04-29 Thread Scott David Daniels
t VLMLegacy.WINGTL.Conditions.Conditions as WINGTL_Conditions ... b = VLM4997_Conditions(2) b.test() ... --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: dict is really slow for big truck

2009-04-29 Thread Scott David Daniels
MRAB wrote: Scott David Daniels wrote: Bruno Desthuilliers wrote: d = {} for line in open(thefile): arr = line.strip().split() d[arr[0]] = arr Sorry, not picking on Bruno in particular, but I keep seeing this formulation around various places. When does line.strip().split() ever differ

Re: import and package confusion

2009-04-29 Thread Scott David Daniels
is a namespace to hold modules (possibly more). I don't understand why you don't use files like: VLMLegacy/ __init__.py Reader.py VLM4997.py WINGTL.py But, presuming some kind of rationale, put the code you want in VLMLegacy/VLM4997/__init__.py

Re: import and package confusion

2009-04-29 Thread Scott David Daniels
Dale Amon wrote: On Wed, Apr 29, 2009 at 01:12:33PM -0700, Scott David Daniels wrote: Dale Amon wrote: I am trying to get to the heart of what it is I am missing. Is it the case that if you have a module C in a package A: A.C that there is no way to load it such that you can

Re: dict is really slow for big truck

2009-04-29 Thread Scott David Daniels
prueba...@latinmail.com wrote: It is probably out of habit of using the generalized idiom: line="a,b,c\n" line.strip().split(",") Ah, thank you. I just couldn't figure out where it started. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: import and package confusion

2009-04-29 Thread Scott David Daniels
.reader import Reader from VLMLegacy.VLM997.conditions import Conditions ... The the consuming python code can do: import VLMLegacy.VLM997 something = VLMLegacy.VLM997.Reader() ... --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

<    12   13   14   15   16   17   18   19   20   21   >