Re: Inserting record with Microsoft Access

2006-02-09 Thread Kelly
"jeffhg582003" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > fields. I am trying to capture the number generated from the insert but > I am not exactly sure how to do that after an insert. Other folks have pointed you to "select @@identity" but I thought I should mention that if you u

Re: Puzzled by code pages

2010-05-14 Thread Kelly
Buy high quality TAG Heuer Tiger Woods Golf Watches at low price, you can not believe, but it is true. There are two models on http://www.luxuryowner.net/Replica-TAG-Heuer-Tiger-Woods-Golf-Watches.html White: Tag Heuer Tiger Woods Golf White Mens Watch WAE1112.FT6008: http://www.luxuryowner.net

Re: Collision of Two Rect

2013-05-06 Thread Ian Kelly
On May 6, 2013 10:39 AM, "Joshua Landau" wrote: > > On 4 May 2013 00:42, Ian Kelly wrote: >> >> The other thing that is suspicious about the code you posted is that >> it has two different notions of the ball's position that are not >> necessarily in

Re: Style question -- plural of class name?

2013-05-08 Thread Ian Kelly
On Wed, May 8, 2013 at 2:37 PM, John Downs wrote: > On Wed, May 8, 2013 at 4:20 PM, Roy Smith wrote: >> >> FooEntry is a class. How would you describe a list of these in a >> docstring? >> >> "A list of FooEntries" >> >> "A list of FooEntrys" >> >> "A list of FooEntry's" >> >> "A list of FooEntr

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Ian Kelly
On Wed, May 8, 2013 at 8:35 PM, Mark Janssen wrote: > Okay, to anyone who might be listening, I found the core of the problem. What "problem" are you referring to? You've been posting on this topic for going on two months now, and I still have no idea of what the point of it all is. I recall so

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Ian Kelly
On Thu, May 9, 2013 at 3:51 PM, Mark Janssen wrote: > On Thu, May 9, 2013 at 10:33 AM, Ian Kelly wrote: >> On Wed, May 8, 2013 at 8:35 PM, Mark Janssen >> wrote: >>> Okay, to anyone who might be listening, I found the core of the problem. >> >> What "pr

Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]

2013-05-12 Thread Ian Kelly
On Sun, May 12, 2013 at 5:23 PM, Mr. Joe wrote: > I seem to stumble upon a situation where "!=" operator misbehaves in > python2.x. Not sure if it's my misunderstanding or a bug in python > implementation. Here's a demo code to reproduce the behavior - The != operator is implemented by the __ne__

Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]

2013-05-13 Thread Ian Kelly
On Mon, May 13, 2013 at 5:27 PM, Andrew Berg wrote: > On 2013.05.13 17:53, Mark Lawrence wrote: >> I much prefer the alternative <> for != but some silly people insisted >> that this be removed from Python3. > It's not removed from Python 3, though: > > Python 3.3.1 (v3.3.1:d9893d13c628, Apr 6 20

Re: Message passing syntax for objects | OOPv2

2013-05-15 Thread Ian Kelly
On Sun, May 12, 2013 at 10:48 PM, Mark Janssen wrote: > You're very right. But that is what has made it sort of a test-bed > for internet collaboration. The project I'm working on is aimed to > solve that problem and take the Wiki philosophy to its next or even > ultimate level. By adding a "n

Re: Fractal

2013-05-15 Thread Ian Kelly
On Mon, May 13, 2013 at 9:41 AM, Sharon COUKA wrote: > Hello, I'm new to python and i have to make a Mandelbrot fractal image for > school but I don't know how to zoom in my image. > Thank you for helping me. Is this a GUI application or does it just write the image to a file? What GUI / image l

Re: Python 2.7.x - problem with obejct.__init__() not accepting *args and **kwargs

2013-05-15 Thread Ian Kelly
On Wed, May 15, 2013 at 6:16 AM, Oscar Benjamin wrote: > I don't generally use super() but I did see some advice about it in > this article: > https://fuhm.net/super-harmful/ > > From the conclusion: > "Never use positional arguments in __init__ or __new__. Always use > keyword args, and always ca

Re: Question re: objects and square grids

2013-05-15 Thread Ian Kelly
On Wed, May 15, 2013 at 10:56 AM, Andrew Bradley wrote: > Hello everyone. > > I am having a good time programming with Python 3.3 and Pygame. Pygame seems > like the perfect platform for the kind of simple games that I want to make. > > What I have currently programmed is basically a drawn rectang

Re: Python 2.7.x - problem with obejct.__init__() not accepting *args and **kwargs

2013-05-15 Thread Ian Kelly
On Wed, May 15, 2013 at 8:06 PM, Steven D'Aprano wrote: > On Wed, 15 May 2013 13:16:09 +0100, Oscar Benjamin wrote: > > >> I don't generally use super() > > Then you should, especially in Python 3. > > If you're not using super in single-inheritance classes, then you're > merely making your own co

Re: Fractal

2013-05-16 Thread Ian Kelly
On Thu, May 16, 2013 at 5:04 AM, Sharon COUKA wrote: > I have to write the script, and i have one but the zoom does not work That doesn't answer my question. Perhaps if you would share with us what you already have, then we could point out what you need to do and where to get your "zoom" working

Re: Fractal

2013-05-16 Thread Ian Kelly
On Thu, May 16, 2013 at 10:55 AM, Sharon COUKA wrote: > # Register events > c.bind('i', zoom) > c.bind('i', unzoom) > c.bind('i', mouseMove) I'm not an expert at Tkinter so maybe one of the other residents can help you better with that. The code above looks wrong to me, though. As far as I know,

Re: Non-identifiers in dictionary keys for **expression syntax

2013-05-23 Thread Ian Kelly
On Thu, May 23, 2013 at 12:52 PM, Matthew Gilson wrote: > Using Cpython, we can do the following: > > def func(**kwargs): > print kwargs > > d = {'foo bar baz':3} > > So that might lead us to believe that the keys of the mapping do not need to > be valid identifiers. However,

Re: Solving the problem of mutual recursion

2013-05-26 Thread Ian Kelly
On Sun, May 26, 2013 at 12:13 PM, Peter Brooks wrote: > No, on a multi-core machine it's normal. The machine shows python > running multiple threads - and the number of threads change as the > program runs. Perhaps the OS/X implementation of python does allow > concurrency when others don't. It ce

Re: Solving the problem of mutual recursion

2013-05-26 Thread Ian Kelly
On Sun, May 26, 2013 at 10:36 PM, Peter Brooks wrote: > This makes complete sense - any atomic action should be atomic, so two > threads can't be doing it at the same time. They can be doing anything > else though. > > If two threads create a new object at the same time, for example, > there's pot

Re: Solving the problem of mutual recursion

2013-05-26 Thread Ian Kelly
On Sun, May 26, 2013 at 4:16 PM, Chris Angelico wrote: > On Mon, May 27, 2013 at 5:35 AM, Ian Kelly wrote: >> I'm pretty sure that CPython uses the GIL regardless of platform. And >> yes you can have multiple OS-level threads, but because of the GIL >> only one wil

Re: Solving the problem of mutual recursion

2013-05-27 Thread Ian Kelly
On Mon, May 27, 2013 at 12:19 AM, Ian Kelly wrote: > 7) Since the program being tested does basically nothing except start > and exit threads, the extra 40% probably represents the overhead of > all that starting and stopping, which would be done outside the GIL. To test this, I trie

Re: String object has no attribute "append"

2013-05-28 Thread Ian Kelly
On Tue, May 28, 2013 at 12:25 PM, Matt Graves wrote: > I receive this error while toying around with Functions... > > def pulldata(speclist,speccolumn): > with open('profiles.csv', 'r') as f: > reader = csv.reader(f) > for column in reader: > (specl

Re: String object has no attribute "append"

2013-05-28 Thread Ian Kelly
On Tue, May 28, 2013 at 12:41 PM, Ian Kelly wrote: > On Tue, May 28, 2013 at 12:25 PM, Matt Graves wrote: >> I receive this error while toying around with Functions... >> >> def pulldata(speclist,speccolumn): >> with open('profiles.csv', 'r'

Re: Short-circuit Logic

2013-05-29 Thread Ian Kelly
On Wed, May 29, 2013 at 8:33 AM, rusi wrote: > 0.0 == 0.0 implies 5.4 == 5.4 > is not a true statement is what (I think) Steven is saying. > 0 (or if you prefer 0.0) is special and is treated specially. It has nothing to do with 0 being special. A floating point number will always equal itself (

Re: Getting a callable for any value?

2013-05-29 Thread Ian Kelly
On Wed, May 29, 2013 at 11:46 AM, Croepha wrote: > Is there anything like this in the standard library? > > class AnyFactory(object): > def __init__(self, anything): > self.product = anything > def __call__(self): > return self.product > def __repr__(self): > return "%s.%s(%r)" % (self.__class__._

Re: Getting a callable for any value?

2013-05-29 Thread Ian Kelly
On Wed, May 29, 2013 at 12:19 PM, Fábio Santos wrote: > Are you sure you don't want to use a lambda expression? They are pretty > pythonic. > > none_factory = lambda: None > defaultdict_none_factory = lambda: defaultdict(none_factory) > > collections.defaultdict(defaultdict_none_factory) Gah. If

Re: python b'...' notation

2013-05-29 Thread Ian Kelly
On Wed, May 29, 2013 at 12:33 PM, alcyon wrote: > This notation displays hex values except when they are 'printable', in which > case it displays that printable character. How do I get it to force hex for > all bytes? Thanks, Steve Is this what you want? >>> ''.join('%02x' % x for x in b'hel

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Ian Kelly
On Wed, May 29, 2013 at 8:49 PM, rusi wrote: > On May 30, 6:14 am, Ma Xiaojun wrote: >> What interest me is a one liner: >> print '\n'.join(['\t'.join(['%d*%d=%d' % (j,i,i*j) for i in >> range(1,10)]) for j in range(1,10)]) > > Ha,Ha! The join method is one of the (for me) ugly features of python

Re: How to get an integer from a sequence of bytes

2013-05-30 Thread Ian Kelly
On Thu, May 30, 2013 at 12:26 PM, Mok-Kong Shen wrote: > Am 27.05.2013 17:30, schrieb Ned Batchelder: >> >> On 5/27/2013 10:45 AM, Mok-Kong Shen wrote: >>> >>> From an int one can use to_bytes to get its individual bytes, >>> but how can one reconstruct the int from the sequence of bytes? >>> >> T

Re: How clean/elegant is Python's syntax?

2013-05-30 Thread Ian Kelly
On Thu, May 30, 2013 at 12:44 PM, Chris Angelico wrote: > On Fri, May 31, 2013 at 4:36 AM, Ian Kelly wrote: >> I don't object to changing the join method (one of the more >> shoe-horned string methods) back into a function, but to my eyes >> you've got the ar

Re: Short-circuit Logic

2013-05-30 Thread Ian Kelly
On Thu, May 30, 2013 at 1:30 PM, Neil Cerutti wrote: > On 2013-05-30, Chris Angelico wrote: >> On Thu, May 30, 2013 at 3:10 PM, Steven D'Aprano >> wrote: >>> # Wrong, don't do this! >>> x = 0.1 >>> while x != 17.3: >>> print(x) >>> x += 0.1 >> >> Actually, I wouldn't do that with integers

Re: How clean/elegant is Python's syntax?

2013-05-31 Thread Ian Kelly
On Thu, May 30, 2013 at 1:38 PM, MRAB wrote: > And additional argument (pun not intended) for putting sep second is > that you can give it a default value: > >def join(iterable, sep=""): return sep.join(iterable) One argument against the default is that it is specific to the str type. If you

Re: How clean/elegant is Python's syntax?

2013-05-31 Thread Ian Kelly
On Fri, May 31, 2013 at 4:16 AM, Fábio Santos wrote: > On Fri, May 31, 2013 at 10:08 AM, Alister wrote: >> I think that is the winning argument. >> Next question is what should be the default ("", " " or',')? > > join, comma_join, whitejoin, linejoin variants, with different defaults? The more s

Re: Too many python installations. Should i remove them all and install the latest?

2013-05-31 Thread Ian Kelly
On Fri, May 31, 2013 at 9:41 AM, Νικόλαος Κούρας wrote: > Τη Παρασκευή, 31 Μαΐου 2013 6:37:06 μ.μ. UTC+3, ο χρήστης Fábio Santos έγραψε: > >> Check if python3 and python3.3 aren't the same. Run them and look at the >> "intro" > lines. > > root@nikos [~]# python -V > Python 2.6.6 > root@nikos [~]#

Re: Too many python installations. Should i remove them all and install the latest?

2013-05-31 Thread Ian Kelly
On Fri, May 31, 2013 at 11:10 AM, Νικόλαος Κούρας wrote: > root@nikos [~]# ls -al /usr/bin/python* > -rwxr-xr-x 3 root root 4864 Feb 22 02:00 /usr/bin/python* > lrwxrwxrwx 1 root root6 Apr 5 20:34 /usr/bin/python2 -> python* > -rwxr-xr-x 3 root root 4864 Feb 22 02:00 /usr/bin/python2.6* > -rw

Re: Too many python installations. Should i remove them all and install the latest?

2013-05-31 Thread Ian Kelly
On Fri, May 31, 2013 at 11:16 AM, Νικόλαος Κούρας wrote: > root@nikos [~]# which python > /usr/bin/python > root@nikos [~]# which python2 > /usr/bin/python2 > root@nikos [~]# which python3 > /root/.local/lib/python2.7/bin/python3 > root@nikos [~]# which python3.3 > /root/.local/lib/python2.7/bin/p

Re: Too many python installations. Should i remove them all and install the latest?

2013-05-31 Thread Ian Kelly
On Fri, May 31, 2013 at 11:42 AM, Νικόλαος Κούρας wrote: > OMG i gave by mistake > > root@nikos [/]# rm -rf /root/.local/ > > did i screwed up my remote VPS which i host 10 peoples webpages? I don't know, is that where you were keeping the data? The website still appears to be working, as best I

Re: Too many python installations. Should i remove them all and install the latest?

2013-05-31 Thread Ian Kelly
On Fri, May 31, 2013 at 5:30 PM, Νικόλαος Κούρας wrote: > Indeed i have comiled python 2.7 and 3.3 form source after wget and > ./configure an make install > > but i belive somehting is mixed up althouh python works ok. > > root@nikos [/opt/python3/bin]# ls -al > ... > root@nikos [/opt/python3/bi

Re: PyWart: The problem with "print"

2013-06-03 Thread Ian Kelly
On Sun, Jun 2, 2013 at 6:16 PM, Jason Swails wrote: > I'm actually with RR in terms of eliminating the overhead involved with > 'dead' function calls, since there are instances when optimizing in Python > is desirable. I actually recently adjusted one of my own scripts to > eliminate branching an

Re: Too many python installations. Should i remove them all and install the latest?

2013-06-03 Thread Ian Kelly
On May 31, 2013 6:27 PM, "Chris Angelico" wrote: > Yeah. I know that particular one because I have l aliased to ls -CF > (aka --columns --classify), mainly because it came that way as a > commented-out entry in my first Debian. Have since become quite > accustomed to it; to me, 'l' means 'look' (I

Re: Bools and explicitness [was Re: PyWart: The problem with "print"]

2013-06-04 Thread Ian Kelly
On Tue, Jun 4, 2013 at 9:44 AM, Rick Johnson wrote: > It is my firm belief that truth testing a value that is not > a Boolean should raise an exception. If you want to convert > a type to Boolean then pass it to the bool function: > > lst = [1,2,3] > if bool(lst): > do_something >

Re: Do you consider Python a 4GL? Why (not)?

2013-06-05 Thread Ian Kelly
On Tue, Jun 4, 2013 at 6:38 PM, Carlos Nepomuceno wrote: > I don't have an opinion yet, but I've found contradictory evidence from many > sources, such as: > > "A domain-specific language (DSL) is a type of programming language or > specification language in software development and domain enginee

Re: Bools and explicitness [was Re: PyWart: The problem with "print"]

2013-06-05 Thread Ian Kelly
On Wed, Jun 5, 2013 at 10:25 PM, Russ P. wrote: > I recall reading a few years ago that Guido was thinking about adding > optional type annotations. I don't know if that went anywhere or not, but I > thought it was a good idea. Eventually I got tired of waiting, and I realized > that I just wan

Re: Python Game Development?

2013-06-07 Thread Ian Kelly
On Fri, Jun 7, 2013 at 9:53 AM, wrote: > I was planning on making a small 2D game in Python. Are there any libraries > for this? I know of: > > • Pygame - As far as I know it's dead and has been for almost a year > • PyOgre - Linux and Windows only(I do have those, but I want multi-platform) > •

Re: Python Game Development?

2013-06-07 Thread Ian Kelly
On Fri, Jun 7, 2013 at 10:28 AM, Eam onn wrote: > Do you know of any tutorial for PyGame? Preferably a video tutorial but any > tutorial at all is fine! I can't seem to find any, even on pygame.org!!! I'd start here: http://www.pygame.org/wiki/tutorials -- http://mail.python.org/mailman/listinf

Re: Python Game Development?

2013-06-07 Thread Ian Kelly
On Fri, Jun 7, 2013 at 10:35 AM, Ian Kelly wrote: > On Fri, Jun 7, 2013 at 10:28 AM, Eam onn wrote: >> Do you know of any tutorial for PyGame? Preferably a video tutorial but any >> tutorial at all is fine! I can't seem to find any, even on pygame.org!!! >

Re: Python Game Development?

2013-06-07 Thread Ian Kelly
On Fri, Jun 7, 2013 at 11:53 AM, Eam onn wrote: > Pygame isn't too good. You still need a lot of other libraries from what I > understand(like for physics). Is there any alternative for 2D? I don't know of any Python libraries that provide both a rendering engine and a physics engine. I'm not s

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Ian Kelly
On Mon, Jun 10, 2013 at 7:57 AM, Rui Maciel wrote: > # Case A: this works > model.points[0].position = [2,3,4] > line.points > > # Case B: this doesn't work > test.model.points[0] = test.Point(5,4,7) > line.points > > > > Is there a Python way of getting the same effect with Case B? It's inform

Re: PyGame tutorial?

2013-06-11 Thread Ian Kelly
On Tue, Jun 11, 2013 at 9:47 AM, Eam onn wrote: > Is there a PyGame tutorial out there? I've seen TheNewBoston's tuts, but he > didn't finish his. MetalX100 did a VERY good tutorial. I've been having > trouble with some player movement because he isn't moving smoothly, he jumps. > If I add 5 pi

Re: PyGame tutorial?

2013-06-11 Thread Ian Kelly
On Tue, Jun 11, 2013 at 10:56 AM, Eam onn wrote: > Also, is there a specific forum for PyGame or is here fine? Go to pygame.org and click the link "Help (irc, lists)" in the navigation menu. I could give you the direct link, but I want to point out that this stuff is readily available on the pyg

Re: PyGame tutorial?

2013-06-11 Thread Ian Kelly
On Tue, Jun 11, 2013 at 10:57 AM, Eam onn wrote: > On Tuesday, June 11, 2013 5:31:22 PM UTC+1, Mark Lawrence wrote: >> Try typing "pygame tutorial" into your favourite search and see what >> comes back, you might be pleasantly surprised. > > Typed it in several times over the past 2 years and noth

Re: Cutting a deck of cards

2013-06-12 Thread Ian Kelly
On Sun, May 26, 2013 at 12:16 PM, Carlos Nepomuceno wrote: > list(range(13 * 4 * decks)) == range(13 * 4 * decks) Not in Python 3. -- http://mail.python.org/mailman/listinfo/python-list

Re: Cutting a deck of cards

2013-06-12 Thread Ian Kelly
On Sun, May 26, 2013 at 12:17 PM, RVic wrote: > Ah, brilliant -- yes, this is so much more elegant in Python: > > #now cut the cards > x = random.randrange(2,range(13 * 4 * decks)) > cards = cards[x:]+cards[:x] Or if for some reason you want to do it in place: cards[x:], cards[:x] = cards[:x], c

Re: How to get an integer from a sequence of bytes

2013-06-12 Thread Ian Kelly
On Tue, Jun 4, 2013 at 3:49 PM, Chris Angelico wrote: > So... can we cite http://xkcd.com/859/ in two threads at once, or does > that create twice as much tension? No, you just look at one of them upside-down, and then they cancel each other out. -- http://mail.python.org/mailman/listinfo/python

Re: My son wants me to teach him Python

2013-06-12 Thread Ian Kelly
On Wed, Jun 12, 2013 at 4:06 PM, John Ladasky wrote: > On Wednesday, June 12, 2013 8:34:15 PM UTC, Chris Angelico wrote: >>Unless you have a good reason for sticking with 2.x, go with 3.x. > > I agree, Chris, I will be teaching my son Python 3 from the start. In fact, > I'm in the middle of a me

Re: Creating a Super Simple WWW Link, Copy, & Paste into Spreadsheet Program

2013-06-13 Thread Ian Kelly
On Thu, Jun 13, 2013 at 1:41 PM, Joel Goldstick wrote: > there is a python module that reads and writes to excel files. look for > that More than one, actually, and which to use depends on whether "Excel files" means the .xls or .xlsx format. On Windows, the most flexible solution is going to b

Re: Don't feed the help-vampire

2013-06-15 Thread Ian Kelly
On Fri, Jun 14, 2013 at 6:09 AM, rusi wrote: > Since identifying a disease by the right name is key to finding a > cure: > Nikos is not trolling or spamming; he is help-vampiring. I think he's a very dedicated troll elaborately disguised as a help vampire. Remember that one of the names he previ

Re: Timsort in Cpython

2013-06-16 Thread Ian Kelly
On Sat, Jun 15, 2013 at 10:05 PM, wrote: > Yes I've read it. Very interesting read. There are other resources too online > that make it very clear, for instance the wikipedia articles is pretty good. > > Though, if anyone would be interested in helping me out further -- though by > all means, I

Re: My son wants me to teach him Python

2013-06-17 Thread Ian Kelly
On Sun, Jun 16, 2013 at 3:55 AM, Cameron Simpson wrote: > On 14Jun2013 20:12, Dennis Lee Bieber wrote: > | [...] PowerShell has been > | available as a download on WinXP and standard on Win7 [PS 3 is a > | download for Win7, stock on real Win8]. > | While I'm not fluent in it, there are som

Re: Timsort in Cpython

2013-06-19 Thread Ian Kelly
On Wed, Jun 19, 2013 at 11:18 AM, wrote: > The second argument takes the tuple which determines which varialble(key) to > use the comparator on. And the third determines whether to return the list in > ascending or descending order. That's not exactly correct. The arguments are listed in that

Re: Don't feed the troll...

2013-06-19 Thread Ian Kelly
On Wed, Jun 19, 2013 at 4:57 AM, Antoon Pardon wrote: > I don't remember making such a claim. What I do remember is > you among others claiming that the problem was not (so much) > the troll (Nikos) but the others. Count me among those who feel this way. > And your last conclusion is unsound. Yo

Re: Problem with the "for" loop syntax

2013-06-19 Thread Ian Kelly
On Wed, Jun 19, 2013 at 3:14 PM, arturo balbuena wrote: > Hello guys... > I´m a begginer in Python, I'm doing a Hangman game, but I'm having trouble > with this blank space. I would be greatful if you help me. :) > > Here's my code: > > http://snipplr.com/view/71581/hangman/ > > When I run the co

Re: Default Value

2013-06-20 Thread Ian Kelly
On Thu, Jun 20, 2013 at 11:19 AM, Chris Angelico wrote: > On Fri, Jun 21, 2013 at 3:12 AM, rusi wrote: >> Python (and all the other 'cool' languages) dont have gotchas because >> someone malevolently put them there. >> In most cases, the problem is seen too late and the cost of changing >> entren

Re: Don't feed the troll...

2013-06-20 Thread Ian Kelly
On Thu, Jun 20, 2013 at 3:41 AM, Antoon Pardon wrote: > There are two problems with your reasoning. The first is that you > are equivocating on "expect". "Expect" can mean you will be surprised > if it doesn't happen but it can also mean you will feel indignant or > disappointed or something simil

Re: Don't feed the troll...

2013-06-21 Thread Ian Kelly
On Fri, Jun 21, 2013 at 3:18 AM, Antoon Pardon wrote: > Op 21-06-13 04:40, Ian Kelly schreef: > >> On Thu, Jun 20, 2013 at 3:41 AM, Antoon Pardon >> wrote: >>> There are two problems with your reasoning. The first is that you >>> are equivocating on &qu

Re: Default Value

2013-06-21 Thread Ian Kelly
On Fri, Jun 21, 2013 at 7:15 PM, Steven D'Aprano wrote: > On Fri, 21 Jun 2013 23:49:51 +0100, MRAB wrote: > >> On 21/06/2013 21:44, Rick Johnson wrote: > [...] >>> Which in Python would be the "MutableArgumentWarning". >>> >>> *school-bell* >>> >> I notice that you've omitted any mention of how yo

Re: Default Value

2013-06-21 Thread Ian Kelly
On Fri, Jun 21, 2013 at 7:15 PM, Rick Johnson wrote: >> > Let's imagine for a second if Python allowed mutable keys in >> > a dictionary, >> which it does > > Am i just to take your word for this? You cannot provide an > example? Here, allow me to "break the ice": > > # Literal > py> d = {

Re: Default Value

2013-06-21 Thread Ian Kelly
On Fri, Jun 21, 2013 at 7:37 PM, Chris Angelico wrote: class HashableList(list): > def __hash__(self): > return 42 Hey, we both picked exactly the same example! -- http://mail.python.org/mailman/listinfo/python-list

Re: Default Value

2013-06-22 Thread Ian Kelly
On Sat, Jun 22, 2013 at 10:49 AM, Dennis Lee Bieber wrote: > On Fri, 21 Jun 2013 19:27:42 -0600, Ian Kelly > declaimed the following: > >>While we're at it, I would like to petition for a function >>terminates(f, args) that I can use to determine whether a function

Re: How can i fix this?

2013-06-22 Thread Ian Kelly
On Sat, Jun 22, 2013 at 3:50 PM, Борислав Бориславов wrote: > this doesent help me at all It shows you how to include multiple statements in the body of the if block. If you're having trouble getting it to work, then please copy and paste the exact code that you're running for us along with the

Re: What is the semantics meaning of 'object'?

2013-06-22 Thread Ian Kelly
On Sat, Jun 22, 2013 at 9:20 PM, Steven D'Aprano wrote: > * on the down side, automatic delegation of special double-underscore > methods like __getitem__ and __str__ doesn't work with new-style classes. I actually consider that an up side. Sure it's inconvenient that you can't delegate all such

Re: What is the semantics meaning of 'object'?

2013-06-22 Thread Ian Kelly
On Sat, Jun 22, 2013 at 11:23 PM, Steven D'Aprano wrote: > On Sat, 22 Jun 2013 22:27:10 -0600, Ian Kelly wrote: >> I actually consider that an up side. Sure it's inconvenient that you >> can't delegate all such methods at once just by overriding >> __

Re: What is the semantics meaning of 'object'?

2013-06-23 Thread Ian Kelly
On Sun, Jun 23, 2013 at 7:35 AM, Adam Jiang wrote: > Another question raised here is that what is the proper way to refer > to parent class? For example, > > class A(object): > def __init__(self, arg): > print "A" > > class B(A): > def __init__(self, arg): >

Re: What is the semantics meaning of 'object'?

2013-06-23 Thread Ian Kelly
On Sun, Jun 23, 2013 at 10:49 AM, Roy Smith wrote: > One thing I've never understood about Python 2.x's multiple inheritance > (mostly because I almost never use it) is how you do something like this: > > class Base1(object): >def __init__(self, foo): > self.foo = foo > > class Base2(obj

Re: What is the semantics meaning of 'object'?

2013-06-23 Thread Ian Kelly
On Sun, Jun 23, 2013 at 11:08 AM, Ian Kelly wrote: > On Sun, Jun 23, 2013 at 10:49 AM, Roy Smith wrote: >> am I missing something here? > > Yes, you're missing that super() does not simply call the base class, > but rather the next class in the MRO for whatever the type o

Re: What is the semantics meaning of 'object'?

2013-06-23 Thread Ian Kelly
On Sun, Jun 23, 2013 at 11:36 AM, Steven D'Aprano wrote: > On Sun, 23 Jun 2013 11:18:41 -0600, Ian Kelly wrote: > >> Incidentally, although super() is useful, it's not perfect, and this is >> one of my grievances with it: that a user can, based upon the name, draw

Re: What is the semantics meaning of 'object'?

2013-06-23 Thread Ian Kelly
On Sun, Jun 23, 2013 at 12:46 PM, Steven D'Aprano wrote: > All is not lost, there are ways to make your classes cooperative. The > trick is to have your classes' __init__ methods ignore keyword arguments > they don't know what to do with. object used to do the same thing, but it > no longer does,

Re: What is the semantics meaning of 'object'?

2013-06-23 Thread Ian Kelly
On Sun, Jun 23, 2013 at 12:50 PM, Steven D'Aprano wrote: > What else would you call a function that does lookups on the current > object's superclasses? Well, as James Knight points out in the "Super Considered Harmful" article, the equivalent in Dylan is called "next-method", which isn't a valid

Re: What is the semantics meaning of 'object'?

2013-06-24 Thread Ian Kelly
On Mon, Jun 24, 2013 at 9:00 AM, Rotwang wrote: > On 24/06/2013 07:31, Steven D'Aprano wrote: > >> I daresay that there are good reasons why new-style classes don't do the >> same thing, but the point is that had the Python devs had been >> sufficiently interested in keeping the old behaviour, and

Re: What is the semantics meaning of 'object'?

2013-06-24 Thread Ian Kelly
On Mon, Jun 24, 2013 at 9:58 AM, Mark Janssen wrote: >>> Mostly I'm saying that super() is badly named. >> >> What else would you call a function that does lookups on the current >> object's superclasses? > > ^. You make a symbol for it. ^__init__(foo, bar) On the one hand, eww. On the other h

Re: Is this PEP-able? fwhile

2013-06-24 Thread Ian Kelly
On Mon, Jun 24, 2013 at 1:52 PM, wrote: > Syntax: > > fwhile X in ListY and conditionZ: > > The following would actually exactly as: for X in ListY: > > fwhile X in ListY and True: > > fwhile would act much like 'for', but would stop if the condition after the > 'and' is no longer True. > > The

Re: Is this PEP-able? fwhile

2013-06-24 Thread Ian Kelly
On Mon, Jun 24, 2013 at 1:52 PM, wrote: > Syntax: > > fwhile X in ListY and conditionZ: Also, this syntax is ambiguous. Take for example the statement: fwhile X in ListA and ListB and ListC and ListD: At which "and" does the iterable expression stop and the condition expression begin? -- htt

Re: Is this PEP-able? fwhile

2013-06-24 Thread Ian Kelly
On Mon, Jun 24, 2013 at 3:01 PM, Ian Kelly wrote: > On Mon, Jun 24, 2013 at 2:34 PM, Fábio Santos > wrote: >> This can probably be best achieved by adding to the existing for loop, >> so maybe taking advantage of the existing for...if syntax and adding >> for...whil

Re: Is this PEP-able? fwhile

2013-06-24 Thread Ian Kelly
On Mon, Jun 24, 2013 at 2:34 PM, Fábio Santos wrote: > This can probably be best achieved by adding to the existing for loop, > so maybe taking advantage of the existing for...if syntax and adding > for...while would be a better idea? The for...if syntax only exists for comprehensions and generat

Re: Is this PEP-able? fwhile

2013-06-24 Thread Ian Kelly
On Mon, Jun 24, 2013 at 4:41 PM, Fábio Santos wrote: > > On 24 Jun 2013 22:29, "Ian Kelly" wrote: >> >> On Mon, Jun 24, 2013 at 2:34 PM, Fábio Santos >> wrote: >> > This can probably be best achieved by adding to the existing for loop, >> >

Re: Is this PEP-able? fwhile

2013-06-24 Thread Ian Kelly
On Mon, Jun 24, 2013 at 4:35 PM, Chris Angelico wrote: > On Tue, Jun 25, 2013 at 8:30 AM, Tim Chase > wrote: >> On 2013-06-25 07:38, Chris Angelico wrote: >>> Python has no issues with breaking out of loops, and even has >>> syntax specifically to complement it (the 'else:' clause). Use >>> break

Re: Is this PEP-able? fwhile

2013-06-24 Thread Ian Kelly
On Mon, Jun 24, 2013 at 6:41 PM, wu wei wrote: > It's still possible by raising a StopIteration within the condition > function: > > def is_part_of_header(x): > if header_condition: > return True > else: > raise StopIteration Which is basically just tak

Re: Default Value

2013-06-25 Thread Ian Kelly
On Sat, Jun 22, 2013 at 8:40 AM, Antoon Pardon wrote: > Are you two guys now egging on Rick Johnson? No. Rick is incorrigible, and I would have been surprised if he responded to that anyway. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this PEP-able? fwhile

2013-06-25 Thread Ian Kelly
On Mon, Jun 24, 2013 at 2:33 PM, wrote: > Ian, > > Regarding your first message breaks are anathema (for many) and your other > alternative is complicated. > > Regarding your second post, anding of lists is allowed, but generally > returns non-utile results, but point taken. > I guess technically

Re: Is this PEP-able? fwhile

2013-06-25 Thread Ian Kelly
On Tue, Jun 25, 2013 at 1:21 AM, Chris Angelico wrote: > On Tue, Jun 25, 2013 at 2:20 PM, Benjamin Kaplan > wrote: >> The reason I was given (which I promptly ignored, of course) is that >> it's "best practice" to only have one exit point for a block of code. >> Only one way of terminating your l

Re: What is the semantics meaning of 'object'?

2013-06-25 Thread Ian Kelly
On Sun, Jun 23, 2013 at 1:33 PM, Antoon Pardon wrote: > Op 23-06-13 18:35, Steven D'Aprano schreef: >> Please don't. This is false economy. The time you save will be trivial, >> the overhead of inheritance is not going to be the bottleneck in your >> code, and by ignoring super, you only accomplis

Re: newbie question

2013-06-25 Thread Ian Kelly
On Sat, Jun 22, 2013 at 8:49 PM, Gene Heskett wrote: > On Saturday 22 June 2013 22:46:51 christheco...@gmail.com did opine: > >> Writing simple program asking a question with the answer being >> "yes"...how do I allow the correct answer if user types Yes, yes, or >> YES? >> >> Thanks > > AND each

Re: Limit Lines of Output

2013-06-25 Thread Ian Kelly
On Tue, Jun 25, 2013 at 2:31 PM, Joshua Landau wrote: > On 25 June 2013 21:22, Bryan Britten wrote: >> Ah, I always forget to mention my OS on these forums. I'm running Windows. > > Supposedly, Windows has "more" > [http://superuser.com/questions/426226/less-or-more-in-windows], > > For Linux+les

Re: What is the semantics meaning of 'object'?

2013-06-25 Thread Ian Kelly
On Tue, Jun 25, 2013 at 3:58 PM, Mark Janssen wrote: > Ah, and here we see the weakness in the object architecture that has > evolved in the past decade (not just in Python, note). It hasn't > really ironed out what end is what. Here's a proposal: the highest, > most "parental", most general o

Re: What is the semantics meaning of 'object'?

2013-06-25 Thread Ian Kelly
On Tue, Jun 25, 2013 at 4:17 PM, Chris Angelico wrote: > The main problem is getting to the top/end of the call chain. Classic > example is with __init__, but the same problem can also happen with > other calls. Just a crazy theory, but would it be possible to > construct a black-holing object tha

Re: What is the semantics meaning of 'object'?

2013-06-25 Thread Ian Kelly
On Tue, Jun 25, 2013 at 4:38 PM, Mark Janssen wrote: > Sorry my last message got sent prematurely. Retrying... > >> So instead of super(), you would have sub()? It's an interesting >> concept, but I don't think it changes anything. You still have to >> design your classes cooperatively if you e

Re: What is the semantics meaning of 'object'?

2013-06-25 Thread Ian Kelly
On Tue, Jun 25, 2013 at 5:07 PM, Ian Kelly wrote: > On Tue, Jun 25, 2013 at 4:38 PM, Mark Janssen > wrote: >> The issue of classes cooperating isn't as big as it seems, because >> since you're working now from a useful, agreed-upon common base (the >> non-

Re: What is the semantics meaning of 'object'?

2013-06-25 Thread Ian Kelly
On Tue, Jun 25, 2013 at 5:19 PM, Mark Janssen wrote: >>> Combining integers with sets I can make >>> a Rational class and have infinite-precision arithmetic, for example. >> >> Combining two integers lets you make a Rational. > > Ah, but what is going to group them together? You see you've alread

Re: What is the semantics meaning of 'object'?

2013-06-26 Thread Ian Kelly
On Tue, Jun 25, 2013 at 7:07 PM, Mark Janssen wrote: >> When you inherit a "set" to make a Rational, you're making the >> statement (to the interpreter, if nothing else) that a Rational is-a >> set. > > No you don't *inherit* a set to make a Rational, although you gain a > set to make it. Okay, t

Re: Don't feed the troll...

2013-06-26 Thread Ian Kelly
On Mon, Jun 24, 2013 at 7:37 AM, Antoon Pardon wrote: > What do you mean with not a participant in the past? As far > as I can see his first appearance was in dec 2011. That is > over a year ago. It also seems that he always find people > willing to engage with him. Is how the group treats him > n

Re: What is the semantics meaning of 'object'?

2013-06-26 Thread Ian Kelly
On Wed, Jun 26, 2013 at 5:54 PM, Steven D'Aprano wrote: > No. But "the current object" is not Base1, but an instance of Derived, > and Base2 *is* an ancestor of Derived. Perhaps if I had said "self" > instead of current object, you wouldn't have made this error. If so, I > apologise for confusing

  1   2   3   4   5   6   7   8   9   10   >