ANN: PyGUI Mailing List

2009-11-21 Thread Gregory Ewing
/ -- Gregory Ewing greg.ew...@canterbury.ac.nz http://www.cosc.canterbury.ac.nz/greg.ewing/ -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/

ANN: Pyrex 0.9.9

2010-04-12 Thread Gregory Ewing
Pyrex 0.9.9 is now available: http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/ Highlights of this release: * Some facilities for interfacing with C++ code have been added. * Changes have been made to the semantics of exception catching to improve efficiency. * Preparation is

ANN: PyGUI 2.3

2010-10-17 Thread Gregory Ewing
PyGUI 2.3 is available: http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ This version works on Snow Leopard with PyObjC 2.3. What is PyGUI? -- PyGUI is a cross-platform GUI toolkit designed to be lightweight and have a highly Pythonic API. -- Gregory Ewing greg.ew

ANN: Sixth Pyggy Awards

2011-04-30 Thread Gregory Ewing
Registrations are now open for the Sixth Pyggy Awards. Judging will be from 17-31 July 2011. http://pyggy.pyweek.org/ This time, entry is open to any Python-based game, not just PyWeek games, and not just games developed during PyWeek or Pyggy. So if you've had a Python game project on the

ANN: PyGUI 2.5.1

2011-06-20 Thread Gregory Ewing
PyGUI 2.5.1 is available: http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ Minor update to fix missing distutils_extensions.py file. What is PyGUI? -- PyGUI is a cross-platform GUI toolkit designed to be lightweight and have a highly Pythonic API. -- Gregory Ewing

Re: New syntax for blocks

2009-11-20 Thread Gregory Ewing
Steven D'Aprano wrote: I don't know what the state of the art on Mac is these days, but in 1984s Macs had a standard keyboard layout that let you enter most available characters via the keyboard, using sensible mnemonics. E.g. on a US keyboard layout, you could get ≠ by holding down the

Re: Relative versus absolute paths on Windows

2009-11-20 Thread Gregory Ewing
Jason R. Coombs wrote: In other words, paths without a drive letter are reported as absolute, but treated as relative, except in a few special cases. It's not clear what the result ought to be here, since Windows drive-relative paths don't really fit into the unix absolute/relative dichotomy.

Re: What is the naming convention for accessor of a 'private' variable?

2009-11-20 Thread Gregory Ewing
Steven D'Aprano wrote: On Wed, 18 Nov 2009 18:47:34 -0800, Chris Rebert wrote: Accessor methods are not Pythonic. Accessor methods are *usually* not Pythonic, at least not the way they are commonly used in Java. To elaborate, accessor methods that *only* read and write another, ordinary

ANN: PyGUI Mailing List

2009-11-21 Thread Gregory Ewing
/ -- Gregory Ewing greg.ew...@canterbury.ac.nz http://www.cosc.canterbury.ac.nz/greg.ewing/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Too Many Values To Unpack

2009-11-21 Thread Gregory Ewing
Dennis Lee Bieber wrote: I apparently thought for ... in dictionary would return (key, value) pairs, but it appears that it only returns the key itself -- and a single key can't be unpacked. Misleading error... too many /targets/ to unpack... My guess is that the keys are

Re: plotting arrow in python

2009-11-21 Thread Gregory Ewing
rudra wrote: 0.0 0.0 0.1 0.0 0.1 0.1 0.1 0.0 0.5 like that! the first two column are coordinate and 3rd one is magnitude of moment (say: x y,m)!! so what i want to do is draw an arrow of magnitude(m) in the position (x,y). There seems to be some information missing there. How do you know

Re: parallel class structures for AST-based objects

2009-11-21 Thread Gregory Ewing
Steve Howell wrote: My objection to the interface you describe is that Node defines the type of operations that can be done to it by third-party code, which is something that I cannot predict I think you have the right idea with a mapping from node classes to implementations of operations,

Re: Go versus Brand X

2009-11-21 Thread Gregory Ewing
On Nov 21, 11:20 am, John Roth johnro...@gmail.com wrote: Go is simply C with most (but not all) of the warts removed and some more modern features added. Syntax-wise, I find myself disappointed that they didn't do as good a job of removing the warts as they could have. For example, there

Re: Writing a Carriage Return in Unicode

2009-11-21 Thread Gregory Ewing
Steve Howell wrote: If you are going to couple character sets to their legacy physical implementations, you should also have a special extra character to dot your i's and cross your t's. No, no, no. For that device you need to output a series of motion vectors for the scribing point. Plus

Re: ANN: PyGUI Mailing List

2009-11-22 Thread Gregory Ewing
Terry Reedy wrote: Having it mirrored to news.gmane,org, if you have not yet, like other python.org lists, would make it easier to follow or join. Perhaps it will happen automatically, I do not know. I don't think it's automatic. I've submitted a request to gmane to have it added and I'm

Re: Go versus Brand X

2009-11-23 Thread Gregory Ewing
Robert Kern wrote: The easier it is to write *a* parser/analyzer for the language in any other programming language, the more tools you will get for a broader range of runtime environments, particularly constrained environments like editors that may not be extensible at all. Seems to me that

Re: python bijection

2009-11-24 Thread Gregory Ewing
Joshua Bronson wrote: So I'm thinking of renaming the class injectivedict or idict instead of bijection. Is that crazy?) I think you'd be better off calling it something more down-to-earth such as bidict (bidirectional dictionary). That way people without an advanced degree in mathematics have

Re: Can self crush itself?

2009-11-25 Thread Gregory Ewing
n00m wrote: I can't understand why we can get __name__, but not __dict__, on the module level? For much the same reason that you can see your own feet but (unless you look in a mirror) you can't see your own eyes. -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature request: String-inferred names

2009-11-25 Thread Gregory Ewing
On Wed, 25 Nov 2009 20:44:36 -0600, The Music Guy music...@alphaios.net declaimed the following in gmane.comp.python.general: I just posted to my blog about a feature that I'd like to see added to Python. http://alphaios.blogspot.com/2009/11/python-string-inferred-names-working.html I don't

Re: Feature request: String-inferred names

2009-11-26 Thread Gregory Ewing
The Music Guy wrote: As for it not being useful enough to justify new syntax, well, I think Ben showed pretty well that it actually is. Approximately 600 uses of the get*r functions were used in the Python 2.5 standard library alone. The standard library isn't necessarily representative of

Re: python and vc numbers

2009-11-29 Thread Gregory Ewing
Daniel Dalton wrote: what function/module should I use to figure out what tty my program was invoked from? Here's one way: % python Python 2.5 (r25:51908, Apr 8 2007, 22:22:18) [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin Type help, copyright, credits or license for more

Re: semantics of ** (unexpected/inconsistent?)

2009-11-30 Thread Gregory Ewing
Esmail wrote: Wow .. never heard of Concatenative_languages languages before or the distinction you make. Your distinction explains the behavior, but I find it somewhat counter-intuitive. You shouldn't find it any more surprising than the fact that a = 2 + 3 print a * 5 gives a

Re: python and vc numbers

2009-11-30 Thread Gregory Ewing
Daniel Dalton wrote: I can't find a reliable way to determine the current console number with python or any bash tool. When I say console number, I mean the actual console number, not screen window or device it is sending to or whatever. You may be able to tell by looking at the DISPLAY

Re: Dangerous behavior of list(generator)

2009-12-16 Thread Gregory Ewing
exar...@twistedmatrix.com wrote: Which is unfortunate, because it's not that hard to get StopIteration without explicitly raising it yourself and this behavior makes it difficult to debug such situations. It might not be hard if you set out to do it, but in my experience it's pretty rare to

Re: Seek support for new slice syntax PEP.

2009-12-16 Thread Gregory Ewing
Terry Reedy wrote: So it would be MUCH more useful if that notation created a range object. for i in [1:n]: ... So I would oppose the slice proposal in favor of a range proposal. Another possibility would be to unify range and slice objects so that they're actually the same thing. Then the

Re: Raw string substitution problem

2009-12-17 Thread Gregory Ewing
MRAB wrote: Regular expressions and replacement strings have their own escaping mechanism, which also uses backslashes. This seems like a misfeature to me. It makes sense for a regular expression to give special meanings to backslash sequences, because it's a sublanguage with its own syntax.

Re: Raw string substitution problem

2009-12-18 Thread Gregory Ewing
MRAB wrote: In simple cases you might be replacing with the same string every time, but other cases you might want the replacement to contain substrings captured by the regex. But you can give it a function that has access to the match object and can produce whatever replacement string it

Re: Eclipse Carriage Return Workaround

2009-12-18 Thread Gregory Ewing
Steve Holden wrote: Can anyone think of a simple way work around this issue by overriding __builtins__.input() with a function that calls input() and then returns an rstrip()ped version of the input string? I though of setting a PYTHONSTARTUP environment variable, but that only affects

Re: iterators and views of lists

2009-12-18 Thread Gregory Ewing
Terry Reedy wrote: On the other hand, Python indexes are a form of random access iterator, the top of the hierarchy. The term random access iterator seems oxymoronic to me. Iteration is all about operating on things in sequence. If you're accessing elements arbitrarily, then you're not

Re: Dangerous behavior of list(generator)

2009-12-18 Thread Gregory Ewing
Albert van der Horst wrote: An important feature that is not documented is a severe defect. This isn't something that I would expect to find documented under the heading of generator expressions, because it doesn't have anything to do with them. It's an interaction between the iterator

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Gregory Ewing
Mensanator wrote: Really? Does that mean you don't use literals, to save the time required to convert them to integers? I think all he means is that when he *does* use a named constant, he spells it in lower case rather than upper case, e.g. 'twopi' rather than 'TWOPI'. I don't think there's

Re: numpy performance and random numbers

2009-12-19 Thread Gregory Ewing
Lie Ryan wrote: If you don't care about repeatability (which is already extremely difficult in parallel processing even without random number generators), you can just start two PRNG at two distinct states (and probably from two different algorithms) There's no need for different

Re: equivalent of Ruby's Pathname?

2010-02-08 Thread Gregory Ewing
Carl Banks wrote: I don't remember if the idea of modifying open to accept path objects came up. It wouldn't just be open() that people would want modified -- it would be every other function that takes a pathname as well. I seem to recall another point of contention was whether path objects

Re: ANN: obfuscate

2010-02-08 Thread Gregory Ewing
Tim Chase wrote: I prefer the strength of Triple ROT-13 for my obfuscation needs, but I don't see it listed here. That's old hat -- with the advent of 3GHz cpus and GPGPU, all the experts are recommending quadruple ROT-128 nowadays. -- Greg --

Re: ANN: obfuscate

2010-02-10 Thread Gregory Ewing
Christian Heimes wrote: A much, much stronger version of the principles behind Vigenère was used in the German Enigma machine. Because the algorithm was still not good enought some clever guy called Turing and his team was able to crack the enigma. Actually I gather it had a lot to do with the

Re: ANN: obfuscate

2010-02-11 Thread Gregory Ewing
Daniel Fetchinson wrote: It also turned out that everybody mostly writes his/her own obfuscation routine. Hey, it gives you the additional advantage of obfuscation by obscurity! -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Please help with MemoryError

2010-02-12 Thread Gregory Ewing
Steven D'Aprano wrote: Python's calling convention already has an well-established name, established over thirty years ago by the distinguished computer scientist Barbara Liskov, namely call-by-sharing. And she was mistaken in thinking it needed a new name. -- Greg --

Re: Please help with MemoryError

2010-02-12 Thread Gregory Ewing
Antoine Pitrou wrote: It's just that assignment (=) means a different thing in Python than in non-object languages (or fake-object languages such as C++ or PHP): it rebinds instead of mutating in-place. If it mutated, you wouldn't have the AssertionError. It doesn't really have anything to

Re: The future of frozen types as the number of CPU cores increases

2010-02-18 Thread Gregory Ewing
John Nagle wrote: One way to implement locking is something like this: Mutable objects have a reference count field, a lock field, and an owner field. Initially, the owner of an object is its thread. If an object's only reference is a field of a synchronized object, the owner is the

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Gregory Ewing
Steve Howell wrote: Python may not support the broadest notion of anonymous functions, but it definitely has anonymous blocks. You can write this in Python: for i in range(10): print i print i * i print i * i * i There's a clear difference between this and a Ruby

Re: lists of variables

2010-02-21 Thread Gregory Ewing
Steven D'Aprano wrote: On Sat, 20 Feb 2010 22:31:44 -0800, Carl Banks wrote: The one place where Python does have references is when accessing variables in an enclosing scope (not counting module-level). What makes you say that? I think Carl is talking about cells, which *are* actually

Re: Pure virtual functions in Python?

2010-02-21 Thread Gregory Ewing
lallous wrote: If the base defines the method and it was empty, then my C++ code would still call the function. This is not optimal because I don't want to go from C++ to Python if the _derived_ class does not implement the cb. I would simply not implement the method at all in the base class.

Re: Use eval() safely?

2010-02-21 Thread Gregory Ewing
W. Martin Borgert wrote: def myeval(untrustedinput): return eval(untrustedinput, {__builtins__: None}, { abs: abs, sin: math.sin }) Is it possible to define functions or import modules from the untrusted input string? This is NOT safe as it stands. It still isn't safe

Re: Use eval() safely?

2010-02-24 Thread Gregory Ewing
Steven D'Aprano wrote: Not that I don't believe you (I do!) but could you demonstrate for the record? I posted a demonstration of this earlier in this thread. The key thing is the __subclasses__() method of a class. You can start with any object, work your way up the base class chain to

Re: while loop with the condition used in the body

2010-02-24 Thread Gregory Ewing
Ulrich Eckhardt wrote: so why not: while expression as name: ... and also: if expression as name: ... This sort of thing has been suggested repeatedly in the past, and it's always been rejected. That's not likely to change. Look up the past threads for the reasons why. --

Re: Creating variables from dicts

2010-02-24 Thread Gregory Ewing
Luis M. González wrote: I still don't understand why is it a bad idea in the case of globals(). This is the only way I know to define variables programatically in the top-level namespace, without having to do it manually one by one. The point is that creating variables whose names are

Re: When will Java go mainstream like Python?

2010-02-25 Thread Gregory Ewing
Lawrence D'Oliveiro wrote: And then there’s caching. Modern CPUs owe most of their speed to assumptions that programs will obey locality of reference. Pointer-chasing is a cache- hostile activity. Another thing to consider is the rate at which garbage is created. Java's fundamental types

Re: staticmethod and namespaces

2010-02-27 Thread Gregory Ewing
darnzen wrote: Well, I got around this mess by putting all those static callbacks into a separate module in a new class. I set them up to call a bound method of that class which passes the arguments to the appropriate bound methods of other class instances. I just have to keep a little dict of

Re: Docstrings considered too complicated

2010-02-27 Thread Gregory Ewing
Mel wrote: You could think of it as a not bad use of the design principle Clear The Simple Stuff Out Of The Way First. Destinations are commonly a lot simpler than sources That's not usually true in assembly languages, though, where the source and destination are both very restricted and

Re: random.gauss: range

2010-02-27 Thread Gregory Ewing
Steven D'Aprano wrote: def pinned_gaussian(a, b, mu, sigma): Return a Gaussian random number pinned to [a, b]. return min(b, max(a, random.gauss(mu, sigma))) def truncated_gauss(a, b, mu, sigma): Return a random number from a truncated Gaussian distribution. while 1: x =

Re: Docstrings considered too complicated

2010-03-02 Thread Gregory Ewing
MRAB wrote: BTW, the first programming I did was in hexadecimal (C4xx was LDI xx). Hey, a SC/MP! That was my first programming language, too. What sort of machine was it in? -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Docstrings considered too complicated

2010-03-02 Thread Gregory Ewing
Grant Edwards wrote: Just a mediocre copy of the CP/M filesystem, which was in turn copied from DEC's RSTS or RSX. It was actually an improvement over CP/M's file system. CP/M didn't have hierarchical directories or timestamps and recorded file sizes in 128-byte blocks rather than bytes. --

Re: Docstrings considered too complicated

2010-03-02 Thread Gregory Ewing
Ben Finney wrote: Just as customers should demand both that a building be built to do its job well, *and* that its architectural plans meet measurable, testable industry standards of quality for independent re-use at some indeterminate later date. A problem is that it's very hard to come up

Re: Queue peek?

2010-03-02 Thread Gregory Ewing
MRAB wrote: I suppose it depends on the complexity of the data structure. A dict's methods are threadsafe, for example, but if you have a data structure where access leads to multiple method calls then collectively they need a lock. It also depends on the nature of the objects being used as

Re: case do problem

2010-03-02 Thread Gregory Ewing
Alf P. Steinbach wrote: * Tracubik: iterations=0; count=0; REPEAT; iterations = iterations+1; ... IF (genericCondition) THEN count=count+1; ... CASE count OF: 1: m = 1 2: m = 10 3: m = 100 Uhm, is this syntactically valid Pascal? As I recall, every Pascal

Re: Writing an assembler in Python

2010-03-02 Thread Gregory Ewing
In article xns9d28186af890cfdnbgui7uhu5h8hrn...@127.0.0.1, Giorgos Tzampanakis g...@hw.ac.uk wrote: I'm implementing a CPU that will run on an FPGA. I want to have a (dead) simple assembler that will generate the machine code for me. I want to use Python for that. Are there any libraries that

My four-yorkshireprogrammers contribution

2010-03-04 Thread Gregory Ewing
MRAB wrote: Mk14 from Science of Cambridge, a kit with hex keypad and 7-segment display, which I had to solder together, and also make my own power supply. I had the extra RAM and the I/O chip, so that's 256B (including the memory used by the monitor) + 256B additional RAM + 128B more in the

Re: Docstrings considered too complicated

2010-03-04 Thread Gregory Ewing
D'Arcy J.M. Cain wrote: And that is why text files in MS-DOS and CP/M before it end with ^Z. They needed a way to tell where the end of the information was. Why they used ^Z (SUB - Substitute) instead of ^C (ETX - End of TeXt) or even ^D (EOT - End Of Transmission) is anyone's guess. Well,

Re: Docstrings considered too complicated

2010-03-04 Thread Gregory Ewing
Richard Brodie wrote: It goes back to ancient PDP operating systems, so may well predate Unix, depending which exact OS was the first to use it. Yes, I think it was used in RT-11, which also had block-oriented disk files. There were two kinds of devices in RT-11, character and block, and the

Re: Docstrings considered too complicated

2010-03-04 Thread Gregory Ewing
Steve Holden wrote: Puts me in mind of Mario Wolczko's early attempts to implement SmallTalk on a VAX 11/750. The only bitmapped display we had available was a Three Rivers PERQ, connected by a 9600bps serial line. We left it running at seven o'clock one evening, and by nine am the next day it

Re: Old farts playing with their toys

2010-03-04 Thread Gregory Ewing
D'Arcy J.M. Cain wrote: Did you ever play Star Trek with sound effects? Not on that machine, but I played a version on an Apple II that had normal speaker-generated sounds. I can still remember the sound that a photon torpedo (a # character IIRC) made as it lurched its way drunkenly across

Re: Docstrings considered too complicated

2010-03-04 Thread Gregory Ewing
Steven D'Aprano wrote: True, but one can look at best practice, or even standard practice. For Python coders, using docstrings is standard practice if not best practice. Using strings as comments is not. In that particular case, yes, it would be possible to objectively examine the code and

Re: Adding to a module's __dict__?

2010-03-04 Thread Gregory Ewing
Roy Smith wrote: The idea is I want to put in the beginning of the module: declare('XYZ_FOO', 0, The foo property) declare('XYZ_BAR', 1, The bar property) declare('XYZ_BAZ', 2, reserved for future use) Okay, that seems like a passable excuse. One thing to watch out for is that if your

Re: Queue peek?

2010-03-04 Thread Gregory Ewing
Floris Bruynooghe wrote: I was just wondering if other people ever missed the q.put_at_front_of_queue() method or if it is just me. Sounds like you don't want a queue, but a stack. Or maybe a double-ended queue. -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: case do problem

2010-03-04 Thread Gregory Ewing
Peter Otten wrote: Something must be wrong with me today because I find the Pascal code /more/ readable... Actually I don't find either of them very readable. The control flow is pretty convoluted either way. It might be better if it used real-life variable and function names to give some

Re: Working group for Python CPAN-equivalence?

2010-03-04 Thread Gregory Ewing
Peter Billam wrote: A very important thing about CPAN modules is the consistent basic install method: perl Makefile.PL ; make ; make install Well, we more or less have that with Python, too: python setup.py install It may not always work smoothly, but it's the one obvious thing to try

Re: Draft PEP on RSON configuration file format

2010-03-04 Thread Gregory Ewing
Paul Rubin wrote: ReST was another solution in search of a problem. I think the basic idea behind ReST is quite good, i.e. understanding as markup various typographical conventions that make sense in plain text, such as underlined headings, bullets, numbered paragraphs. Unfortunately it went

Re: NoSQL Movement?

2010-03-04 Thread Gregory Ewing
Duncan Booth wrote: Did I mention that bigtable doesn't require you to have the same columns in every record? The main use of bigtable (outside of Google's internal use) is Google App Engine and that apparently uses one table. Not one table per application, one table total. It's a big table.

Re: Generic singleton

2010-03-04 Thread Gregory Ewing
mk wrote: Or I could make my life simpler and use global variable. :-) Indeed. You actually *have* a global variable already, you've just hidden it inside another object. That doesn't make it any less global, though. If you want to defer creation of the object until the first time it's used,

Re: Passing FILE * types using ctypes

2010-03-05 Thread Gregory Ewing
Francesco Bochicchio wrote: Python file objects have a method fileno() whic returns the 'C file descriptor', i.e. the number used by low level IO in python as well as in C. I would use this as interface between python and C and then in the C function using fdopen to get a FILE * for an already

Re: Docstrings considered too complicated

2010-03-05 Thread Gregory Ewing
Steven D'Aprano wrote: (a) Can we objectively judge the goodness of code, or is it subjective? (b) Is goodness of code quantitative, or is it qualitative? Yes, I'm not really talking about numeric vs. non-numeric, but objective vs. subjective. The measurement doesn't have to yield a numeric

Re: Draft PEP on RSON configuration file format

2010-03-05 Thread Gregory Ewing
Steven D'Aprano wrote: I use footnotes all the time[1] in plain text documents and emails. I don't think there's anything bizarre about it at all. It's not the use of footnotes I'm talking about, it's the cryptic character sequences used to mark them up in ReST. Nobody would come up with them

Re: My four-yorkshireprogrammers contribution

2010-03-05 Thread Gregory Ewing
MRAB wrote: By the standards of just a few years later, that's not so much a microcomputer as a nanocomputer! Although not quite as nano as another design published in EA a couple of years earlier, the EDUC-8: http://www.sworld.com.au/steven/educ-8/ It had a *maximum* of 256 bytes -- due

Re: Generic singleton

2010-03-05 Thread Gregory Ewing
I think the important difference between None and booleans wrt singleton behaviour is that things are often compared with None using is, so it's quite important that there only be one instance of NoneType around, and it makes sense not to give people the false impression that they can create

Re: Generic singleton

2010-03-05 Thread Gregory Ewing
Steven D'Aprano wrote: While Doubleton or even Tripleton sound cute, once you get to large counts it all starts getting ugly and horrible. Polyton? Blah. Tupleton? -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Reverse engineering CRC?

2010-03-07 Thread Gregory Ewing
Given some known data/crc pairs, how feasible is it to figure out the polynomial being used to generate the crc? In the case I'm looking at, it appears that the crc size may be at least 24 bits, so just trying all possible polynomials probably isn't doable. An article I found hints at the

Re: Reverse engineering CRC?

2010-03-08 Thread Gregory Ewing
Steven D'Aprano wrote: Can you just ask the application developer what CRC is being used? Or look at the source code? Disassemble the binary? There's no source, and the binary is enormous. I could ask, but I wouldn't hold out much hope of them being willing to tell me. it appears that the

Re: Reverse engineering CRC?

2010-03-08 Thread Gregory Ewing
Dave Angel wrote: If you know so little about the value, how do you even know it's a CRC ? Could it be a ones-complement sum, such as used in Ethernet? I'm going by the fact that the application reports a CRC mismatch when it's wrong. I can't be sure that what it calls a CRC is really a true

Re: negative counts in collections.Counter?

2010-03-08 Thread Gregory Ewing
Raymond Hettinger wrote: Instead the choice was to implement the four methods as multiset operations. As such, they need to correspond to regular set operations. Seems to me you're trying to make one data type do the work of two, and ending up with something inconsistent. I think you should

Re: Reverse engineering CRC?

2010-03-09 Thread Gregory Ewing
Dave Angel wrote: If you assume it's done in a single pass, and you know which byte is the end of the buffer, I'd think you could learn a lot by just tweaking that last byte. I'm sure I would, but unfortunately I can't control the last byte. The bytes that I can influence are some distance

Re: Reverse engineering CRC?

2010-03-11 Thread Gregory Ewing
Steve Howell wrote: Hi Greg. I would at least flip one bit at a time on the first byte of your data to see if the transformation is bitwise. I'm actually making good progress on this -- it turns out there *is* a way of deducing the polynomial by looking at the effect of single-bit flips.

Re: Reverse engineering CRC?

2010-03-12 Thread Gregory Ewing
Lawrence D'Oliveiro wrote: They could be using a strong cryptographic hash and truncating it to 16 bits or something. In which case you’ve got your work cut out for you... Nope, I've determined that it's actually a pretty standard CRC, and it's even using one of the standard polynomials,

Re: GUIs - A Modest Proposal

2010-06-11 Thread Gregory Ewing
Stephen Hansen wrote: There's very little you can do with pywin32 that you can't do with ctypes. Except, apparently, use it from another module in the stdlib. :-( -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: GUIs - A Modest Proposal

2010-06-11 Thread Gregory Ewing
Steven D'Aprano wrote: This reminds me of time-travellers suffering from time lag in the wonderful novel To Say Nothing Of The Dog by Connie Willis. One of the many excellent reasons why Guido keeps tight control over the keys to his time machine. Time-lagged joyriding teenagers careening

Re: GUIs - A Modest Proposal

2010-06-12 Thread Gregory Ewing
Terry Reedy wrote: Would it be possible to write a program that converts a module that uses ctypes to interface to a dll to a corresponding C extension program that would compile to a drop in replacement extension module? Probably, but I don't see how that could be done automatically in a

Re: safer ctype? (was GUIs - A modest Proposal)

2010-06-12 Thread Gregory Ewing
On Jun 12, 6:05 pm, Stephen Hansen me+list/pyt...@ixokai.io wrote: A programming goof, oversight or unexpected event causes an exception. It doesn't cause a buffer overflow. The important thing here isn't so much the exception as the *traceback*. When you've been programming in Python for a

Re: GUIs - A Modest Proposal

2010-06-12 Thread Gregory Ewing
lkcl wrote: * in neither gtk nor qt does there exist an auto-layout widget that's equivalent to putting some span / DOM objects into a div /, to flow widgets that wrap around. You essentially seem to be complaining here that pqyqt and pygtk are not HTML. They have their own auto-layout

Re: safer ctype? (was GUIs - A modest Proposal)

2010-06-12 Thread Gregory Ewing
Stephen Hansen wrote: Its one thing for Python to make available foot-shooting tools(this is good! I love ctypes, with care) for the developer, its another thing entirely for it to shoot at the ground in the normal course of its operation and hope it doesn't blow off any big toes. :) I would

Re: GUIs - A Modest Proposal

2010-06-15 Thread Gregory Ewing
Stephen Hansen wrote: unless I've been long mistaken in pack not having a proportional option. A combination of fill/expand and anchor do most of everything else, though, that wx's flags and alignment options. It's a while since I used tkinter, but if I recall correctly, the grid manager does

Re: Printing forms and labels in Python

2010-06-17 Thread Gregory Ewing
Monte Milanuk wrote: Opening Adobe Reader as a sort of 'print preview' might be a workable solution. Or if you think Acrobat Reader sucks too much, Foxit Reader is a nice, lightweight alternative: http://www.foxitsoftware.com/pdf/reader/reader3.php -- Greg --

Re: introducing Lettuce, BDD tool for python with Django integration

2010-06-19 Thread Gregory Ewing
Steven D'Aprano wrote: I assume the one you're talking about is Behaviour Driven Development. Wikipedia defines it as: BDD is a second-generation, outside-in, pull-based, multiple-stakeholder, multiple-scale, high-automation, agile methodology. It describes a cycle of

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread Gregory Ewing
Thomas Jollans wrote: Everything is an object in both languages, or so they say. That's really a meaningless statement, because it depends on what you count as a thing. But there is at least one thing that is an object in Python but not in Ruby. There are no stand-alone functions in Ruby, or

Re: Should I Learn Python or Ruby next?

2010-06-24 Thread Gregory Ewing
Jean-Michel Pichavant wrote: (that makes me think that Perl should be renamed as it outrageously share the same 1st character with Python). +1. I suggest CalcifiedMolluscSecretion. The very awkwardness of that name will doom the language to the obscurity that it deserves relative to the One

Re: Pythonic Idiom For Searching An Include Path

2010-06-24 Thread Gregory Ewing
Tim Daneliuk wrote: If 'includefile' contains one or more path separator characters, ignore 'FOOPATH'. Are you sure that's exactly what you want? Usually with such things the distinction is absolute vs. relative, not whether there is more than one pathname component. E.g. in a C file,

Re: Why Is Escaping Data Considered So Magical?

2010-06-28 Thread Gregory Ewing
Carl Banks wrote: Indeed, strncpy does not copy that final NUL if it's at or beyond the nth element. Probably the most mind-bogglingly stupid thing about the standard C library, which has lots of mind-boggling stupidity. I don't think it was as stupid as that back when C was designed. Every

Re: Python dynamic attribute creation

2010-07-02 Thread Gregory Ewing
WANG Cong wrote: If you think setattr() is as ordinary as a trivial assignment, I will argue with you, this is personal taste. To my way of thinking, getattr() and setattr() are the fundamental way of accessing attributes in Python. The dot notation is just syntactic sugar for the

Re: Python dynamic attribute creation

2010-07-02 Thread Gregory Ewing
WANG Cong wrote: Yeah, my point is why setattr() for dynamic attributes while assignments for static attributes? I think there may be a misunderstanding here. You seem to be thinking of dynamic attribute vs. static attribute as the distinction between creating a new attribute and modifying an

Re: Python dynamic attribute creation

2010-07-02 Thread Gregory Ewing
WANG Cong wrote: When I talked about OOP, it is general OOP, not related with any concrete programming languages. There isn't really any such thing, though. There is no universally agreed set of features that a language must have in order to be considered OOP. Arguments of the form Language

Re: Python dynamic attribute creation

2010-07-02 Thread Gregory Ewing
WANG Cong wrote: However, I think setattr() is a builtin function, using it exposes the *magic* of metaprogramming (or class-programming, if more correct) at a first glance. But, in Python, creating instance variables is *not* class-programming. It doesn't touch the class at all. In many OO

Re: delegation pattern via descriptor

2010-07-03 Thread Gregory Ewing
Bruno Desthuilliers wrote: kedra marbun a écrit : if we limit our discussion to py: why __{get|set|delete}__ don't receive the 'name' 'class' from __{getattribute|{set|del}attr}__ 'name' is the name that is searched While it would have been technically possible, I fail to imagine any use

  1   2   3   4   5   6   7   8   9   10   >