Re: Change in Python 3.3 with the treatment of sys.argv

2013-03-22 Thread Steven D'Aprano
sed by changes in sys.argv. (There is no change in sys.argv, it's just a list of strings, the same as it always was.) P.S. it's remarkably, and deceptively, difficult to correctly benchmark code. The best way is to take your actual application, give it some real world data to process, and time how long it takes. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: LiClipse

2013-03-22 Thread Steven D'Aprano
hat this LiClipse is all about? No idea. Who did you get the message from? Perhaps you should ask them. Or ask on an Eclipse forum. Or try googling for "Liclipse", which brings me to this: http://www.indiegogo.com/projects/pydev-and-liclipse-for-a-fast-sexy-and- dark-eclipse --

Re: Python IDLE

2013-03-22 Thread Steven D'Aprano
om your email disclaimer that you are emailing from a company. Does your company have a Windows system administrator? If so, perhaps he or she could shed some light on what's going on? (I don't use Windows, so I'm a little lost myself.) Good luck! -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Grouping items by a key?

2013-03-22 Thread Steven D'Aprano
) >>> grouped(items, lambda x: x % 2) {0: [0, 2, 4, 6, 8], 1: [1, 3, 5, 7, 9]} >>> items = 'hello stack overflow how are you'.split() >>> grouped(items, len) {8: ['overflow'], 3: ['how', 'are', 'you'], 5: ['hello', 'stack']} """ result = {} for item in iterable: result.setdefault(key(item), []).append(item) return result Now you have a nice, descriptive help string for when you call help(grouped). -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: how does the % work?

2013-03-23 Thread Steven D'Aprano
lines are exactly the same in Python 2, where Print is not a function! > You are using Python 3. In Python 3, "print" is a function that returns > None. So, the error is exactly correct. To fix it, you need to have > the % operator operate on the string, not on the resu

Re: how does the % work?

2013-03-23 Thread Steven D'Aprano
On Sat, 23 Mar 2013 09:57:48 -0600, Michael Torrie wrote: > On 03/23/2013 01:38 AM, Steven D'Aprano wrote: >> Just to add confusion, the two lines are exactly the same in Python 2, >> where Print is not a function! > > Perhaps this is a good reason use the slightly mor

Re: addressof object with id()

2013-03-23 Thread Steven D'Aprano
he object, as returned by the C compiler, as the ID. But since there is no way to dereference an id, or lookup the object found at an id, it is not an address. It merely has the same numeric value as what the C compiler sees as the address. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: addressof object with id()

2013-03-23 Thread Steven D'Aprano
you need something like this: a = "bar" b = "".join(["b", "a", "r"]) although of course a sufficiently smart keyhole optimizer could recognise that as a constant as well. This, on the other hand, will defeat it: b = str("ba") + str("r") because the keyhole optimizer cannot tell whether str() is still the built-in function or has been replaced by something else. > but, again, none of this is guaranteed. Correct. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: addressof object with id()

2013-03-23 Thread Steven D'Aprano
is no real consensus. Those who don't do serious floating point work hate NANs, those who do are split between loving NANs and merely tolerating them because the IEEE standard requires them, but pretty much everyone agrees that containers should be free to assume identity implies equality. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: addressof object with id()

2013-03-24 Thread Steven D'Aprano
hough I'm too lazy to look them up to check for sure. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: import in Python3.3

2013-03-24 Thread Steven D'Aprano
the current directory will contain a file "collections.py" which will shadow the standard library collections.py. So don't do that. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: io.BytesIO

2013-03-24 Thread Steven D'Aprano
fter, the size of the object itself, including any overhead? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: io.BytesIO

2013-03-24 Thread Steven D'Aprano
On Mon, 25 Mar 2013 00:10:04 -0500, Fabian von Romberg wrote: > Hi Steven, > > > actually why I need is to know how much memory has been allocated for > buffering. > > getsizeof gets the size of the object structure. I can see at least four ways to get the current size o

Re: Performance of int/long in Python 3

2013-03-25 Thread Steven D'Aprano
like to see though is a module where I can import fixed- width signed and unsigned integers that behave like in C, complete with overflow, for writing code that matches the same behaviour as other languages. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-03-25 Thread Steven D'Aprano
On Mon, 25 Mar 2013 20:55:03 -0400, Roy Smith wrote: > In article <[email protected]>, > Steven D'Aprano wrote: > >> Also, speaking as somebody who remembers a time when ints where not >> automatically promoted to longs (in

Re: At a loss on python scoping.

2013-03-26 Thread Steven D'Aprano
function scopes; look in the global scope; look in the builtins. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Steven D'Aprano
lt-in programming language Hypertalk let you do things like this: go to stack "Notepad" type "goodbye cruel world" in field "main" of card 7 click button "Save" click button "Quit" of card "Main" of stack "Excel" (more or less... it's been a few years since I've had a classic Mac capable of running Hypercard.) -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Steven D'Aprano
ule also initialises a private instance, and exposes the methods of that instance as top-level functions, to cover the 90% simple case where your application only cares about a single RNG. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: import in Python3.3

2013-03-26 Thread Steven D'Aprano
should be merely loosely coupled, no different from any other modules in sys.path. If your modules are tightly coupled, they should go in a package. One thing which would make import manipulations much easier would be if import (and __import__) took an explicit search path, as opposed to operati

Re: import in Python3.3

2013-03-26 Thread Steven D'Aprano
shes with the collections in the standard library, there's no simple way to bypass his package and find the standard library collections module. When you have two top-level modules/packages with the same name, whichever one comes first in sys.path will shadow the second one. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: How to define "exec" method on a class object? Get syntax error due to built in command

2013-03-26 Thread Steven D'Aprano
d > on it; if you can switch to 3.3.0 (the latest 3.x release), that would > actually fix your exec problem, for what that's worth. (Moving to 3.3.0 > would be a much bigger change, though, and one that's likely to require > code edits.) If the OP's code uses string exceptions: raise "an error occurred" they will need to be replaced before migrating to 2.7. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Decorator help

2013-03-27 Thread Steven D'Aprano
> which requires access to several MyClass vars. Not clear on the > syntax/usage with this approach here, any guidance would be greatly > appreciated! It's not clear what you actually need to do, so I can't give you any more guidance apart from the sort of thing that is possible with decorators. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Help me pick an API design (OO vs functional)

2013-03-27 Thread Steven D'Aprano
On Wed, 27 Mar 2013 02:34:09 -0700, Michael Herrmann wrote: > On Tuesday, March 26, 2013 11:37:23 PM UTC+1, Steven D'Aprano wrote: >> >> Global *variables* are bad, not global functions. You have one global >> variable, "the current window". So long as y

Re: Separate Rows in reader

2013-03-27 Thread Steven D'Aprano
1:51 PM UTC+10, rusi wrote: Eight levels of attribution. And I count up to nine levels of quoting. Doesn't anyone have a working backspace key in their editor? Please trim your responses to what's needed to establish context, there's no need to keep the entire thread duplicated in every post. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-03-27 Thread Steven D'Aprano
I also suggest you go and moan at Steven D'Aprano who called the idiot a > liar. Although thinking about it, I prefer Steven's comment to my own > as being more accurate. Yes I did, I suggest you reflect on the difference in content between your post and mine, and why your

Re: Decorator help

2013-03-27 Thread Steven D'Aprano
lass attribute" >> >> def __init__(self, y): >> self.y = y >> >> > In the spirit of nit-picking, I'll point out that Steven meant to use > the 'class' keyword instead of 'def' for MyClass. /face-palm So I did. Thanks for picking the nit. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-27 Thread Steven D'Aprano
a matter of honest misunderstanding or even mere difference of opinion. As an Australian, I am constitutionally required to call a spade a bloody shovel at least twice a week, so I have no regrets. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-28 Thread Steven D'Aprano
e as to the best way to make it clear to them that they are not welcome so long as they continue their behaviour. [1] Although sadly, given the reality of communication on the Internet, sometimes kill-filing is the least-worst option. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Differentiation in Python

2013-03-28 Thread Steven D'Aprano
do it with maths, and get an exact result. dC/dQ = 3*Q**2 - 30*Q + 93 d²C/dQ² = 6*Q - 30 The rule for differentiating polynomials of the form y = k*x**n is: dy/dx = (k*n)*x**(n-1) Consult a good calculus text book or on-line site for further details. -- Steven -- http://mail.python.org

Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-28 Thread Steven D'Aprano
n is that it is, on average, > more compact over a wide set of samples. Sure. And over a different set of samples, it is less compact. If you write a lot of Latin-1, Python will use one byte per character, while UTF-8 will use two bytes per character. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Surrogate pairs in new flexible string representation [was Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]]

2013-03-28 Thread Steven D'Aprano
at could need surrogate pairs, and they don't need them in Python's implementation since it's a full 32- bit implementation. So where do the surrogate pairs come into this? I also wonder why the implementation bothers keeping a UTF-8 representation. That sounds like premature op

Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]

2013-03-28 Thread Steven D'Aprano
take it under advisement. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Surrogate pairs in new flexible string representation [was Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]]

2013-03-28 Thread Steven D'Aprano
On Fri, 29 Mar 2013 11:54:41 +1100, Chris Angelico wrote: > On Fri, Mar 29, 2013 at 11:39 AM, Steven D'Aprano > wrote: >> ASCII and Latin-1 strings obviously do not have them. Nor do BMP-only >> strings. It's only strings in the SMPs that could need surrogate pairs,

Re: Lazy evaluated

2013-03-28 Thread Steven D'Aprano
safe to use as an int print(value + 1) [...] > And everything seems to work, but appear other questions. If original > function return different types - what to do in this case? Where i am > wrong? What other way to do that. Was no idea to create keyword 'lazy' > in Python?

Re: Doing both regex match and assignment within a If loop?

2013-03-28 Thread Steven D'Aprano
fum() else: raise SomeException > What I'm trying to avoid is this: > > if expression1.match(line): > results = expression1.match(line) > > which I assume would call the regex match against the line twice Correct. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: dir() vs print(dir()) in the embedded mode

2013-03-29 Thread Steven D'Aprano
) (and all other commands) > and display them to the user? Automatically? I don't believe so. I think it is hard-coded behaviour of the interactive interpreter, and cannot by enabled for scripts. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Python class and variable issue(newby question!)

2013-03-29 Thread Steven D'Aprano
t Java -- but it is actively harmful terminology (in Python at least, if not in general) and whoever invented it is bad and should feel bad. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Why does 1**2**3**4**5 raise a MemoryError?

2013-03-31 Thread Steven D'Aprano
illion trillion trillion trillion trillion trillion trillion trillion trillion trillion trillion trillion trillion trillion trillion trillion trillion trillion trillion trillion trillion trillion trillion trillion trillion trillion trillion trillion digits. (American billion and trillion, 10**9 and 10**12 respectively.) -- Steven -- http://mail.python.org/mailman/listinfo/python-list

ASCII versus non-ASCII [was Re: flaming vs accuracy [was Re: Performance of int/long in Python 3]]

2013-03-31 Thread Steven D'Aprano
00 + 'ẞ'") [1.8083378580026329, 1.818592812011484, 1.7922867869958282] Python 3.2, ASCII vs Non-ASCII: py> timeit.repeat("'a' * 1000 + 'z'") [1.756322135925293, 1.8002049922943115, 1.721085958480835] py> timeit.repeat("'a' * 1000 + 'ẞ'") [1.7209150791168213, 1.7162668704986572, 1.7260780334472656] In other words, if you stick to non-ASCII strings, Python 3.3 is no slower than Python 3.2. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Why does 1**2**3**4**5 raise a MemoryError?

2013-03-31 Thread Steven D'Aprano
ponentiation is not commutative: 2**3 != 3**2 nor is it associative: 2**(3**2) != (2**3)**2 so I'm not really sure what you are trying to say here. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: executor.map() TypeError: zip argument #2 must support iteration

2013-04-01 Thread Steven D'Aprano
remaining positional arguments, which means that the timeout argument is keyword only. So try this: future_to_url = executor.map(str, lst100, timeout=60) -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-01 Thread Steven D'Aprano
a straightforward choice. An example will illustrate: > > I can choose to drive or not -- a choice. Statistics tell me that on > average there are 3 fatalities every day; I am very concerned that I > could get killed so I choose not to drive. Which neglects that there are > a couple of million safe-drives at the same time as the '3 fatalities' Clear as mud. What does this have to do with supporting Unicode? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-01 Thread Steven D'Aprano
ectness. > > That works out to 0.03%. Of course I assume it is US only data. > Still its good to know how skew the distribution is. If the data included Japanese names, or used Emoji, it would be much closer to 100% than 0.03%. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-01 Thread Steven D'Aprano
On Mon, 01 Apr 2013 08:15:53 -0400, Roy Smith wrote: > In article <[email protected]>, > Steven D'Aprano wrote: > >> [...] >> >> OK, that leads to the next question. Is there anyway I can (in >> >> Python 2.

Re: Help

2013-04-01 Thread Steven D'Aprano
ore it's critical that we reply instantly. *wink* -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating a dictionary from a .txt file

2013-04-01 Thread Steven D'Aprano
artist, > breaks most search tools. As far as I'm concerned, anyone in the 21st century who names themselves or their work (a movie, book, programming language, etc.) something which breaks search tools is just *begging* for obscurity, and we ought to respect their wishes. -- Stev

Re: Help

2013-04-01 Thread Steven D'Aprano
an, and come back with any further questions *after* making a good effort. Another hint: try experimenting at the interactive interpreter, or IDLE. If you're unsure about something, try it and see what happens *before* asking. Good luck. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Help please

2013-04-01 Thread Steven D'Aprano
in MemoryError (while the above code was running, my computer got slower and slower and slower, and potentially it could have locked up completely). So the general advice is, treat the input() function as For Experts Only, and always use raw_input() instead. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Switching from Apche to LiteSpeed

2013-04-01 Thread Steven D'Aprano
F-8, it won't magically turn the Latin-1 file into UTF-8. Instead you'll get bytes being decoded wrongly. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-02 Thread Steven D'Aprano
character instead of 0.1 second? That's still a hundred times faster than you can type. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-02 Thread Steven D'Aprano
time. Real-world benchmarks of actual applications demonstrate this. One or two trivial slowdowns of artificial micro-benchmarks simply are not important, even if they are genuine. I believe they are genuine, but likely operating system and hardware dependent. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: OSError: [Errno 127] Value too large to be stored in data type

2013-04-02 Thread Steven D'Aprano
ponding on-list with a follow-up, and I'm sorry that nobody was able to give you any useful answers. If you do find a solution, work- around or even just an explanation, please consider replying again with an answer. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Decorating functions without losing their signatures

2013-04-02 Thread Steven D'Aprano
s: http://numericalrecipes.wordpress.com/2009/05/25/signature-preserving- function-decorators/ Good luck! -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-02 Thread Steven D'Aprano
. There is no meaningful difference in speed between the two versions. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Time zone changing while Win app is running

2013-04-03 Thread Steven D'Aprano
k. I am not the maintainer of the datetime module, but based purely on what you have said, I would consider that a bug. I suggest you report it as an issue on the Python bug tracker. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-03 Thread Steven D'Aprano
e's probably also a way to do it using ctypes. > The system already knows what the size is, I was hoping for an > uber-quick inspection of the string header. I'm not sure that I would want strings to have a method reporting this, but it might be nice to have a function in the inspect module to do so. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Sorting [was Re: Performance of int/long in Python 3]

2013-04-03 Thread Steven D'Aprano
language promise, but I can't seem to find it documented anywhere official. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-03 Thread Steven D'Aprano
t; I'm reasonably sure all() is smart enough to stop at the first False > value. Yes, all() and any() are guaranteed to be short-circuit functions. They will stop as soon as they see a False or a True value respectively. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-03 Thread Steven D'Aprano
rt from pure intellectual curiosity, but sure, post a feature request. Be sure to mention that Pike supports this feature. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Mixin way?

2013-04-03 Thread Steven D'Aprano
__(self): self.engine = Engine() def go(self): ... and then both cars and boats can *delegate* behaviour to the engine object. So, if you think of "Visitable" as a gadget that can be strapped onto your MyObj as a component, then composition is probably a better design. But if you think of "Visitable" as a mere collection of behaviour and state, then a mixin is probably a better design. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-03 Thread Steven D'Aprano
On Wed, 03 Apr 2013 10:38:20 -0600, Ian Kelly wrote: > On Wed, Apr 3, 2013 at 9:02 AM, Steven D'Aprano > wrote: >> On Wed, 03 Apr 2013 09:43:06 -0400, Roy Smith wrote: >> >> [...] >>>> n = max(map(ord, s)) >>>> 4 if n > 0x else 2 i

In defence of 80-char lines

2013-04-03 Thread Steven D'Aprano
cters. (Strictly speaking, 79 characters.) Here is a good defence of 80 char lines: http://wrongsideofmemphis.com/2013/03/25/80-chars-per-line-is-great/ -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: In defence of 80-char lines

2013-04-03 Thread Steven D'Aprano
es: # 80 characters, not 79. Oh well. font = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, faceName="FreeSans") self.mainLabel.SetFont(font) And finally, when all is said and done, the most important rule from PEP 8 applies: know when to break the rules. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: In defence of 80-char lines

2013-04-04 Thread Steven D'Aprano
should be no greater than 79 halfwidth characters, or 39 fullwidth characters, or some combination thereof. http://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms -- Steven -- http://mail.python.org/mailman/listinfo/python-list

test - please ignore

2013-04-05 Thread Steven D'Aprano
Sorry for the noise. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

How do I tell if I'm running under IDLE?

2013-04-05 Thread Steven D'Aprano
e__.startswith('idlelib') Ideally, I'd like to detect any arbitrary environment such as Spyder, IPython, BPython, etc., but will settle for just IDLE. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I tell if I'm running under IDLE?

2013-04-05 Thread Steven D'Aprano
On Fri, 05 Apr 2013 07:04:35 -0400, Dave Angel wrote: > On 04/05/2013 05:30 AM, Steven D'Aprano wrote: >> (Apologies in advance if you get multiple copies of this. My Usenet >> connection seems to be having a conniption fit at the moment.) >> >> I'm loo

Re: a couple of questions: pickling objects and strict types

2013-04-05 Thread Steven D'Aprano
deserializes it doesn't set all that up. Thanks, What's the object's ctor? What sort of objects are you dealing with? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: I hate you all

2013-04-05 Thread Steven D'Aprano
eggs(): \t\tprint("indented with two tabs") spam() eggs() """ exec(code) === cut === If it were my language, I would be even stricter about indentation than Python 3. I would require that each file use *only* tabs, or *only* spaces, and not allow both in the same file. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: a couple of questions: pickling objects and strict types

2013-04-05 Thread Steven D'Aprano
On Fri, 05 Apr 2013 18:18:51 -0600, Littlefield, Tyler wrote: > On 4/5/2013 2:30 PM, Steven D'Aprano wrote: >> On Fri, 05 Apr 2013 12:59:04 -0600, Littlefield, Tyler wrote: >> >>> Hello all: >>> I've been using Python for a while now, but I h

Re: I hate you all

2013-04-05 Thread Steven D'Aprano
. (I use a lot of top-level functions, and few classes). With an average line length of 50 characters, plus indentation, we can reduce the size of a typical Python module by ninety-seven percent! Of course, what we save in disk space, we lose in monitor size, but I'm sure that the price o

Re: I hate you all

2013-04-06 Thread Steven D'Aprano
man.linuxchix.org/pipermail/programming/2004-August/001433.html Maybe if we had smarter editors and smarter diffs and smarter tools in general, it wouldn't be a problem. But we don't, so it is. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-06 Thread Steven D'Aprano
e: ??? >- it's a very uncommon need Well, that at least is true. But then, needing to know the platform you're running under, the size of objects, the id of a object, the largest integer, the largest float, or the number of references seen by the garbage collector are also uncommon needs. What really matters is not how often you need it, but what you can do when you need it if you don't have it. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: I hate you all

2013-04-06 Thread Steven D'Aprano
predates the "rule" that tab stops are every 8 characters. If your editor doesn't support setting tab stops to at least single pixel resolution, it's not supporting tabs, it's supporting something else that it merely calls "tabs". -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: I hate you all

2013-04-06 Thread Steven D'Aprano
ge blocks of running text. > Program text is almost always(*) displayed in a fixed-width font. No > font information is carried along with the program text at all; it is > assumed the reader will pick a font and size of their own preference, And tab settings. If you're going to comp

Re: Performance of int/long in Python 3

2013-04-07 Thread Steven D'Aprano
On Sat, 06 Apr 2013 19:58:02 -0600, Ian Kelly wrote: > On Sat, Apr 6, 2013 at 7:29 PM, Steven D'Aprano > wrote: >> For some definition of "easily". >> >> if implementation == "CPython": >> if version < "3.3": >>

Re: new.instancemethod - how to port to Python3

2013-04-07 Thread Steven D'Aprano
def method(self, arg): return {arg: self} import types x.method = types.MethodType(method, x) x.method("hello") => returns {'hello': <__main__.Spam object at 0xb7bc59ac>} Does this help? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: new.instancemethod - how to port to Python3

2013-04-07 Thread Steven D'Aprano
with new.instancemethod to this: self.to_binary = types.MethodType(to_binary, self) and see if it works. If it complains about the call to exec, then change that part of the code to this: ns = {} exec(code, ns) to_binary = ns['to_binary'] self.t

Re: __doc__ string for getset members

2013-04-07 Thread Steven D'Aprano
need to do it from the class. The behaviour > you observe is normal and cannot be overriden. All very well and good, but how about putting Nick out of his misery and showing how to do it? print(obj.__class__.mem.__doc__) ought to work. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Splitting of string at an interval

2013-04-07 Thread Steven D'Aprano
ases = [words[i:i+2] for i in range(0, len(words), 2)] 4) Join the phrases into strings. phrases = [' '.join(phrase) for phrase in phrases] -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: im.py: a python communications tool

2013-04-07 Thread Steven D'Aprano
ple they can do whatever they want with my software! Nothing can possibly go wrong!"? Use a known, tested, working solution, and save yourself the pain. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Error in Python NLTK

2013-04-07 Thread Steven D'Aprano
t THREE AND A HALF PAGES of quoted text to see a two line response. Thank you. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie to python. Very newbie question

2013-04-07 Thread Steven D'Aprano
d also work through a tutorial or two. Also the "Module of the week" website is very good: http://pymotw.com -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Interactive development in Python à la Smalltalk?

2013-04-08 Thread Steven D'Aprano
received:", arg+1000 ... py> Test.method = method py> t.method(23) argument received: 1023 -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: is "_io.py" missing from 2.7.4 ?

2013-04-08 Thread Steven D'Aprano
thon 3.3, the _io module is now built-in into the compiler, so _io.__file__ no longer exists. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Splitting of string at an interval

2013-04-08 Thread Steven D'Aprano
program, but also the smallest program in terms of number of non-white pixels. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: I hate you all

2013-04-08 Thread Steven D'Aprano
On Mon, 08 Apr 2013 19:43:51 +0100, Nobody wrote: > On Sun, 07 Apr 2013 01:30:45 +0000, Steven D'Aprano wrote: > >> Am I the only one here who has used a typewriter? >> >> Tab stops were set manually, to a physical distance into the page, >> using a mechanical

Re: How to subclass a family

2013-04-08 Thread Steven D'Aprano
on't understand your question. The reason for using inheritance is to reduce the amount of duplicated code. If you're ending up with more code, you're doing something wrong. You're probably badly designing your methods, or your classes, or both. If you give a less contrived example, perhaps we can help. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Can anyone please help me in resolving the error => AttributeError: Array instance has no attribute '__trunc__'

2013-04-08 Thread Steven D'Aprano
FOUR PAGES of quoted text just to get to a two line response. Thank you. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: I hate you all

2013-04-08 Thread Steven D'Aprano
On Mon, 08 Apr 2013 21:06:42 -0700, rusi wrote: > On Apr 9, 7:51 am, Steven D'Aprano [email protected]> wrote: >> On Mon, 08 Apr 2013 19:43:51 +0100, Nobody wrote: >> > On Sun, 07 Apr 2013 01:30:45 +, Steven D'Aprano wrote: >> >&g

Re: im.py: a python communications tool

2013-04-08 Thread Steven D'Aprano
for their purpose in many jurisdictions. In some places that may only apply if money changes hands; in other places it will apply regardless. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: classes and sub classes?

2013-04-09 Thread Steven D'Aprano
anywhere you can use a NwInvDb database object, you can use a Device object. And the same would apply to every other concept in the database. That does not sound like a clean and useful design to me. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: im.py: a python communications tool

2013-04-09 Thread Steven D'Aprano
ives you a car, only the brake lines have been disconnected and you're seriously injured the first time you drive it, you also have standing to sue that she gave you a car that was unfit for the purpose it was designed. > Where does everyone > come up with these bullshit ideas? I

Re: im.py: a python communications tool

2013-04-09 Thread Steven D'Aprano
ovus Ordo Seclorum bullshit. You've dropped your tinfoil hat. Watch out, the CIA will start beaming thoughts into your head. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: im.py: a python communications tool

2013-04-09 Thread Steven D'Aprano
e and warranty disclaimer is best. It's just damn common sense that, when faced with a legal issue, you ask a legal expert, not a programmer or a butcher or a candle-stick maker. http://demotivationalblog.com/demotivational/2010/03/common-sense.jpg -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: im.py: a python communications tool

2013-04-09 Thread Steven D'Aprano
n the car manufacturer. Some places might reason that you can sue both, and it is up to the court to decide what percentage of responsibility each party must take. Which case it is will depend on the laws of whichever place has legal jurisdiction. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: im.py: a python communications tool

2013-04-09 Thread Steven D'Aprano
ur currency that YOU have accepted. Egyptian >> pyramids on the U.S. dollar? All seeing eye? > > I'm sorry, I'm somewhat lost here. The dollar I have here has a mob of > animals on one side and someone's face on the other - no pyramids, no > all-seeing-eye. It must be c

Re: im.py: a python communications tool

2013-04-09 Thread Steven D'Aprano
On Tue, 09 Apr 2013 02:29:43 -0700, Mark Janssen wrote: > Well, out here in the good ol' USA, there no "duty of care" That explains a lot. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question about confusing exception handling in urllib

2013-04-09 Thread Steven D'Aprano
xpected errors, and ignore them? If you're absolutely sure that this is the right thing to do, then: try: code_goes_here() except Exception: pass But really, you shouldn't do this. (For experts only: you *probably* shouldn't do this.) -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Python httplib, request & putrequest

2013-04-09 Thread Steven D'Aprano
On Tue, 09 Apr 2013 18:20:04 +0800, 小学园PHP wrote: > I need to use the python httplib. > > And i code two sample, the first works, not the second. > > But what i need is the second. > > In the second sample, the data seems not be sent correctly. > > I want to know where is the problem in the se

<    87   88   89   90   91   92   93   94   95   96   >