Re: Python -- (just) a successful experiment?

2005-08-08 Thread Paul Rubin
Kay Schluehr [EMAIL PROTECTED] writes: Having a good FFI is certainly an important feature but Python programs should first and foremost be Python programs. Python was originally created as an extension language for C. In some sense it is an abstraction layer for C libs. I'd have to

Re: Python -- (just) a successful experiment?

2005-08-08 Thread Paul Rubin
Cliff Wells [EMAIL PROTECTED] writes: The second presentation (I don't recall the speaker's name) specifically covered metaprogramming (writing DSLs) and one of the things I found interesting was that despite Ruby having far more syntax than Python in general, the resulting Ruby-based DSLs

Re: Decline and fall of scripting languages ?

2005-08-08 Thread Paul Rubin
Donn Cave [EMAIL PROTECTED] writes: I'm not sure what you mean by that about OCAML. That its functional model is not pure enough? I'd like to look at Haskell as well, but I have the impression that its implementation is not as serious as OCaml's, i.e. no native-code compiler. On the

Re: python for microcontrollers

2005-08-08 Thread Paul Rubin
Evil Bastard [EMAIL PROTECTED] writes: Yes, this approach sucks. But can anyone offer any suggestions which suck less? I don't think you want to do this. Runtime type tags and the overhead of checking them on every operation will kill you all by themselves. Processors like that haven't been

Re: Decline and fall of scripting languages ?

2005-08-08 Thread Paul Rubin
Mike Meyer [EMAIL PROTECTED] writes: Well, I tried sending this via email, but I can't derive a valid address from Paul's anti-spammed address. Yeah, I should update that url since they turned off the forwarding. It should be http://paulrubin.com. But a thread titled decline and fall of

Re: signals (again)

2005-08-10 Thread Paul Rubin
bill [EMAIL PROTECTED] writes: What's the pythonic thing to do here? How can I guarantee timely response to the creation of a file in the directory referenced by fd? Use asynchronous calls and/or a separate thread. -- http://mail.python.org/mailman/listinfo/python-list

Re: Running one Python program from another as a different user

2005-08-12 Thread Paul Rubin
[EMAIL PROTECTED] [EMAIL PROTECTED] writes: This is on Linux... I have a daemon running as root and I want to execute another Python program as another user (a regular user). I have the name of the user and can use the 'pwd' and 'grp' modules to get that user's user and group ids. What I don't

Re: Writing a small battleship game server in Python

2005-08-12 Thread Paul Rubin
Michael Goettsche [EMAIL PROTECTED] writes: Assuming the server accepts connections in an endless loop, how would I handle communication without additional threads and create new games in that loop? Could you give me pseudo-code for this? I've always done this kind of thing with the

Re: FTP over SSL (explicit encryption)

2005-08-14 Thread Paul Rubin
David Isaac [EMAIL PROTECTED] writes: Just found this: http://trevp.net/tlslite/ I haven't even had time to try it, but I thought you'd want to know. Tlslite is a very well done and promising package, but in its present form it's not really complete. It's missing important functionality (the

Re: GUI tookit for science and education

2005-08-14 Thread Paul Rubin
Mateusz £oskot [EMAIL PROTECTED] writes: Thank you for any piece of advice in advance. Ask yourself why you want a GUI toolkit. Maybe you can write a web application instead, and use a browser as the GUI. That's a lot easier to write (just use html), and makes it trivial to run the application

Re: Decline and fall of scripting languages ?

2005-08-16 Thread Paul Rubin
[EMAIL PROTECTED] (Bengt Richter) writes: built-in concurrency support. OCaml seems to crush Haskell and Erlang (and even Java) in performance. Occam isn't used for much practical any more, but takes a purist approach to concurrency that seems worth studying. IIRC, I've seen something about

Re: Decline and fall of scripting languages ?

2005-08-16 Thread Paul Rubin
Paul Rubin http://[EMAIL PROTECTED] writes: So I think a (maybe not achievable) performance goal is for the web app to use 50% of the available cycles making html, and the other 50% go to gzipping the html. That means that the app should make dynamic output as fast as gzip can compress

Re: Bitwise operations in Python?

2005-08-18 Thread Paul Rubin
Carl [EMAIL PROTECTED] writes: IBITS(I, POS, LEN) Extracts a sequence of bits. The result has the value of the sequence of LEN bits in I beginning at bit POS, right-adjusted and with all other bits zero. The bits are numbered from 0 to BIT_SIZE(I)-1, from right to left. Examples IBITS

Re: determine variable type

2005-08-18 Thread Paul Rubin
[EMAIL PROTECTED] writes: i tried using type(var) but that only seemed to produce a response in the command line. is there a built in python function to determine if a variable is an integer? type(var) returns the type. For example: if type(x) == type(3): print 'x is an

Re: global interpreter lock

2005-08-19 Thread Paul Rubin
km [EMAIL PROTECTED] writes: is true parallelism possible in python ? or atleast in the coming versions ? is global interpreter lock a bane in this context ? http://poshmodule.sf.net -- http://mail.python.org/mailman/listinfo/python-list

Re: global interpreter lock

2005-08-19 Thread Paul Rubin
Robin Becker [EMAIL PROTECTED] writes: http://poshmodule.sf.net Is posh maintained? The page mentions 2003 as the last date. Dunno, and I suspect not. I've been wondering about it myself. -- http://mail.python.org/mailman/listinfo/python-list

Re: while c = f.read(1)

2005-08-19 Thread Paul Rubin
[EMAIL PROTECTED] writes: import itertools f = open(blah.txt, r) for c in itertools.chain(*f): print c # ... The f is iterable itself, yielding a new line from the file every time. Lines are iterable as well, so the itertools.chain iterates through each line and yields a

Re: Sandboxes

2005-08-20 Thread Paul Rubin
42 [EMAIL PROTECTED] writes: Googling for information on securing Python in a sandbox seems indicate that there are some built in features, but they aren't really trustworthy. Is that correct? Yes. For my purposes, I really just want to let users run in a sandbox, with access to only the

Re: Sandboxes

2005-08-20 Thread Paul Rubin
42 [EMAIL PROTECTED] writes: I want the 'worst case' a malicious script to be able to accompish to be a program crash or hang. You should not rely on Python to provide any kind of security from malicious users who can run Python scripts. --

Re: Well, another try Re: while c = f.read(1)

2005-08-20 Thread Paul Rubin
Robert Kern [EMAIL PROTECTED] writes: http://www.catb.org/~esr/faqs/smart-questions.html Is it a *smart* way or *necessary* way? It's the polite way. And probably the only way you're going to get your questions actually answered. I wonder if there's a way to killfile posts that contain

Re: global interpreter lock

2005-08-20 Thread Paul Rubin
Mike Meyer [EMAIL PROTECTED] writes: Even simpler to program in is the model used by Erlang. It's more CSP than threading, though, as it doesn't have shared memory as part of the model. But if you can use the simpler model to solve your problem - you probably should. Well, ok, the Python

Re: Well, another try Re: while c = f.read(1)

2005-08-20 Thread Paul Rubin
James Sungjin Kim [EMAIL PROTECTED] writes: Now I realized that Command 'lambda' is a similar to Command 'inline' in C++. In addition, Command 'iter' is something new but not much new to c engineers, since it is related to 'for loops', e.g., Actually not related at all. Nothing like lambda or

Re: urllib leaves sockets open?

2005-08-20 Thread Paul Rubin
Chris Tavares [EMAIL PROTECTED] writes: Is this normal behavior for urllib? Is there a way to force that initial socket closed earlier? Is there something else I need to do? I'd say open a sourceforge bug. There may be a way around it with the fancy opener methods of urllib2, but it's a bug if

Re: Proposed PEP: New style indexing, was Re: Bug in slice type

2005-08-21 Thread Paul Rubin
Bryan Olson [EMAIL PROTECTED] writes: seq[3 : -4] we write: seq[3 ; $ - 4] +1 When square-brackets appear within other square-brackets, the inner-most bracket-pair determines which sequence '$' describes. (Perhaps '$$' should be the length of the next containing bracket

Re: while c = f.read(1)

2005-08-21 Thread Paul Rubin
Reinhold Birkenfeld [EMAIL PROTECTED] writes: Don't forget for line in f: for c in line: # do stuff As mentioned before, that's careless programming, since it can read the whole file into memory if the file contains no newlines. --

Re: urllib leaves sockets open?

2005-08-21 Thread Paul Rubin
Chris Tavares [EMAIL PROTECTED] writes: Is there a way to do HTTP 1.1 with urllib? The docs say 0.9 and 1.0 only. I'm not sure. Try urllib2, but I'm still not sure. -- http://mail.python.org/mailman/listinfo/python-list

Re: while c = f.read(1)

2005-08-22 Thread Paul Rubin
Greg McIntyre [EMAIL PROTECTED] writes: while c = f.read(1): # ... I couldn't find any general PEPs along these lines, only specific ones (e.g. 308 re. an if-then-else expression). I often end up doing something like this: class foo: def set(self, x): self.x = x

Re: Python for Webscripting (like PHP)

2005-08-22 Thread Paul Rubin
Fredrik Lundh [EMAIL PROTECTED] writes: (Python has even been told to be used by Yahoo! and Google, among others, but nobody was able to demonstrate this, so far) hint: http://mail.google.com/support/bin/answer.py?answer=6554 I don't see anything about Python at that url. I've heard

shelve non-transparency

2005-08-24 Thread Paul Rubin
class x: pass z = x() z.a = 'a' d = {'a': z} for i in range(5): print id(d['a']) prints the same id 5 times as you'd expect. d = shelve('filename') d['a'] = z for i in range(5): print id(d['a']) prints five different id's. So, for example, y =

Re: The ONLY thing that prevents me from using Python

2005-08-24 Thread Paul Rubin
Richie Hindle [EMAIL PROTECTED] writes: I can't speak for linode.org, but I have a Xen VPS from rimuhosting.com and it's early days but so far I've been very impressed. It's $19/mo (normally $20 but they kindly gave me a 5% Open Source Developer discount) Do you get enough resources in that

Re: Bug in string.find; was: Re: Proposed PEP: New style indexing, was Re: Bug in slice type

2005-08-25 Thread Paul Rubin
Steve Holden [EMAIL PROTECTED] writes: As far as position reporting goes, it seems pretty clear that find() will always report positive index values. In a five-character string then -1 and 4 are effectively equivalent. What on earth makes you call this a bug? And what are you proposing that

Re: Jargons of Info Tech industry

2005-08-25 Thread Paul Rubin
Mike Meyer [EMAIL PROTECTED] writes: Another advantage is that evewry internet-enabled computer today already comes with an HTML renderer (AKA browser) No, they don't. Minimalist Unix distributions don't include a browser by default. I know the BSD's don't, and suspect that gentoo Linux

Re: Better crypto hash functions, long, with code

2005-08-26 Thread Paul Rubin
Nice. Note that the Sourceforge bug for this issue indicates that something is already being done about it. It just happens to have been updated a day or so ago: https://sourceforge.net/tracker/?func=detailatid=355470aid=1123660group_id=5470 Note to skeptics: the attacks are pretty serious.

Re: Better crypto hash functions, long, with code

2005-08-26 Thread Paul Rubin
Bryan Olson [EMAIL PROTECTED] writes: The module provides classes and functions. The functions are: string_to_hex(str): Return a string with two hex digits for each byte of str, representing the ord() of the byte. The case of the hex digits A-F/a-f is up to Python's built-in

Re: Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type

2005-08-26 Thread Paul Rubin
Terry Reedy [EMAIL PROTECTED] writes: I agree in this sense: the use of any int as an error return is an unPythonic *nix-Cism, which I believe was copied therefrom. Str.find is redundant with the Pythonic exception-raising str.index and I think it should be removed in Py3. I like having

Re: Any projects to provide Javascript-style client-side browser access via Python?

2005-08-26 Thread Paul Rubin
Kenneth McDonald [EMAIL PROTECTED] writes: I'm curious about this because, quite aside their function as web browsers, it is now possible to build some very useable interfaces using browsers with HTML, CSS, and JavaScript. (The biggest problem is still the lack of a decent text widget.)

Re: Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type

2005-08-26 Thread Paul Rubin
Terry Reedy [EMAIL PROTECTED] writes: The try/except pattern is a pretty basic part of Python's design. One could say the same about clutter for *every* function or method that raises an exception on invalid input. Should more or even all be duplicated? Why just this one? Someone must

Re: global interpreter lock

2005-08-26 Thread Paul Rubin
[EMAIL PROTECTED] (phil hunt) writes: Let's see. Reality is that writing correct programs is hard. Writing correct programs that use concurrency is even harder, because of the exponential explosion of the order that operations can happen in. Personally, I'm willing to use anything I can find

Re: Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type

2005-08-26 Thread Paul Rubin
Steve Holden [EMAIL PROTECTED] writes: Of course. But onc you (sensibly) decide to use an if then there really isn't much difference between -1, None, () and sys.maxint as a sentinel value, is there? Of course there is. -1 is (under Python's perverse semantics) a valid subscript. sys.maxint

Re: Bug in string.find; was: Re: Proposed PEP: New style indexing, was Re: Bug in slice type

2005-08-26 Thread Paul Rubin
Steve Holden [EMAIL PROTECTED] writes: If you want an exception from your code when 'w' isn't in the string you should consider using index() rather than find. The idea is you expect w to be in the string. If w isn't in the string, your code has a bug, and programs with bugs should fail as

Re: Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type

2005-08-27 Thread Paul Rubin
Steve Holden [EMAIL PROTECTED] writes: A corrected find() that returns None on failure is a five-liner. If I wanted to write five lines instead of one everywhere in a Python program, I'd use Java. -- http://mail.python.org/mailman/listinfo/python-list

Re: python image thumbnail generator?

2005-08-27 Thread Paul Rubin
Chris Dewin [EMAIL PROTECTED] writes: (1) Can this be done with python? If so, what module do I need to look up? You could do it with PIL, or run jpegtran in an external process. jpegtran may be easier. -- http://mail.python.org/mailman/listinfo/python-list

Re: OpenSource documentation problems

2005-08-29 Thread Paul Rubin
Adriaan Renting [EMAIL PROTECTED] writes: He seems to think the GNU man pages are nice, but I find them very awkward as they have no hierarchical organization, and most miss examples. The GNU man pages are an afterthought to meet expectations of Un*x users who were used to man pages and the man

Re: python image thumbnail generator?

2005-08-29 Thread Paul Rubin
Fredrik Lundh [EMAIL PROTECTED] writes: You could do it with PIL, or run jpegtran in an external process. jpegtran may be easier. eh? are you sure you know what jpegtran does? JPEGTRAN(1) Whoops, sorry, right, jpegtran is for rotating the images. I meant: use a pipeline like

Re: Using select on a unix command in lieu of signal

2005-08-29 Thread Paul Rubin
rh0dium [EMAIL PROTECTED] writes: Thanks much - Alternatively if anyone else has a better way to do what I am trying to get done always looking for better ways. I still want this to work though.. You don't have to use select, since you can use timeouts with normal socket i/o. So you could

Re: Writing Multithreaded Client-Server in Python.

2005-08-29 Thread Paul Rubin
Sidd [EMAIL PROTECTED] writes: I tried finding and example of multithreaded client-serve program in python. Can any one please tell me how to write a multithreaded client-server programn in python such that 1.It can handle multiple connections 2.It uses actual threads and not select() or

Re: Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type

2005-08-30 Thread Paul Rubin
Terry Reedy [EMAIL PROTECTED] writes: The fact that the -1 return *has* lead to bugs in actual code is the primary reason Guido has currently decided that find and rfind should go. A careful review of current usages in the standard library revealed at least a couple bugs even there. Really

Re: Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type

2005-08-30 Thread Paul Rubin
Terry Reedy [EMAIL PROTECTED] writes: Really it's x[-1]'s behavior that should go, not find/rfind. I complete disagree, x[-1] as an abbreviation of x[len(x)-1] is extremely useful, especially when 'x' is an expression instead of a name. There are other abbreviations possible, for example

Re: Writing Multithreaded Client-Server in Python.

2005-08-30 Thread Paul Rubin
[EMAIL PROTECTED] writes: What it does do, is handle each request (from the same client too) in a new separate thread. Convenient if your processing intensive handle may otherwise slow down the main server process becoming less responsive to other requests. What it doesn't do (and what Sidd

Re: Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type

2005-08-30 Thread Paul Rubin
Bryan Olson [EMAIL PROTECTED] writes: Specifically, to support new-style slicing, a class that accepts index or slice arguments to any of: __getitem__ __setitem__ __delitem__ __getslice__ __setslice__ __delslice__

Re: array of arrays question

2005-08-30 Thread Paul Rubin
Meo [EMAIL PROTECTED] writes: Somebody understand what's going on here? Yes, []*3 gives you three references to the same empty list, not three separate empty lists. You need something like [[] for i in xrange(3)] to get separate lists. Another example: a = [1,2,3] b = a a[0]

Re: micro-python - is it possible?

2005-08-30 Thread Paul Rubin
Evil Bastard [EMAIL PROTECTED] writes: Has anyone done any serious work on producing a subset of python's language definition that would suit it to a tiny microcontroller environment? We just had this thread a few weeks ago and you decided to use FORTH that time. The answers are the same this

Re: can't start new thread

2005-08-31 Thread Paul Rubin
jdonnell [EMAIL PROTECTED] writes: This script has worked without a problem for months, but I did make some changes recently. I don't see how those changes would cause this error though. It's also on a VPS so it's possible that they changed something in the OS. Does anyone have any suggestions

Re: OpenSource documentation problems

2005-08-31 Thread Paul Rubin
Michael Sparks [EMAIL PROTECTED] writes: A plausible theory. I have some possibly-illustrative examples of what I ran into within the last few weeks. hypothetical Did you take what you learnt, and use that to create better documentation to be posted on python's SF project as a patch?

Re: global interpreter lock

2005-09-01 Thread Paul Rubin
Mike Meyer [EMAIL PROTECTED] writes: Sure. I tried to be helpful there, but maybe I need to be more specific. The ref from my previous post, Google-able as The C10K problem is good but now a little dated. That appears to be a discussion on squeezing the most out of a network server,

Re: 'isa' keyword

2005-09-01 Thread Paul Rubin
talin at acm dot org [EMAIL PROTECTED] writes: membership within a container -- instead we're testing for membership with a type hierarchy, where 'type' can be defined to mean whatever the programmer wants. Well, if type means a (possibly infinite) set of objects, then you can use in. E.g, 3

Re: Decrypting GPG/PGP email messages

2005-09-01 Thread Paul Rubin
Alessandro Bottoni [EMAIL PROTECTED] writes: 1) What would you use to decrypt the messages? The GPG module created by Andrew Kuchling is declared incomplete and no more maintained on his web pages (http://www.amk.ca/python/code/gpg) so I think it is out of the game. I think I'd just run gpg

Re: OpenSource documentation problems

2005-09-01 Thread Paul Rubin
Fredrik Lundh [EMAIL PROTECTED] writes: another problem is that to be able to do really good work on the documentation, you need to know things well enough to have the big picture. and once you have that, you'll find that the docs aren't really as bad as you once thought they were. One thing

Re: Writing Multithreaded Client-Server in Python.

2005-09-01 Thread Paul Rubin
[EMAIL PROTECTED] writes: I suspect he was trying to say that BaseHTTPServer has no mechanism for handling state. As you know, of course, this is most relevant across multiple successive connections to a server from the same client, and has little to do with threads. Usually you would do

Re: Bug in string.find

2005-09-01 Thread Paul Rubin
Ron Adam [EMAIL PROTECTED] writes: All of the following get the center 'd' from the string. a = 'abcdefg' print a[3] # d 4 gaps from beginning print a[-4]# d 5 gaps from end print a[3:4] # d print a[-4:-3] # d print a[-4:4] # d print a[3:-3] # d

Re: OpenSource documentation problems

2005-09-01 Thread Paul Rubin
Fred L. Drake, Jr. [EMAIL PROTECTED] writes: Ideally, emails to docs at python.org would result in issues being created somewhere, simply so they don't get lost. It probably doesn't make sense for those to land in SourceForge automatically, since then everyone has to read every plea for a

Re: OpenSource documentation problems

2005-09-02 Thread Paul Rubin
Michael Sparks [EMAIL PROTECTED] writes: I've submitted a number of doc bugs to sourceforge and the ones that are simple errors and omissions do get fixed. Cool. Better than nothing, but it's only one class of problem, and maybe the easiest kind to report. There's another type of doc

Re: Find day of week from month and year

2005-09-02 Thread Paul Rubin
Laguna [EMAIL PROTECTED] writes: I want to find the expiration date of stock options (3rd Friday of the month) for an any give month and year. I have tried a few tricks with the functions provided by the built-in module time, but the problem was that the 9 element tuple need to be populated

Re: OpenSource documentation problems

2005-09-02 Thread Paul Rubin
[EMAIL PROTECTED] writes: Also, not that long ago must mean different things for different people. I think we've required logins for three years or more. I hope you're not right and that it hasn't really been that long. Yikes ;-). -- http://mail.python.org/mailman/listinfo/python-list

Re: Find day of week from month and year

2005-09-02 Thread Paul Rubin
Peter Hansen [EMAIL PROTECTED] writes: (And, if I were optimizing, I would of course dispense with the dynamic creation of the static table upon every execution of expiration(), and move it outside the function.) Replacing it with a tuple might be enough for that. --

Re: Decrypting GPG/PGP email messages

2005-09-03 Thread Paul Rubin
Alessandro Bottoni [EMAIL PROTECTED] writes: I'm going to use my own implementation of OTP because the existing mechanism are devoted to protect the remote login channel and cannot be easily adapted to my weird e-mail-based mechanism. Anyway, I'm going to use a (encrypted) very long

Re: Submitting doc bug reports without SF registration

2005-09-03 Thread Paul Rubin
Terry Reedy [EMAIL PROTECTED] writes: 1. A DocImprovement wiki. People could optionally sign up for update reports on specific wiki pages. 2. A new SF tracker, only for doc bugs, that would accept anonymous submissions. The other trackers require login because most items need

Re: OpenSource documentation problems

2005-09-04 Thread Paul Rubin
Steve Holden [EMAIL PROTECTED] writes: legitimate. Python's core developers are in a leadership position for Python whether they like it or not; and users and volunteers absorb the attitudes of the leaders. So, what you are saying is because the developers (I explain in another post on

Re: Code for generating validation codes (in images)

2005-09-04 Thread Paul Rubin
morphex [EMAIL PROTECTED] writes: does anyone of you know of some code I can use to generate validation code images? Those images you can see on various login forms used to prevent bots for performing a brute-force attack.. http://en.wikipedia.org/wiki/CAPTCHA --

Re: dual processor

2005-09-04 Thread Paul Rubin
John Brawley [EMAIL PROTECTED] writes: However, the thought occurs that Python (2.4.1) may not have the ability to take advantage of the dual processors, so my question: Does it? No. If not, who knows where there might be info from people trying to make Python run 64-bit, on multiple

Re: dual processor

2005-09-04 Thread Paul Rubin
Jeremy Jones [EMAIL PROTECTED] writes: to pass data around between processes. Or an idea I've been tinkering with lately is to use a BSD DB between processes as a queue just like Queue.Queue in the standard library does between threads. Or you could use Pyro between processes. Or CORBA. I

Re: Magic Optimisation

2005-09-04 Thread Paul Rubin
[EMAIL PROTECTED] writes: However, it is very ugly. Does anyone have any tips on how I could get this optimisation to occor magically, via a decorator perhaps? Have you tried psyco? -- http://mail.python.org/mailman/listinfo/python-list

Re: Magic Optimisation

2005-09-04 Thread Paul Rubin
[EMAIL PROTECTED] writes: My use case involves 1000 iterators, so psyco is not much help. It doesn't solve the magic creation of locals from instance vars either. How about using __slots__ to put those instance vars at fixed offsets in the pool object (self then needs to be a new-style class

Re: Job Offer in Paris, France : RD Engineer (Plone)

2005-09-05 Thread Paul Rubin
Huron [EMAIL PROTECTED] writes: Sopinspace, Society For Public Information Spaces (specialized in Web-based citizen public debate and collaborative initiatives) is looking for a new developer / RD engineer with strong Plone focus. The position is located in Paris, France (11eme). All

Re: Subclassing socket

2006-01-13 Thread Paul Rubin
[EMAIL PROTECTED] writes: I would like to create a subclass of socket that fixes the problem. The socket module is in a messy state right now and subclassing sockets doesn't work for implementation-specific reasons besides the issue you described. Take a look at socket.py to see the situation.

Re: Dynamically changing button text in python

2006-01-14 Thread Paul Rubin
[EMAIL PROTECTED] writes: for example,can we do something like this: curButton.bind(Button-1,self.StopServer) def StopServer(self,event): curButton[text] = Start Server Yes. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is 'everything' a refrence or isn't it?

2006-01-14 Thread Paul Rubin
Mike Meyer [EMAIL PROTECTED] writes: Whether the '==' operation conforms to your idea of what equality means is unclear. Care to say what it does mean, then? class boffo(int): def __eq__(x,y): return True a,b = boffo(2), boffo(3) print a+b, a==b, (a+2)==(b+2) I'd say

Re: Dynamically changing button text in python

2006-01-15 Thread Paul Rubin
[EMAIL PROTECTED] writes: The problem is once i set the textvariable property of the button,i cannot change the text.For example, curButton = Button(root,text=Stop Server,textvariable=this) 1. I don't think you can use text and textvariable at the same time. 2. I don't think you're using

Re: Is 'everything' a refrence or isn't it?

2006-01-15 Thread Paul Rubin
Mike Meyer [EMAIL PROTECTED] writes: I'd say a==b doesn't necessarily mean a and b have the same value. Care to say what it does mean (as opposed to what it doesn't mean), then? a==b simply means that a.__eq__(b) returns True. -- http://mail.python.org/mailman/listinfo/python-list

Re: On Numbers

2006-01-15 Thread Paul Rubin
Mike Meyer [EMAIL PROTECTED] writes: I'd like to work on that. The idea would be that all the numeric types are representations of reals with different properties that make them appropriate for different uses. 2+3j? -- http://mail.python.org/mailman/listinfo/python-list

Re: Marshal Obj is String or Binary?

2006-01-15 Thread Paul Rubin
Mike [EMAIL PROTECTED] writes: Correct. I didn't quite see the issue as assembly vs. python, having direct translation to programming hours I figured the day I upgrade my python, I would write a python script to upgrade the data. I take my word back. Writing that script sounds potentially

proposal: another file iterator

2006-01-15 Thread Paul Rubin
I find pretty often that I want to loop through characters in a file: while True: c = f.read(1) if not c: break ... or sometimes of some other blocksize instead of 1. It would sure be easier to say something like: for c in f.iterbytes(): ... or for c in

Re: proposal: another file iterator

2006-01-15 Thread Paul Rubin
Jean-Paul Calderone [EMAIL PROTECTED] writes: Which is only very slightly longer than your version. I would like it even more if iter() had been written with the impending doom of lambda in mind, so that this would work: for chunk in iter('', f.read, blocksize): ... But it's

Re: Arithmetic sequences in Python

2006-01-16 Thread Paul Rubin
Gregory Petrosyan [EMAIL PROTECTED] writes: As you can see, PEP 204 was rejected, mostly because of not-so-obvious syntax. But IMO the idea behind this pep is very nice. So, maybe there's a reason to adopt slightly modified Haskell's syntax? I like this with some issues: Python loops tend to

OT: excellent book on information theory

2006-01-16 Thread Paul Rubin
I came across this while looking up some data compression info today. David J.C. MacKay Information Theory, Inference, and Learning Algorithms Full text online: http://www.inference.phy.cam.ac.uk/mackay/itila/ It's a really excellent book, on the level of SICP but about

Re: Arithmetic sequences in Python

2006-01-16 Thread Paul Rubin
Steven D'Aprano [EMAIL PROTECTED] writes: For finite sequences, your proposal adds nothing new to existing solutions like range and xrange. Oh come on, [5,4,..0] is much easier to read than range(5,-1,-1). The only added feature this proposal introduces is infinite iterators, and they aren't

Re: OT: excellent book on information theory

2006-01-16 Thread Paul Rubin
Grant Edwards [EMAIL PROTECTED] writes: That made me smile on a Monday morning (not an insignificant accomplishment). I noticed in the one footnote that the H.P. book had been translated into American. I've always wondered about that. I noticed several spots in the H.P. books where the

Re: Arithmetic sequences in Python

2006-01-16 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: Oh come on, [5,4,..0] is much easier to read than range(5,-1,-1). But not easier than reversed(range(6)) Heh, I like that, and reversed(xrange(6)) appears to do the right thing too. I didn't know about __reversed__ before. [[the 5 in one of the

Re: OT: excellent book on information theory

2006-01-16 Thread Paul Rubin
Tim Peters [EMAIL PROTECTED] writes: For example, I think the Japanese translator deserves a Major Award for their heroic attempt to translate Ron's Uranus pun: http://www.cjvlang.com/Hpotter/wordplay/uranus.html Gad, I'm surprised that was in the original. For an absolutely amazing

Re: Arithmetic sequences in Python

2006-01-16 Thread Paul Rubin
Xavier Morel [EMAIL PROTECTED] writes: The only thing that bothers me about the initial proposal is that there would not, in fact, be any range object, but merely a syntactic sugar for list/generator creation. Well, it could create something like an xrange. Maybe that's preferable. Not

Re: Arithmetic sequences in Python

2006-01-16 Thread Paul Rubin
Gregory Petrosyan [EMAIL PROTECTED] writes: 1) both in [5,6,10] and [5,7,10] 10 is included ;-) And as for [5,6 .. 10] and [5,7 .. 10]... First one should look like [5 .. 10] I think. But you are right: it looks like a problem that in one case 10 is included and in other not. I should

Re: Arithmetic sequences in Python

2006-01-16 Thread Paul Rubin
Gregory Petrosyan [EMAIL PROTECTED] writes: 1) [f(n), f(n)-1 .. 0] can be easily catched by interpreter, and f(n) can be evaluated only once. I think it would be counterintuitive for the interpreter to do that. If I type f(n) twice I expect it to be evaluated twice. 2) if you need right

Re: StringVar() IntVar() vs. Dictionary of same

2006-01-16 Thread Paul Rubin
Bob Greschke [EMAIL PROTECTED] writes: Just roughly what do you think the effect would be? Either extremely slight or else nonexistent. -- http://mail.python.org/mailman/listinfo/python-list

Re: Web application design question (long)

2006-01-16 Thread Paul Rubin
Fried Egg [EMAIL PROTECTED] writes: (1) Has anybody done something general enough for me to use? It's sounds like you're writing a glorified version of Emacs's Dissociated Press command. DP used a simpler algorithm but the results were about the same. (3) Would anybody else be interested in

Re: Arithmetic sequences in Python

2006-01-16 Thread Paul Rubin
Tom Anderson [EMAIL PROTECTED] writes: The natural way to implement this would be to make .. a normal operator, rather than magic, and add a __range__ special method to handle it. a .. b would translate to a.__range__(b). I note that Roman Suzi proposed this back in 2001, after PEP 204 was

Re: On Numbers

2006-01-16 Thread Paul Rubin
Steven D'Aprano [EMAIL PROTECTED] writes: So I don't really know what point you are making. What solution(s) for 1**0.5 were you expecting? I think it was a sly way of saying plus one or minus one. -- http://mail.python.org/mailman/listinfo/python-list

Re: Arithmetic sequences in Python

2006-01-16 Thread Paul Rubin
Dennis Lee Bieber [EMAIL PROTECTED] writes: What would be expected from [1, 3, 6 .. 20] ??? In Haskell: Hugs.Base [1,3,6..20] ERROR - Syntax error in expression (unexpected `..') Hugs.Base Again, I see [1, 3, 6, 7, 8, 9, 10, ... , 18, 19] You'd write that in

Re: magical expanding hash

2006-01-16 Thread Paul Rubin
braver [EMAIL PROTECTED] writes: I need a magical expanding hash with the following properties: ... I have such a class in ruby. Can python do that? Python's built-in dict objects don't do that but you could write such a class pretty straightforwardly. --

Re: Arithmetic sequences in Python

2006-01-17 Thread Paul Rubin
Gregory Petrosyan [EMAIL PROTECTED] writes: 2) [5 .. 0] - [5,4,3,2,1,0] So, if next is omited, let the default step be 1 if first last and -1 otherwise. So what do you want [a..b] to do? Dynamically decide what direction to go? Ugh! -- http://mail.python.org/mailman/listinfo/python-list

Re: magical expanding hash

2006-01-17 Thread Paul Rubin
Diez B. Roggisch [EMAIL PROTECTED] writes: BTW: remember that setdefault() is written setdefault() but it's read getorset(). I can only second that. The misleading name has - well, mislead me :) Hmm, x[a][b][c][d] = e# x is a magic dict becomes

<    5   6   7   8   9   10   11   12   13   14   >