On Sun, 05 Aug 2012 19:12:35 -0400, Roy Smith wrote:
>> Good lord. I'd rather read C++ than UML. And I can't read C++.
>
> UML is under-rated. I certainly don't have any love of the 47 different
> flavors of diagram, but the basic idea of having a common graphical
> language for describing how
On Sun, 05 Aug 2012 18:19:55 -0500, Tim Chase wrote:
> On 08/05/12 17:00, John Mordecai Dildy wrote:
>> since when did we start talking about lisp?
>
> Though not a lisper, the Python tie-in was my reply: Python (among many
> other languages) doesn't allow a "-" as a character in identifiers as
On Sun, 05 Aug 2012 21:14:04 -0400, Dennis Lee Bieber wrote:
> While I've probably used singletons (usually as sentinels in queues,
I don't know your code, but if I were to take a wild guess, I would say
that apart from None, and True/False, you probably haven't.
NotImplemented and Ellipsis are
On Mon, 06 Aug 2012 17:17:33 +0100, Mark Lawrence wrote:
> Please see my comment at the bottom hint hint :)
Please trim unnecessary quoted text.
We don't need to see the entire thread of comment/reply/reply-to-reply
duplicated in *every* email.
--
Steven
--
http://mail.python.org/mailman/l
On Mon, 06 Aug 2012 09:05:50 -0700, Ethan Furman wrote:
> These are not the errors an intermediate user would make, nor the
> questions an intermediate user would ask. These are the errors that
> somebody who doesn't know Python would make.
> P.S. The scale I am accustomed to is Novice -> Int
On Mon, 06 Aug 2012 19:16:45 +0200, Tom P wrote:
>> def my_generator():
>> yield 9
>> yield 100
>> for i in range(200, 250):
>> yield i
>> yield 5
>>
>>
> Thanks, I'll look at that but I think it just moves the clunkiness from
> one place in the code to another.
And i
On Mon, 06 Aug 2012 22:46:38 +0200, Mok-Kong Shen wrote:
> If I have a string "abcd" then, with 8-bit encoding of each character,
> there is a corresponding 32-bit binary integer. How could I best obtain
> that integer and from that integer backwards again obtain the original
> string? Thanks in a
On Mon, 06 Aug 2012 09:55:24 +0100, lipska the kat wrote:
> On 06/08/12 01:22, Steven D'Aprano wrote:
>> On Sun, 05 Aug 2012 20:46:23 +0100, lipska the kat wrote:
>>
>>>
>>> Object Oriented programming is a mindset, a way of looking at that
>>> part
On Mon, 06 Aug 2012 10:24:10 +0100, lipska the kat wrote:
> er, the point I was trying to make is that when you say 'interface' it
> could mean so many things. If you say 'facade' everyone knows exactly
> what you are talking about. And that is EXACTLY the point.
The whole point of design pattern
On Mon, 06 Aug 2012 17:23:19 +0100, lipska the kat wrote:
> On 06/08/12 13:19, rusi wrote:
>> I suggest this
>> http://steve-yegge.blogspot.in/2006/03/execution-in-kingdom-of-
nouns.html
>
> http://bpfurtado.livejournal.com/2006/10/21/
Unfortunately the author (Bruno Furtado) has missed the poi
On Tue, 07 Aug 2012 09:18:26 -0400, Roy Smith wrote:
> I thought modules could not get imported twice. The first time they get
> imported, they're cached, and the second import just gets you a
> reference to the original. Playing around, however, I see that it's
> possible to import a module twi
On Tue, 07 Aug 2012 10:19:31 +0100, lipska the kat wrote:
> On 07/08/12 06:19, Steven D'Aprano wrote:
[...]
>> But what *really* gets me is not the existence of poor terminology. I
>> couldn't care less what terminology Java programmers use among
>> themselves.
&
On Tue, 07 Aug 2012 08:30:15 -0700, Thomas Draper wrote:
> I want to use with..as in a "reversible circuit generator". However, it
> seems that @contextmanager changes the expected nature of the class. I
> tried to distill the problem down to a simple example.
Nothing to do with contextmanager. T
On Tue, 07 Aug 2012 08:25:43 -0700, Roy Smith wrote:
> On Tuesday, August 7, 2012 9:52:59 AM UTC-4, Steven D'Aprano wrote:
>
>> In general, you should avoid non-idempotent code. You should doubly
>> avoid it during imports, and triply avoid it on days ending wi
On Sun, 05 Aug 2012 19:44:31 -0700, alex23 wrote:
> I think you've entirely missed the point of Design Patterns.
Perhaps I have. Or perhaps I'm just (over-)reacting to the abuse of
Patterns:
http://c2.com/cgi/wiki?DesignPatternsConsideredHarmful
or maybe I'm just not convinced that Design Patt
On Tue, 07 Aug 2012 17:07:59 -0700, alex23 wrote:
>> I'm pretty sure that people could talk about good coding design before
>> the Gof4. As you say, they didn't invent the patterns. So people
>> obviously wrote code, and talked about algorithms, without the Gof4
>> terminology.
>
> So what did pe
On Wed, 08 Aug 2012 09:27:40 -0700, rusi wrote:
> I once sat for a presentation of a wannabe university teacher. The
> subject she chose was object-orientation.
>
> She spent some time on the usual dope about employee, manager etc.
> Finally she reached the base-class: Person.
>
> Or so we thoug
On Wed, 08 Aug 2012 18:20:40 -0700, bruceg113355 wrote:
> z = []
> z.append(0)
> z.append(1)
> z.append(2)
> z.append(3)
> z.append(4)
> z.append(5)
> z.append(6)
> z.append(7)
That can be written as:
z = [0, 1, 2, 3, 4, 5, 6, 7]
Or better still:
z = range(8) # In Python 3, use list(range(8))
On Thu, 09 Aug 2012 19:16:58 -0500, Tim Chase wrote:
> On 08/09/12 18:33, Mark Lawrence wrote:
>> On 10/08/2012 00:24, Roy Smith wrote:
... you mean, Python lets you make a hash of it?
>>>
>>> Only if you order it with spam, spam, spam, spam, spam, spam, and
>>> spam.
>>
>> Now now gentlemen
On Sat, 11 Aug 2012 11:24:48 +0200, Hans Mulder wrote:
> On 11/08/12 09:07:51, pozz wrote:
>> When the main thread wants to close the serial port, the receiving
>> thread can be killed
>
>
> How would you do that?
>
> IFAIK, there is no way in Python to kill a thread.
Correct.
> The usual wo
On Fri, 10 Aug 2012 08:53:43 +1000, Chris Angelico wrote:
> On Fri, Aug 10, 2012 at 8:26 AM, Dave Angel wrote:
>> On 08/09/2012 06:03 PM, Andrew Cooper wrote:
>>> O(n) for all other entries in the dict which suffer a hash collision
>>> with the searched entry.
>>>
>>> True, a sensible choice of h
On Sat, 11 Aug 2012 10:53:37 +0100, Raffaele Ricciardi wrote:
> Hello there,
>
> I'm writing a X Windows program to perform some actions when modifier
> keys have
> been released. After looking into the Pykeylogger project
> (pykeylogger.sourceforge.net), I've gone as far as detecting all events
On Sat, 11 Aug 2012 09:54:56 -0700, Giacomo Alzetta wrote:
> I've noticed some incongruities regarding in-place exponentiation.
>
> On the C side nb_inplace_power is a ternary function, like nb_power (see
> here:
> http://docs.python.org/c-api/typeobj.html?
highlight=numbermethods#PyNumberMethods
On Sun, 12 Aug 2012 00:14:27 -0700, Giacomo Alzetta wrote:
> From The Number Protocol(http://docs.python.org/c-api/number.html). The
> full text is:
>
> PyObject* PyNumber_InPlacePower(PyObject *o1, PyObject *o2, PyObject
> *o3)
> Return value: New reference.
>
> **See the built-in funct
On Sat, 11 Aug 2012 17:54:40 -0700, Paul Rubin wrote:
> John Ladasky writes:
[...]
>> If the length of the list L is odd, I want to process it once. If
>> len(L) is even, I want to process it twice
>> for x in range(1 + not(len(L) % 2)):
>
> If you really have to do something like that, I
On Sun, 12 Aug 2012 17:15:12 -0700, alex23 wrote:
> On Aug 10, 7:37 pm, Mark Lawrence wrote:
>> Well whatever you do *DON'T* mention Cython. I mentioned it just now
>> but I think I've got away with it.
>
> While I'm not against threads straying off topic, you're beginning to
> come across as a
On Sun, 12 Aug 2012 23:06:19 +, kj wrote:
> Is there an *explicitly stated* reason (e.g. in a PEP, or in some python
> dev list message) for why the inspect module (at least for Python 2.7)
> does not include anything like a "currentcallable()" function that would
> *stably*[1] return the curr
On Mon, 13 Aug 2012 03:18:49 -0700, Xantipius wrote:
> subj
The same way as you compressed it, only in reverse.
When you ask a sensible question, I'm sure that somebody will give you a
sensible answer.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 13 Aug 2012 12:24:55 +0100, Blind Anagram wrote:
> Here is a fairly short bit of code which produces the exception:
>
> for pre in ('12', '13', '14', '15', '21' ):
> n = int(pre + '543')
> s = str(n * n)
> if len(set(s)) == 9:
> print(n, s)
Um, I don't think so.
>>> for pre
On Mon, 13 Aug 2012 18:07:26 +0100, Mark Lawrence wrote:
> On 13/08/2012 17:14, alex23 wrote:
>> On Aug 13, 10:37 pm, Mark Lawrence wrote:
>>> Why on your say so?
>>
>> My mistake, I didn't realise you wanted to sound so tedious. Knock
>> yourself out.
>>
>>
>>
> Yes m'lud. Do I lick your boots
On Tue, 14 Aug 2012 01:34:46 +0100, Mark Lawrence wrote:
> When did you seek my permission to call me by my forename?
Sheesh. It's 2012, not 1812. If you sign your posts with your full name,
you have to expect that people will call you "Mark" rather than "Mr
Lawrence" or "Lord High Mucky-Muck G
On Mon, 13 Aug 2012 22:12:48 -0700, mullapervez wrote:
> Hi,
>
> I wanna call perl script in HTML form n store that data in DB using
> Python.
>
> How can i do this...??
>
> Please help me
Okay, let me give you some general advice first, then some programming
advice
If your question look
On Tue, 14 Aug 2012 16:34:01 +1000, Simon Cropper wrote:
> Hi Everyone,
>
> I just had a great idea for a new python module. I haven't bothered
> googling it or doing any research.
>
> I need help putting together some code; today preferably, my boss is on
> my back. Can someone please contribut
On Mon, 13 Aug 2012 23:21:34 -0700, Pervez Mulla wrote:
> I wanna call perl objects using Python . I checked in internet ,I can
> make use of inline function for this, But in HTML..??
You need to explain more about your problem, because I don't understand
what you want to do in detail.
For
On Tue, 14 Aug 2012 12:38:24 +0100, Mark Lawrence wrote:
> On 14/08/2012 04:00, Steven D'Aprano wrote:
[...]
> For the record I was asked to use my full name rather than my user name
> on Python mailing lists. But see also my earlier reply to you on the
> "save dictio
On Mon, 13 Aug 2012 17:53:32 +0100, andrea crotti wrote:
> I started to work on project A, then switched completely to project B
> and in the transiction I copied over a lot of code with the
> corresponding tests, and I started to modify it.
>
> Now it's time to work again on project A, but I don
On Wed, 15 Aug 2012 07:46:31 +1000, Chris Angelico wrote:
> I have my surname in my From address, but I tend to sign my posts
> "ChrisA" (no relation, btw, to DaveA, though our surnames are similar).
> That's generally been sufficient for distinguishing purposes, though if
> anyone wants a truly u
On Tue, 14 Aug 2012 21:40:10 +0200, Virgil Stokes wrote:
> You might find the following useful:
>
> def testFunc(startingList):
> xOnlyList = []; j = -1
> for xl in startingList:
> if (xl[0] == 'x'):
That's going to fail in the starting list contains an empty string. Use
xl.s
On Wed, 15 Aug 2012 11:44:29 +1000, Chris Angelico wrote:
> On Wed, Aug 15, 2012 at 9:55 AM, Steven D'Aprano
> wrote:
>> On Wed, 15 Aug 2012 07:46:31 +1000, Chris Angelico wrote:
>>
>>> I have my surname in my From address, but I tend to sign my posts
>>
On Wed, 15 Aug 2012 17:41:20 +1000, Chris Angelico wrote:
> On Wed, Aug 15, 2012 at 5:28 PM, Ian Kelly
> wrote:
>> Irrelevant. Why would an author adhering to common principles of style
>> ever use square-bracketed dots in a statement that he authored himself?
>
> You mean exactly the way he di
On Wed, 15 Aug 2012 17:57:47 +0100, MRAB wrote:
>> #!/usr/bin/python3
>> #_*_ coding: latin1 _*_
>>
> Aw well as the other replies, the "coding" line should be:
>
> #-*- coding: latin1 -*-
I don't believe that actually matters to Python. It may matter to Emacs
or some other editors, but Python
On Wed, 15 Aug 2012 23:17:41 +0200, Thomas Bach wrote:
> Hi list,
>
> I'm confronted with a strang problem I cannot find a clean solution for.
> I want a class that determines on instantiating its base classes
> dynamically. Consider the following two use cases
Some comments:
1) What you show a
On Wed, 15 Aug 2012 16:26:09 -0700, Ethan Furman wrote:
> Indexes have a new method (rebirth of an old one, really):
>
>.index_search(
> match,
> start=None,
> stop=None,
> nearest=False,
> partial=False )
[...]
Why "index_search" rather than just "search"?
>
On Thu, 16 Aug 2012 14:47:47 +0200, Hans Mulder wrote:
> On 8/08/12 04:14:01, Steven D'Aprano wrote:
>> NoneType raises an error if you try to create a second instance. bool
>> just returns one of the two singletons (doubletons?) again.
>>
>> py> type(None)()
On Thu, 16 Aug 2012 13:18:59 +0200, Virgil Stokes wrote:
> On 15-Aug-2012 02:19, Steven D'Aprano wrote:
>> On Tue, 14 Aug 2012 21:40:10 +0200, Virgil Stokes wrote:
>>
>>> You might find the following useful:
>>>
>>> def testFunc(startingList):
>&
On Thu, 16 Aug 2012 10:09:08 -0700, Richard Thomas wrote:
>> a is a Foo
>> b is a Foo
>> therefore a and b are the same type
>
> What you mean here is "a and b share a common base class".
No. I mean what I said: since a and b are both direct instances of Foo,
not subclasses, they are both the s
On Thu, 16 Aug 2012 10:03:51 -0700, Richard Thomas wrote:
> class Foo(object):
> def __new__(cls, arg):
> if isinstance(arg, list):
> cls = FooList
> elif isinstance(arg, dict):
> cls = FooDict
> return object.__new__(cls, arg)
>
> class FooList
On Thu, 16 Aug 2012 14:52:30 +0200, Thomas Bach wrote:
> I'm
> querying the crunchbase API which returns JSON data and is rather poorly
> documented. I want to create a data model for the companies listed on
> Crunchbase in order to be able to put the queried data in a data-base.
> As I am too laz
On Thu, 16 Aug 2012 19:18:18 +0200, Thomas Bach wrote:
> Imagine you have two data sets:
>
> d1 = {'foo': None}
> d2 = {'foo': 8}
>
> Where I would assume that d1 has "foo" not set. That's why I want this
> whole "merge"-thing in the first place: to be able to extract the type
> {'foo': None} fr
On Thu, 16 Aug 2012 19:11:19 -0400, Dave Angel wrote:
> On 08/16/2012 05:26 PM, Paul Rubin wrote:
>> Dave Angel writes:
>>> Everything else is implementation defined. Why should an
>>> implementation be forced to have ANY extra data structure to detect a
>>> static bug in the caller's code?
>> F
On Fri, 17 Aug 2012 08:43:50 +1000, Chris Angelico wrote:
> On Fri, Aug 17, 2012 at 6:54 AM, Eric Frederich
> wrote:
>> Hello,
>>
>> I have a bunch of Python bindings for a 3rd party software running on
>> the server side.
>> I can add client side extensions that communicate over some http / xml
On Fri, 17 Aug 2012 09:36:04 -0700, rusi wrote:
> I was in a corporate environment for a while. And carried my
> 'trim&interleave' habits there.
> And got gently scolded for seeming to hide things!!
Corporate email users are generally incompetent at email no matter what
email conventions you us
On Fri, 17 Aug 2012 04:50:43 -0700, Richard Thomas wrote:
> On Thursday, 16 August 2012 19:49:43 UTC+2, Steven D'Aprano wrote:
>> On Thu, 16 Aug 2012 10:03:51 -0700, Richard Thomas wrote:
>>
>> > class Foo(object):
>> > def __new__(cls, arg)
On Fri, 17 Aug 2012 11:45:02 -0700, wxjmfauth wrote:
> Le vendredi 17 août 2012 20:21:34 UTC+2, Jerry Hill a écrit :
>> On Fri, Aug 17, 2012 at 1:49 PM, wrote:
>>
>> > The character '…', Unicode name 'HORIZONTAL ELLIPSIS',
>> > is one of these characters existing in the cp1252, mac-roman
>> > c
On Fri, 17 Aug 2012 23:30:22 -0400, Dave Angel wrote:
> On 08/17/2012 08:21 PM, Ian Kelly wrote:
>> On Aug 17, 2012 2:58 PM, "Dave Angel" wrote:
>>> The internal coding described in PEP 393 has nothing to do with
>>> latin-1 encoding.
>> It certainly does. PEP 393 provides for Unicode strings to
On Sat, 18 Aug 2012 01:09:26 -0700, wxjmfauth wrote:
sys.version
> '3.2.3 (default, Apr 11 2012, 07:15:24) [MSC v.1500 32 bit (Intel)]'
timeit.timeit("('ab…' * 1000).replace('…', '……')")
> 37.32762490493721
> timeit.timeit("('ab…' * 10).replace('…', 'œ…')") 0.8158757139801764
>
sys
On Fri, 17 Aug 2012 21:41:07 -0700, Frank Koshti wrote:
> Hi,
>
> I'm new to regular expressions. I want to be able to match for tokens
> with all their properties in the following examples. I would appreciate
> some direction on how to proceed.
Others have already given you excellent advice to
On Sat, 18 Aug 2012 08:07:05 -0700, wxjmfauth wrote:
> Le samedi 18 août 2012 14:27:23 UTC+2, Steven D'Aprano a écrit :
>> [...]
>> The problem with UCS-4 is that every character requires four bytes.
>> [...]
>
> I'm aware of this (and all the blah blah bl
This is a long post. If you don't feel like reading an essay, skip to the
very bottom and read my last few paragraphs, starting with "To recap".
On Sat, 18 Aug 2012 11:26:21 -0700, Paul Rubin wrote:
> Steven D'Aprano writes:
>> (There is an extension to UCS-2,
On Sat, 18 Aug 2012 11:30:19 -0700, wxjmfauth wrote:
>> > I'm aware of this (and all the blah blah blah you are explaining).
>> > This always the same song. Memory.
>>
>>
>>
>> Exactly. The reason it is always the same song is because it is an
>> important song.
>>
>>
> No offense here. But t
On Sat, 18 Aug 2012 09:51:37 -0600, Ian Kelly wrote about PEP 393:
> The change does not just benefit ASCII users. It primarily benefits
> anybody using a wide unicode build with strings mostly containing only
> BMP characters.
Just to be clear:
If you have many strings which are *mostly* BMP,
On Sat, 18 Aug 2012 11:05:07 -0700, wxjmfauth wrote:
> As I understand (I think) the undelying mechanism, I can only say, it is
> not a surprise that it happens.
>
> Imagine an editor, I type an "a", internally the text is saved as ascii,
> then I type en "é", the text can only be saved in at lea
On Sat, 18 Aug 2012 19:34:50 +0100, MRAB wrote:
> "a" will be stored as 1 byte/codepoint.
>
> Adding "é", it will still be stored as 1 byte/codepoint.
Wrong. It will be 2 bytes, just like it already is in Python 3.2.
I don't know where people are getting this myth that PEP 393 uses Latin-1
int
On Sat, 18 Aug 2012 19:59:32 +0100, MRAB wrote:
> The problem with strings containing surrogate pairs is that you could
> inadvertently slice the string in the middle of the surrogate pair.
That's the *least* of the problems with surrogate pairs. That would be
easy to fix: check the point of the
On Sat, 18 Aug 2012 10:27:10 -0700, rusi wrote:
> For example, my sister recently saw some of my mails and was mystified
> that I had sent back 'blank mails' until I explained and pointed out
> that my answers were interleaved into what was originally sent!
No offence to your sister, who I'm sure
On Sat, 18 Aug 2012 19:35:44 -0700, Paul Rubin wrote:
> Scanning 4 characters (or a few dozen, say) to peel off a token in
> parsing a UTF-8 string is no big deal. It gets more expensive if you
> want to index far more deeply into the string. I'm asking how often
> that is done in real code.
It
On Sun, 19 Aug 2012 09:43:13 +0200, Peter Otten wrote:
> Steven D'Aprano wrote:
>> I don't know where people are getting this myth that PEP 393 uses
>> Latin-1 internally, it does not. Read the PEP, it explicitly states
>> that 1-byte formats are only us
On Sun, 19 Aug 2012 02:04:20 -0700, Rebekka-Marie wrote:
> I would like to solve a Mixed Integer Optimization Problem with the
> Branch-And-Bound Algorithm.
[...]
> Is there a module / methods that I can download or a ready-made program
> text that you know about, where I can put my constraints an
On Sun, 19 Aug 2012 01:11:56 -0700, Paul Rubin wrote:
> Steven D'Aprano writes:
>> result = text[end:]
>
> if end not near the end of the original string, then this is O(N) even
> with fixed-width representation, because of the char copying.
Technically, yes. But it
On Sun, 19 Aug 2012 01:04:25 -0700, Paul Rubin wrote:
> Steven D'Aprano writes:
>> This standard data structure is called UCS-2 ... There's an extension
>> to UCS-2 called UTF-16
>
> My own understanding is UCS-2 simply shouldn't be used any more.
Pretty m
On Sun, 19 Aug 2012 03:19:23 -0700, wxjmfauth wrote:
> This is precicely the weak point of this flexible representation. It
> uses latin-1 and latin-1 is for most users simply unusable.
That's very funny.
Are you aware that your post is entirely Latin-1?
> Fascinating, isn't it? Devs are devel
On Sun, 19 Aug 2012 10:48:06 -0700, Paul Rubin wrote:
> Terry Reedy writes:
>> I would call it O(k), where k is a selectable constant. Slowing access
>> by a factor of 100 is hardly acceptable to me.
>
> If k is constant then O(k) is the same as O(1). That is how O notation
> works.
You might
On Sun, 19 Aug 2012 11:50:12 -0600, Ian Kelly wrote:
> On Sun, Aug 19, 2012 at 12:33 AM, Steven D'Aprano
> wrote:
[...]
>> The PEP explicitly states that it only uses a 1-byte format for ASCII
>> strings, not Latin-1:
>
> I think you misunderstand the PEP then
On Sun, 19 Aug 2012 18:03:34 +0100, Blind Anagram wrote:
> "Steven D'Aprano" wrote in message
> news:502f8a2a$0$29978$c3e8da3$54964...@news.astraweb.com...
>
> > If you can consistently replicate a 100% to 1000% slowdown in string
> > handling, p
On Mon, 20 Aug 2012 01:57:46 +, kj wrote:
> In Roy Smith
> writes:
>
>>In article , kj
>>wrote:
>
>>> As far as I've been able to determine, Python does not remember
>>> (immutably, that is) the working directory at the program's start-up,
>>> or, if it does, it does not officially expose
On Sun, 19 Aug 2012 19:24:30 -0400, Roy Smith wrote:
> In the primordial days of computing, using 8 bits to store a character
> was a profligate waste of memory. What on earth did people need with
> TWO cases of the alphabet
That's obvious, surely? We need two cases so that we can distinguish
On Mon, 20 Aug 2012 00:44:22 -0400, Roy Smith wrote:
> In article <5031bb2f$0$29972$c3e8da3$54964...@news.astraweb.com>,
> Steven D'Aprano wrote:
>
>> > So it may be with utf-8 someday.
>>
>> Only if you believe that people's ability to generate d
On Mon, 20 Aug 2012 12:56:42 +0100, andrea crotti wrote:
> In the specific case there is absolutely no use of os.chdir, since you
> can:
> - use absolute paths
> - things like subprocess.Popen accept a cwd argument - at worst you can
> chdir back to the previous position right after the broken thi
On Mon, 20 Aug 2012 11:01:36 -0700, Massimo Di Pierro wrote:
> I discovered I can do this:
>
> class A(object): pass
> class B(object):
> __class__ = A # magic
Why do you think that's magic?
> b = B()
> isinstance(b,A) # returns True (as if B derived from A)
b.__
On Mon, 20 Aug 2012 22:49:24 +, Prasad, Ramit wrote:
>> > I also tend to blame M$ (Outlook and variants) for this tendency to
>> > quote everything and top-post -- Outlook makes it almost impossible
>> > to do a trim&interleave response style.
>>
>> I that Outlook & Co are guilty. That and th
On Tue, 21 Aug 2012 08:07:33 +0200, Alex Strickland wrote:
> On 2012/08/17 12:42 AM, Madison May wrote:
>
>> As a lurker, I agree completely with Chris's sentiments.
>
> I too, but I'd prefer something top-posted than have to skip through 38
> pages of quoted e-mail to get to a (generally) 1 lin
On Mon, 20 Aug 2012 11:12:22 -0600, Ian Kelly wrote:
> On Mon, Aug 20, 2012 at 10:09 AM, Chris Angelico
> wrote:
>> On Tue, Aug 21, 2012 at 2:01 AM, Paul Rubin
>> wrote:
>>> Analogy: how big a box is required to hold a pair of shoes? In a
>>> purely theoretical sense we might say O(S) where S i
On Tue, 21 Aug 2012 09:44:10 -0700, Miki Tebeka wrote:
> Greetings,
>
class A:
> ... '''a doc string'''
> ...
A.__doc__
> 'a doc string'
class B:
> ... '''a {} string'''.format('doc') ...
B.__doc__
> Is there's a reason for this?
Yes. Python only generates
On Wed, 22 Aug 2012 02:42:16 -0700, alex23 wrote:
> On 08/22/2012 03:17 AM, mingqiang hu wrote:
>> I mean any of "a","b","c" in string "adfbdfc" makes the statement
>> true,can I not use a function?
>
> any(map(string.__contains__, substrings))
Nice.
However, be aware that in Python 2, map() i
On Tue, 21 Aug 2012 18:36:50 -0700, Anonymous Group wrote:
> What books do you recomend for learning python? Preferably free and/or
> online.
Completely by coincidence, I have just discovered, and I mean *literally*
just a few minutes ago, this book:
http://www.springer.com/mathematics/computat
On Wed, 22 Aug 2012 21:46:29 +0100, Mark Lawrence wrote:
>> On 22/08/2012 20:45, lipska the kat wrote:
>>>
>>> compare this to a function declaration in Python
>>>
>>> def foo(self):
[...]
> Looking at the self I'm assuming that's a method and not a function.
Actually, it is a function. It doesn
On Thu, 23 Aug 2012 12:02:16 +1000, Chris Angelico wrote:
> 2) Related to the above, you can infinitely nest scopes. There's nothing
> wrong with having six variables called 'q'; you always use the innermost
> one. Yes, this can hurt readability
Well, there you go. There *is* something wrong with
On Wed, 22 Aug 2012 18:46:43 +0100, lipska the kat wrote:
> We need to separate out the 'view' from the 'implementation' here. Most
> developers I know, if looking at the code and without the possibly
> dubious benefit of knowing that in Python 'everything is an object'
> would not call this 'stro
On Wed, 22 Aug 2012 23:49:17 -0500, Evan Driscoll wrote:
> On 8/22/2012 18:58, Ben Finney wrote:
>> You haven't discovered anything about types; what you have discovered
>> is that Python name bindings are not variables.
>>
>> In fact, Python doesn't have variables – not as C or Java programmers
On Thu, 23 Aug 2012 12:17:03 -0500, Evan Driscoll wrote:
> I definitely *wouldn't* say "Python
> classes aren't really classes" -- even though (I assert) Python classes
> are *far* further from Simula-style (/Java/C++) classes than Python
> variables are from Java variables.
Well, Python classes
On Thu, 23 Aug 2012 09:49:41 -0700, Aaron Brady wrote:
[...]
> The patch for the above is only 40-60 lines. However it introduces two
> new concepts.
>
> The first is a "linked list", a classic dynamic data structure, first
> developed in 1955, cf. http://en.wikipedia.org/wiki/Linked_list .
> L
On Fri, 24 Aug 2012 04:14:27 -0500, Evan Driscoll wrote:
> On 8/23/2012 22:17, alex23 wrote:
>> But Roy's point was that referring to 'a' as a 'variable' makes no
>> sense, as it's not an allocated piece of memory.
>
> Does the computer just remember what 'a' refers to by keeping notes
> about it
On Thu, 23 Aug 2012 20:36:27 -0400, Roy Smith wrote:
> The id has changed! Now, we all know that the id of an object is its
> memory address (that's not guaranteed, but in the standard C
> implementation of Python, that's what it is).
It's not only "not guaranteed", it is *explicitly* noted as a
On Fri, 24 Aug 2012 17:25:05 -0700, Lucretiel wrote:
[...]
> Is there a way to get unittest disover to work with xmlrunner
Steady on there! It's only been about an hour and a half since you last
asked this exact same question, almost word-for-word identical. The more
specialised the question, t
On Thu, 23 Aug 2012 14:22:08 -0500, Evan Driscoll wrote:
> On 08/23/2012 12:56 PM, Steven D'Aprano wrote:
>> On Thu, 23 Aug 2012 12:17:03 -0500, Evan Driscoll wrote:
>>
>>> I definitely *wouldn't* say "Python
>>> classes aren't really clas
On Fri, 24 Aug 2012 08:00:59 +1000, Chris Angelico wrote:
> On Fri, Aug 24, 2012 at 3:56 AM, Steven D'Aprano
> wrote:
>> But name bindings are a kind of variable. Named memory locations are a
>> *different* kind of variable. The behaviour of C variables and Python
>>
On Sat, 25 Aug 2012 22:42:59 -0400, Steven W. Orr wrote:
> win_count = defaultdict(int)
> loss_count = defaultdict(int)
When I try that, I get "NameError: name 'defaultdict' is not defined."
I think it is rather unfair on beginners to show them code that almost,
but not quite, works, and expect
On Sat, 25 Aug 2012 22:20:05 -0400, Christopher McComas wrote:
> Marshall,24,Ohio State,48,
> Kentucky,14,Indiana,10,
> Marshall,10,Indiana,7,
> Ohio State,28,Kentucky,10
>
> That's just a quick example, I can handle seperating the data in the
> lines, figuring it all out, I just am unsure of how
On 08/25/2012 12:03 PM, 月忧茗 wrote:
> In the FinalList,
> probability of ALIST's item appeared is 43% probability of BLIST's
> item appeared is 37% probability of CLIST's item appeared is 19%
> probability of DLIST's item appeared is 1%
First, select one of the four lists with those approp
On Sat, 25 Aug 2012 23:59:34 -0700, wxjmfauth wrote:
> Le dimanche 26 août 2012 00:26:56 UTC+2, Ian a écrit :
>> More seriously, strings in Go are not sequences of runes. They're
>> actually arrays of UTF-8 bytes.
Actually, it's worse that that. Strings in Go aren't even proper UTF-8.
They are
601 - 700 of 13783 matches
Mail list logo