Re: Enumerating all 3-tuples

2018-03-15 Thread Denis Kasak
On 2018-03-13 23:56, Denis Kasak wrote: On 2018-03-10 02:13, Steven D'Aprano wrote: But I've stared at this for an hour and I can't see how to extend the result to three coordinates. I can lay out a grid in the order I want: 1,1,1 1,1,2 1,1,3 1,1,4 ... 2,1,1 2,1,2

Re: Enumerating all 3-tuples

2018-03-14 Thread Denis Kasak
uot;"" n, m = c(i) return c(n) + (m,) Applying c3 to the natural numbers gives the sequence you wanted: s = map(c3, count(1)) pprint([next(s) for _ in range(10)]) [(1, 1, 1), (2, 1, 1), (1, 1, 2), (1, 2, 1), (2, 1, 2), (1, 1, 3), (3, 1, 1), (1, 2, 2), (2, 1, 3), (1, 1, 4)] -- Denis Kasak -- https://mail.python.org/mailman/listinfo/python-list

Re: Attribute error-- but I'm innocent(?)

2009-03-03 Thread Denis Kasak
"Forename" : self.forename.randomByWeight(), >>                 "Surname" : self.surname.randomByWeight()} >> >        This will return a dictionary containing both forename and > surname... Assuming you have forename and surname OBJECTS with contain a > randomByWeight method. In all probability, forename and surname *are* instances of RandomName and contain the randomByWeight() method. -- Denis Kasak -- http://mail.python.org/mailman/listinfo/python-list

Re: Reference or Value?

2009-02-23 Thread Denis Kasak
On Mon, Feb 23, 2009 at 9:12 PM, Steve Holden wrote: > Denis Kasak wrote: >> I assure you I am not confused about Python's object model / calling >> system. I was arguing, from a purely theoretical standpoint, that the >> same system Python uses could be described in ter

Re: Reference or Value?

2009-02-23 Thread Denis Kasak
On Mon, Feb 23, 2009 at 8:41 PM, Christian Heimes wrote: > Denis Kasak wrote >> You could, however, argue that the swap function doesn't work as >> expected (e.g. from a Pascal or a C++ POV) simply because the >> underlying objects aren't mutable. The objects

Re: Reference or Value?

2009-02-22 Thread Denis Kasak
, swapping of values would indeed occur because the function *did* get references to the objects passed to it. That said, it's a rather convoluted way of explaining what happens and calling it pass-by-object feels much better. :-) -- Denis Kasak -- http://mail.python.org/mailman/listinfo/python-list

Re: To unicode or not to unicode

2009-02-22 Thread Denis Kasak
-1 in the absence of specification is a better guess than most (since it's more likely to display the message correctly). However, not specifying the encoding of a message is just asking for trouble and assuming anything is just an attempt of cleaning someone's mess. Unfortunately, it is impossible to detect the encoding scheme just by heuristics and with hundreds of encodings in existence today, the only real solution to the problem is clearly stating your content-type. Since MIME is the most accepted way of doing this, it should be the preferred way, RFC'ed or not. -- Denis Kasak -- http://mail.python.org/mailman/listinfo/python-list

Re: What encoding does u'...' syntax use?

2009-02-21 Thread Denis Kasak
r of UCS-2 because of size concerns. > UTF-8 was ruled out easily because it doesn't allow constant-size > indexing; UTF-16 essentially for the same reason (plus there was > no point to UTF-16, since there were no assigned characters outside > the BMP). Yes, I failed to realise how

Re: What encoding does u'...' syntax use?

2009-02-21 Thread Denis Kasak
*not* strictly UCS-2 anymore. Since we're already discussing this, I'm curious - why was UCS-2 chosen over plain UTF-16 or UTF-8 in the first place for Python's internal storage? -- Denis Kasak -- http://mail.python.org/mailman/listinfo/python-list

Re: What encoding does u'...' syntax use?

2009-02-21 Thread Denis Kasak
de all Unicode code points, while the latter can only encode those in the BMP. -- Denis Kasak -- http://mail.python.org/mailman/listinfo/python-list

Re: time.strptime() and time.strftime() reciprocity

2009-02-16 Thread Denis Kasak
4:52 > PM' > > So, yeah, that seems weird to me. Does anyone get similar results, know why > this is happening, and/or how to fix it? It's actually pretty trivial to fix, which you would have also known if you had read the message of the exception more carefully. :P You passed the arguments for strptime() the wrong way around. Just pass them in reverse and your problem will be fixed. -- Denis Kasak -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading text file with wierd file extension?

2009-02-02 Thread Denis Kasak
On Mon, Feb 2, 2009 at 10:43 PM, Lionel wrote: > >>> ResourcefilePath > 'C:\\C8Example1.slc.rsc' > C:\C8Example1.slc.src The extension you used in the interactive shell differs from the one you used in the class code (i.e. "rsc" vs "src"). -

Re: unable to print Unicode characters in Python 3

2009-01-27 Thread Denis Kasak
On Tue, Jan 27, 2009 at 7:08 PM, Thorsten Kampe wrote: > * Denis Kasak (Tue, 27 Jan 2009 14:22:32 +0100) >> On Tue, Jan 27, 2009 at 1:52 PM, Giampaolo Rodola' >> wrote: >> >>>> print unicode('\u20ac') >> > \u20ac >> >> S

Re: unable to print Unicode characters in Python 3

2009-01-27 Thread Denis Kasak
ckslash. In Python 3.0 you don't need to do this because all strings are "unicode" to start with. I suspect you will see the same error with 2.6 on Windows once you correct this. (note to Giampaolo: sorry, resending this because I accidentally selected "reply" instead of "reply to all") -- Denis Kasak -- http://mail.python.org/mailman/listinfo/python-list

Re: palindrome function

2008-07-12 Thread Denis Kasak
Peter Otten wrote: Denis Kasak wrote: Basically, it reverses the list in place, so it modifies the list which called it. It does not return a /new/ list which is a reversed version of the original, as you expected it to. Since it doesn't return anything explicitly, Python makes it return

Re: palindrome function

2008-07-11 Thread Denis Kasak
nything explicitly, Python makes it return None. Hence, the comparison you are doing is between the original list and a None, which is False, naturally. Try this: spam = ['a', 'n', 'n', 'a'] eggs = spam[:] if spam.reverse() == eggs: print &quo

Re: Getting a set of lambda functions

2008-05-25 Thread Denis Kasak
Scott David Daniels wrote: Denis Kasak wrote: ... spam = [] for i in range(10): ... spam.append(lambda: i) spam[0]() 9 spam[1]() 9 Manually creating the lambdas and appending them to a list works as expected, naturally; I don't see a good reason why it wouldn't work with a

Re: Getting a set of lambda functions

2008-05-25 Thread Denis Kasak
also yields incorrect (or at least unintuitive) results: >>> spam = [] >>> for i in range(10): ... spam.append(lambda: i) >>> spam[0]() 9 >>> spam[1]() 9 Manually creating the lambdas and appending them to a list works as expected, naturally; I don't see a good reason why it wouldn't work with a loop. Am I missing something? -- Denis Kasak -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting a set of lambda functions

2008-05-25 Thread Denis Kasak
rect (or at least unintuitive) results: >>> spam = [] >>> for i in range(10): ... spam.append(lambda: i) >>> spam[0]() 9 >>> spam[1]() 9 Manually creating the lambdas and appending them to a list works as expected, naturally; I don't see a good reason why it wouldn't work with a loop. Am I missing something? -- Denis Kasak -- http://mail.python.org/mailman/listinfo/python-list

Re: type classobj not defined?

2007-01-03 Thread Denis Kasak
type(b) == classobj > Traceback (most recent call last): > File "", line 1, in ? > NameError: name 'classobj' is not defined You can compare it against the ClassType object located in the types module. > import types > class b: def __init__(self): ...

Re: Jargons of Info Tech industry

2005-08-26 Thread Denis Kasak
T Beck wrote: > > Wasn't the point... I never said they were. HTML is at version 4.0(I > think?) now, AND we've added extra layers of stuff you can use > alongside of it. The internet is a free-flowing evolving place... to > try to protect one little segment like usenet from ever evolving is > j

Re: Jargons of Info Tech industry

2005-08-26 Thread Denis Kasak
John Bokma wrote: > > so use Lynx :-) > > One forum I visit is about scorpions. And really, it talks a bit easier > about scorpions if you have an image to look at :-D. > > In short: Usenet = Usenet, and www = www. Why some people want to move > people from www to Usenet or vice versa is beyond

Re: Jargons of Info Tech industry

2005-08-26 Thread Denis Kasak
John Bokma wrote: > Ulrich Hobelmann <[EMAIL PROTECTED]> wrote: > >> John Bokma wrote: >>> http://www.phpbb.com/mods/ >> >> Great. How can I, the user, choose, how to use a mod on a given web >> server? > > Ask the admin? And that is, in your opinion, completely comparable to running your own

Re: Jargons of Info Tech industry

2005-08-26 Thread Denis Kasak
John Bokma wrote: > > You can't be sure: errors in the handling of threads can cause a buffer > overflow, same for spelling checking :-D Yes, they can, provided they are not properly coded. However, those things only interact locally with the user and have none or very limited interaction with

Re: Jargons of Info Tech industry

2005-08-26 Thread Denis Kasak
Mike Schilling wrote: > > Threaded mail-readers too, screen-based editors , spell-checkers, all > useless frills. Interestingly enough, I have explained my opinion in the part of the post you have trimmed. On the other hand, things you mentioned are far from being useless. They introduce no in

Re: Jargons of Info Tech industry

2005-08-25 Thread Denis Kasak
Mike Schilling wrote: > > I see a difference between "X would be useful for A, B, and C" and "Y will > always be the only proper way." > > Don't you? Y would not be useful because of the bandwidth it consumes, the malware it would introduce, the additional time spent focusing on the format ra

Re: Jargons of Info Tech industry

2005-08-25 Thread Denis Kasak
CBFalconer wrote: > Mike Schilling wrote: >> "Mike Meyer" <[EMAIL PROTECTED]> wrote in message >>> "Mike Schilling" <[EMAIL PROTECTED]> writes: "l v" <[EMAIL PROTECTED]> wrote in message > Xah Lee wrote: > >> (circa 1996), and email should be text only (anti-MIME, circa 1995),