On Thu, Mar 17, 2011 at 10:57 AM, Ian Kelly wrote:
> On Thu, Mar 17, 2011 at 10:46 AM, kracekumar ramaraju
> wrote:
>> I tried the following
>>>>> 22/7.0
>> 3.1428571428571428
>>>>> import math
>>>>> math.pi
>> 3.14159265358
On Thu, Mar 17, 2011 at 11:36 AM, Jeffrey Gaynor wrote:
> There are fun math questions, for instance, is there a run of a million 1's
> someplace in the decimal expansion of pi? Maybe so, but we just don't know,
> since we've only computed the first trillion or so digits.
Since pi is irrational
On Mon, Mar 21, 2011 at 7:31 PM, Benjamin Kaplan
wrote:
> On Mon, Mar 21, 2011 at 8:59 PM, Mike Patterson
> wrote:
>> In my Python class the other day, the professor was going over
>> decorators and he briefly mentioned that there had been this huge
>> debate about the syntax and using the @ sign
On Wed, Mar 23, 2011 at 9:14 AM, Antoon Pardon
wrote:
> Which isn't helpfull if where you decide how they have to be sorted is
> not the place where they are actually sorted.
>
> I have a class that is a priority queue. Elements are added at random but
> are removed highest priority first. The pri
On Thu, Mar 24, 2011 at 3:23 AM, Antoon Pardon
wrote:
> Sure I can do that. I can do lots of things like writing a CMP class
> that I will use as a key and where I can implement the logic for
> comparing the original objects, which I otherwise would have put in a
> cmp function. I thought this was
On Thu, Mar 24, 2011 at 10:47 AM, Antoon Pardon
wrote:
>> That's not what you wrote before. You wrote "I can't do the sort in
>> multiple steps." I was just responding to what you wrote.
>
> That is because I tend to assume some intelligence with those I
> communicate with, so that I don't need
On Fri, Mar 25, 2011 at 12:30 AM, Paddy wrote:
def fs(f, s): return [f(value) for value in s]
Note that your "fs" is basically equivalent to the "map" builtin,
minus some of the features.
fsf1 = partial(fs, f=f1)
fsf1(s)
> Traceback (most recent call last):
> File "", line 1, in
On Fri, Mar 25, 2011 at 1:03 AM, Ian Kelly wrote:
> Moral of the story: if you pass in an argument by keyword, then the
> following arguments must be passed by keyword as well (or not at all),
> regardless of whether you're using partial or not.
To be clear, you can also jus
On Sun, Mar 27, 2011 at 10:17 PM, alex23 wrote:
> Civ 4 used it for most of the gameplay and interface, I believe,
> wrapping more performant libraries for the graphics & audio.
For Civ 5, however, they have switched to Lua -- I think primarily for
speed reasons.
--
http://mail.python.org/mailma
On Mon, Mar 28, 2011 at 4:55 AM, Dave Angel wrote:
> I'd expect it to be very slow. I presume it not only has to visit and
> duplicate every bit of the data structure, but also has to detect loops, and
> avoid infinite loops recreating them.
>
> This loop detection is probably an n-squared algori
On Mon, Mar 28, 2011 at 3:38 PM, John Parker wrote:
> error:
> Traceback (most recent call last):
> File "Score_8.py", line 38, in
> tokens = lines.split(",")
> AttributeError: 'list' object has no attribute 'split'
>
> So, what am I doing wrong?
'lines' is a list of strings.
'split' is a st
On Tue, Mar 29, 2011 at 1:08 PM, Chris Angelico wrote:
> On Wed, Mar 30, 2011 at 5:57 AM, MRAB wrote:
>> You would have to do more than that.
>>
>> For example, "" < "A", but if you "negate" both strings you get "" <
>> "\xBE", not "" > "\xBE".
>
> Strings effectively have an implicit character a
On Tue, Mar 29, 2011 at 5:06 PM, MRAB wrote:
> I think I've found a solution:
>
> class NegStr:
> def __init__(self, value):
> self._value = value
> def __lt__(self, other):
> return self._value > other._value
IOW:
cmp_to_key(lambda x, y: -cmp(x, y))
This
On Thu, Mar 31, 2011 at 3:14 PM, Wehe, Marco wrote:
> Hi,
>
>
>
> I am doing a search through a list of files but the text the casing doesn't
> match. My list is all upper case but the real files are all different. Is
> there a smooth way of searching through the list without going full on
> reg
On Fri, Apr 1, 2011 at 1:52 PM, Karl <8213543ggxnvjx...@kabelmail.de> wrote:
> Hello,
>
> one beginner question:
>
> aList = [0, 1, 2, 3, 4]
>
> bList = [2*i for i in aList]
>
> sum = 0
>
> for j in bList:
>
> sum = sum + bList[j]
>
> print j
>
> 0
>
> 2
>
> 4
>
> IndexError: 'list index out of
On Fri, Apr 1, 2011 at 2:54 PM, candide wrote:
> Another question relative to regular expressions.
>
> How to extract all word duplicates in a given text by use of regular
> expression methods ? To make the question concrete, if the text is
>
> --
> Now is better than never.
> Alt
On Sun, Apr 3, 2011 at 1:12 AM, sl33k wrote:
> I am trying to return a list of items modified with each item also
> showing like the number of modifications.
>
> Returning a list of user modified items was done easily but I would
> also like to display the item modified by the user and the
> modif
On Tue, Apr 5, 2011 at 3:17 PM, scattered wrote:
> Greetings,
>
> I've been playing around (in Python 3.1) with permutations of
> 0,1,...,n-1, represented by lists, p, of length n, where p[i] = the
> image of i under the permutation. I wanted to be able to calculate the
> inverse of such a permuta
On Wed, Apr 6, 2011 at 1:51 PM, Paul Rubin wrote:
> In Haskell or ML, you can use patterns that contain wild
> cards that play a role in the pattern-matching but don't establish any
> binding. Can that be done in Python?
>
> Not as much. You could say something like
>
> sorted(en
On Fri, Apr 8, 2011 at 9:55 AM, r wrote:
> I had a problem for which I've already found a "satisfactory"
> work-around, but I'd like to ask you if there is a better/nicer
> looking solution. Perhaps I'm missing something obvious.
>
> The code looks like this:
>
> stream-of-tokens = token-generator
On Fri, Apr 8, 2011 at 10:26 AM, candide wrote:
x=42
bool(x=5)
> True
>
>
> but _expression_ :
>
> x=42
>
>
> has no value.
"x=42" is an assignment statement, not an expression.
In "bool(x=5)", "x=5" is also not an expression. It's passing the
expression "5" in as the parameter x,
On Sun, Apr 10, 2011 at 6:04 PM, harrismh777 wrote:
> The deal with motive number (2) is that there are fewer and fewer teams who
> are concerned with interoperability. For instance (my team), we moved our
> stuff to gnulinux based systems and dumped Microsoft completely... we have
> no need for t
On Tue, Apr 12, 2011 at 12:00 PM, Teemu Likonen wrote:
> I'm a simple Lisp guy who wonders if it is be possible to add some kind
> of macros to the language. Then features like this could be added by
> anybody. Lisp people do this all the time and there is no need for
> feature requests or any dis
On Tue, Apr 12, 2011 at 12:25 PM, Ian Kelly wrote:
> On Tue, Apr 12, 2011 at 12:00 PM, Teemu Likonen wrote:
>> I'm a simple Lisp guy who wonders if it is be possible to add some kind
>> of macros to the language. Then features like this could be added by
>> anybody. L
On Tue, Apr 12, 2011 at 3:22 AM, harrismh777 wrote:
> This is very difficult... and I'm not dodging the ball here... its just
> the truth. The 'market share' data are bogus. Reason? ... because the free
> software 'market' is not a market.
This is just word-play. It has no bearing on the accu
On Tue, Apr 12, 2011 at 2:51 PM, Dan Stromberg wrote:
> This data is of course skewed a bit toward computers that people are
> using web browsers on.
Right, Linux servers are most likely underrepresented. At best the
data indicates what the population at large is using on their
desktops.
> Also
> limitless possibilities of IDLE to be a good primer for our budding
> young programmers however like all my great brain children this one
> has been cast aside like a red headed stepchild.
I can only imagine the hi-jinx that ensure at your yearly great brain
family reunion.
Ryan
--
Ryan
On Thu, 2011-04-14 at 11:46 +1000, Chris Angelico wrote:
> On Thu, Apr 14, 2011 at 11:29 AM, Ryan Kelly wrote:
> > I weep that your delightful rhetoric is limited to this neglected forum,
> > where the guardians of python core deign not to tread, and hence denied
> > its r
On Wed, 2011-04-13 at 19:10 -0700, rantingrick wrote:
> On Apr 13, 8:29 pm, Ryan Kelly wrote:
> > On Wed, 2011-04-13 at 17:39 -0700, rantingrick wrote:
>
> I would LOVE to improve the doc, however first the student THEN the
> teacher. However in this forsaken land the "tea
On Thu, 2011-04-14 at 03:12 +, Steven D'Aprano wrote:
> On Thu, 14 Apr 2011 12:03:15 +1000, Ryan Kelly wrote:
>
> > On Thu, 2011-04-14 at 11:46 +1000, Chris Angelico wrote:
> >> On Thu, Apr 14, 2011 at 11:29 AM, Ryan Kelly wrote:
> >> > I weep that your
On Thu, Apr 14, 2011 at 12:04 AM, harrismh777 wrote:
> How mamy times have you altered the identity of your web browser so that
> the web site would 'work'? You know, stupid messages from the server that
> say, "We only support IE 6+, upgrade your browser...", so you tell it
> you're using IE
st comp, but
> I can't see how to do that when the input comes from a dictionary.
You probably could, but I think it would hurt readability in this case:
lst = [parse_kwdlist(dct[k]) for k in sorted(dct.keys())
if k.startswith("Keyword")]
Cheer
On Fri, 2011-04-15 at 12:34 +1000, Ryan Kelly wrote:
> On Fri, 2011-04-15 at 12:10 +1000, Chris Angelico wrote:
> >
> >
> > My first draft looks something like this. The input dictionary is
> > called dct, the output list is lst.
> >
> > lst=[]
> >
On Fri, Apr 15, 2011 at 9:20 PM, Alec Taylor wrote:
> Good Afternoon,
>
> I'm looking for an IDE which offers syntax-highlighting,
> code-completion, tabs, an embedded interpreter and which is portable
> (for running from USB on Windows).
>
> Here's a mockup of the app I'm looking for: http://i52.
On Mon, Apr 18, 2011 at 6:47 AM, Timo Schmiade wrote:
> Hi all,
>
> I'm currently occupying myself with python's decorators and have some
> questions as to their usage. Specifically, I'd like to know how to
> design a decorator that maintains a status. Most decorator examples I
> encountered use a
On Tue, Apr 19, 2011 at 1:12 AM, Timo Schmiade wrote:
> Just one question remains now: What is a "Borg" in this context?
http://code.activestate.com/recipes/66531/
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Apr 19, 2011 at 10:31 AM, Ethan Furman wrote:
> Gerald Britton wrote:
>>
>> I now understand the Python does
>> not consider a class definition as a separate namespace as it does for
>> function definitions. That is a helpful understanding.
>
> That is not correct. Classes are separate n
On Tue, Apr 19, 2011 at 9:59 PM, Chris Angelico wrote:
> On Wed, Apr 20, 2011 at 1:45 PM, Chris Rebert wrote:
>> Built-ins aren't quite the same as globals, but essentially yes:
>
> Sure. That might explain some of the weirdness, but it doesn't explain
> why things were still weird with the varia
Silver: Python Software Foundation<http://www.python.org/psf/>
Thanks also to Linux Australia, who provide the overarching legal and
organisational structure for PyCon Australia.
Ryan Kelly
PyCon Australia 2011
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Apr 20, 2011 at 4:41 AM, Peter Otten <__pete...@web.de> wrote:
> The assignment writes to the local namespace, the lambda function reads from
> the global namespace; this will only work as expected if the two namespaces
> are the same:
>
exec """type = 42; print filter(lambda x: x == t
On Wed, Apr 20, 2011 at 12:03 PM, Chris Angelico wrote:
> On Thu, Apr 21, 2011 at 12:44 AM, Ian Kelly wrote:
>> So, the question for the OP: Is this file being run with execfile?
>>
>
> Not execfile per se; the code is fetched from the database and then
> execut
On Thu, Apr 21, 2011 at 12:28 AM, harrismh777 wrote:
> I don't like SPAM with my eggs and ham...
Nor do the rest of us, so please don't help it circumvent our spam
filters by reposting it.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Apr 22, 2011 at 7:49 AM, Kyle T. Jones
wrote:
>> You don't need to create an instance of BaseHandler. You have the
>> class, Python knows you have the class -- Python will look there if the
>> subclasses lack an attribute.
>>
>> ~Ethan~
>>
>
> Really? That's not at all how I thought it w
On Mon, Apr 25, 2011 at 3:28 PM, Thomas Rachel
wrote:
> Am 25.04.2011 16:29, schrieb Thomas Rachel:
>
>> or maybe even better (taking care for closures):
>>
>> function = bool
>> value = 'the well at the end of the world'
>> ## ...
>> actions.append(lambda val=value: function(val))
>> ## ...
>> fo
Only an experienced person can tell about life in this great way.
http://www.insurancesos.co.uk/articles/life-insurance/index.html";
rel="dofollow">Life Insurance UK
--
http://mail.python.org/mailman/listinfo/python-list
atically
linked on Windows, or that doing so causes some serious loss of
functionality. Was this ever true, and is it still?
Cheers,
Ryan
--
Ryan Kelly
http://www.rfk.id.au | This message is digitally signed. Please visit
r...@rfk.id.au| http://www.rfk.id.au/ramblings/gp
class in threading2 which should do
what you need. Don't know about "likely to work" but if it doesn't, I'd
like to hear about it so I can fix it :-)
`pip install threading2`
Cheers,
Ryan
--
Ryan Kelly
http://www.rfk.id.au | This message is digitally signe
On Thu, Apr 28, 2011 at 11:15 AM, Ethan Furman wrote:
> For anybody interested in composition instead of multiple inheritance, I
> have posted this recipe on ActiveState (for python 2.6/7, not 3.x):
>
> http://code.activestate.com/recipes/577658-composition-of-classes-instead-of-multiple-inherit/
: Python Software Foundation<http://www.python.org/psf/>
Thanks also to Linux Australia, who provide the overarching legal and
organisational structure for PyCon Australia.
Ryan Kelly
PyCon Australia 2011
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Apr 29, 2011 at 3:09 PM, Carl Banks wrote:
> Here is my advice on mixins:
>
> Mixins should almost always be listed first in the bases. (The only
> exception is to work around a technicality. Otherwise mixins go first.)
>
> If a mixin defines __init__, it should always accept self, *arg
On Fri, Apr 29, 2011 at 5:54 PM, Carl Banks wrote:
>> Really, *any* class that uses super().__init__ should take its
>> arguments and pass them along in this manner.
>
> If you are programming defensively for any possible scenario, you might try
> this (and you'd still fail).
>
> In the real worl
On Fri, Apr 29, 2011 at 9:57 PM, Jason Friedman wrote:
> The first call to fib() recursively calls fib() twice. Each of those
> will call fib() twice. Each of those will call fib() twice. Pretty
> soon, you've got a lot of calls.
Which is hell for the running time, but doesn't answer the quest
On Mon, May 2, 2011 at 11:23 AM, Jack Bates wrote:
> Hi, anyone know why these two statements aren't equivalent?
>
> raise (type, value, traceback)
>
> raise type, value, traceback
The latter is the syntax of the raise statement: up to 3 expressions,
separated by commas.
The former has a single
On Mon, May 2, 2011 at 2:48 PM, David Monaghan
wrote:
> On Mon, 2 May 2011 10:33:31 -0700 (PDT), Raymond Hettinger
> wrote:
>
>>I think it is time to give some visibility to some of the instructive
>>and very cool recipes in ActiveState's python cookbook.
>>
>>My vote for the coolest recipe of al
On Mon, May 2, 2011 at 3:50 PM, harrismh777 wrote:
> Thomas Rachel wrote:
>>>
>>> ... because each recursion level 'return' calls fib() twice, and each of
>>> those calls fib() twice, and you get the point...
>>
>> yes - but they are called one after the other, so the "twice" call
>> counts only f
On Mon, May 2, 2011 at 11:04 PM, Stefan Behnel wrote:
> The bad thing about this recipe is that it requires quite a bit of
> background knowledge in order to infer that the code the developer is
> looking at is actually correct. At first sight, it looks like an evil hack,
> and the lack of documen
On Mon, May 2, 2011 at 11:27 PM, Dan Stromberg wrote:
> But the recursive solution has time complexity of O(logn). The iterative
> solution has time complexity of O(n). That's a significant difference for
> large n - a significant benefit of the recursive version.
It's linear as written. I th
On Tue, May 3, 2011 at 3:54 PM, Chris Angelico wrote:
> On Wed, May 4, 2011 at 2:43 AM, Raymond Hettinger wrote:
>> We should have a separate thread for the most practical, best
>> documented, least surprising, and most boring recipe ;-)
>
> a += b # Adds b to a in-place. Polymorphic - works on
On Tue, May 3, 2011 at 3:41 PM, Chris Angelico wrote:
> On Wed, May 4, 2011 at 3:10 AM, harrismh777 wrote:
>> If your point is that the infinite process is the problem, I agree. But my
>> point is that the cpu crunch and the rate at which the call stack is filled
>> has to do with the double call
On Wed, May 4, 2011 at 10:52 AM, Grant Edwards wrote:
> On 2011-05-04, Matty Sarro wrote:
>> On Wed, May 4, 2011 at 12:34 PM, ETP wrote:
>>> I have a dos program (run in a window) that I would like to control
>>> with a script.
>
>> Look into the pexpect library, it'll make this easy as punch.
>
On Wed, May 4, 2011 at 3:09 PM, Wojtek Mamrak wrote:
> Hello,
>
> I spent a lot of time googling for a solution of this problem, with no
> result.
>
> I have a C++ application, in which I would like to embed Python interpreter.
> I don't want to rely on an interpreter being installed on user machi
On Wed, May 4, 2011 at 3:35 PM, harrismh777 wrote:
> Grant Edwards wrote:
>>>
>>> We do not consider passing a pointer as*by value* because its an
>>> > address; by definition, that is pass-by-reference.
>>
>> No, it isn't. It's pass by value. The fact that you are passing a
>> value that is a
On Thu, May 5, 2011 at 4:55 AM, Wojtek Mamrak wrote:
> Thanks for the reply!
>
>> Can you import from zip files when running the Python.exe interpreter?
> When I zip the folder "Lib" into Python27.zip and later rename it and
> try to run the python.exe, I receive an error:
> "Import error: no modu
On Thu, May 5, 2011 at 9:41 AM, John Nagle wrote:
> On 5/5/2011 3:06 AM, Gregory Ewing wrote:
>>
>> John Nagle wrote:
>>
>>> A reasonable compromise would be that "is" is treated as "==" on
>>> immutable objects.
>>
>> That wouldn't work for tuples, which can contain references
>> to other objects
On Thu, May 5, 2011 at 8:22 AM, Gnarlodious wrote:
> My scripting has grown to the point where the Apache server is a
> problem. My Python websites run and quit, which means I need to save
> data and recreate everything next page load. Bulky and slow. What is
> the simplest solution?
>
> I am runn
On Thu, May 5, 2011 at 10:58 AM, harrismh777 wrote:
> Grant Edwards wrote:
>>
>> That's what I was trying to say, but probably not as clearly. The "&"
>> operatore returnas a_value_ that the OP passes_by_value_ to a
>> function. That function then uses the "*" operator to use that value
>> to
On Thu, May 5, 2011 at 2:34 PM, Wojtek Mamrak wrote:
> Maybe I am missing the point, but I think I am not able to do this.
> When I remove the "Lib" folder and try to run Python.exe, the python
> console window closes rapidly, so that it is hard to read any message
> displayed in it and obvioulsy
On Fri, May 6, 2011 at 4:20 AM, dmitrey wrote:
> Thanks Cris, however, I had understood reason of the bug and mere
> informed Python developers of the bug to fix it.
No you haven't. Few if any Python developers make a habit of reading
this newsgroup. To actually report the issue so that it migh
On Fri, May 6, 2011 at 10:59 AM, Steven D'Aprano
wrote:
> As written, amb is just a brute-force solver using more magic than is
> good for any code, but it's fun to play with.
This isn't really amb; as you said it's just a brute-force solver with
some weird syntax. The whole point of amb is to e
On Fri, May 6, 2011 at 12:36 PM, Ian Kelly wrote:
> This is typically implemented using continuations, and I'm not sure
> whether a true amb could actually be achieved in Python without adding
> continuations or flow-control macros to the language.
I stand corrected. After pokin
On Fri, May 6, 2011 at 1:39 PM, harrismh777 wrote:
> harrismh777 wrote: OP wrote:
>
>> (1) "the %s is %s" % ('sky', 'blue')
>>
>> (2) "the {0} is {1}".format('sky', 'blue')
>>
>> (3) "the {} is {}".format('sky', 'blue')
>
> On the other hand, consider this 3.x code snip:
>
> print("the %s i
On Fri, May 6, 2011 at 1:51 PM, Chris Rebert wrote:
> On Fri, May 6, 2011 at 12:40 PM, dmitrey wrote:
>> hi all,
>> suppose I have Python dict myDict and I know it's not empty.
>> I have to get any (key, value) pair from the dict (no matter which
>> one) and perform some operation.
>> In Python 2
On Fri, May 6, 2011 at 1:57 PM, dmitrey wrote:
> Unfortunately, it doesn't work, it turn out to be dict_items:
next({1:2}.items())
> Traceback (most recent call last):
> File "", line 1, in
> TypeError: dict_items object is not an iterator
So call iter() on it first:
next(iter(myDict.item
On Fri, May 6, 2011 at 4:21 PM, Philip Semanchuk wrote:
> What if it's not a list but a tuple or a numpy array? Often I just want to
> iterate through an element's items and I don't care if it's a list, set, etc.
> For instance, given this function definition --
>
> def print_items(an_iterable):
On Fri, May 6, 2011 at 4:49 PM, Ethan Furman wrote:
> Ian Kelly wrote:
>>
>> On Fri, May 6, 2011 at 1:57 PM, dmitrey wrote:
>>>
>>> Unfortunately, it doesn't work, it turn out to be dict_items:
>>>>>>
>>>>>> next({1:2}.it
On Sat, May 7, 2011 at 2:29 AM, Steven D'Aprano
wrote:
>> This isn't really amb; as you said it's just a brute-force solver with
>> some weird syntax. The whole point of amb is to enable
>> non-deterministic programming, such as this:
> [...]
>> The amb engine would conceptually execute this func
On Sat, May 7, 2011 at 4:02 AM, dmitrey wrote:
> hi all,
> I try to port my code to Python 3 and somehow files don't see files
> from same directory, so I have to add those directories explicitly,
> e.g.
> import sys
> sys.path += [...]
>
> Also, it leads to bugs like this one:
> http://groups.goo
On Sun, May 8, 2011 at 9:33 PM, harrismh777 wrote:
> Why should the negation of a list imply that the list empty? ... nor any
> other abstract condition which is not well suited to 'not' ? (forget python
> for a moment... then move on to my argument...)
>
> What made the python development te
On Mon, May 9, 2011 at 12:10 PM, James Wright wrote:
> Hello,
>
> I have been using a script on several boxes that have been around for
> a while, and everything works just fine. I am finding though, that on
> some new OS installs the script fails with:
>
> Traceback (most recent call last):
> F
On Mon, May 9, 2011 at 1:29 PM, James Wright wrote:
> It does not appear to show a key:
>
> D4[] = vsr
> Traceback (most recent call last):
> File "render4.py", line 115, in
> create_report_index(each_item)
> File "render4.py", line 26, in create_report_index
> [clean_name, _] = each_valu
On Mon, May 9, 2011 at 1:26 PM, Martineau wrote:
> Instead of join() here's a function that does something similar to
> what the string join() method does. The first argument can be a list
> of any type of objects and the second separator argument can likewise
> be any type. The result is list of
On Wed, May 11, 2011 at 8:34 AM, Hans Georg Schaathun
wrote:
> E.g. Anyone who has used list/set comprehension in Z, haskell, set theory,
> or whereever will understand python list comprehension immediately.
They would understand the underlying concept. But would somebody who
is not a Python pr
On Wed, May 11, 2011 at 3:37 PM, harrismh777 wrote:
> hi folks,
> I am puzzled by unicode generally, and within the context of python
> specifically. For one thing, what do we mean that unicode is used in python
> 3.x by default. (I know what default means, I mean, what changed?)
The `unicode'
On Thu, May 12, 2011 at 1:58 AM, John Machin wrote:
> On Thu, May 12, 2011 4:31 pm, harrismh777 wrote:
>
>>
>> So, the UTF-16 UTF-32 is INTERNAL only, for Python
>
> NO. See one of my previous messages. UTF-16 and UTF-32, like UTF-8 are
> encodings for the EXTERNAL representation of Unicode charac
On Thu, May 12, 2011 at 2:42 PM, Terry Reedy wrote:
> On 5/12/2011 12:17 PM, Ian Kelly wrote:
>> Right. *Under the hood* Python uses UCS-2 (which is not exactly the
>> same thing as UTF-16, by the way) to represent Unicode strings.
>
> I know some people say that,
On Fri, May 13, 2011 at 5:11 AM, rusi wrote:
> The tightest way I knew so far was this:
> The 2x2 matrix
> 0 1
> 1 1
> raised to the nth power gives the nth fibonacci number. [And then use
> a logarithmic matrix mult]
> Your version is probably tighter than this.
Oh, nice! I did it this way once
On Fri, May 13, 2011 at 11:40 AM, rusi wrote:
> I tried to install easy_install (This is on windows)
> I downloaded the executable and ran it. It claimed to have done its
> job.
>
> But now when I type easy_install at a cmd prompt I get
> easy_install is not a command...
>
> [I guess I am a perenn
On Fri, May 13, 2011 at 1:41 PM, harrismh777 wrote:
> On the other hand, kids today are dumped into a first comp sci course in
> programming and plopped in-front of a Hugs interactive shell and then are
> expected to learn programming and be successful by trying to grasp pure
> functional programm
On Fri, May 13, 2011 at 6:48 PM, harrismh777 wrote:
> Ian Kelly wrote:
>>
>> Well, at least Haskell is probably better as an introductory language
>> than Lisp or Scheme. But what schools actually do this?
>
> http://www.cs.kent.ac.uk/teaching/resources/haskel
On Fri, May 13, 2011 at 10:47 PM, harrismh777 wrote:
> http://www.inf.ed.ac.uk/teaching/courses/inf1/fp/
>
> http://www.cs.ou.edu/~rlpage/fpclassSpring97/
>
>
> There are lots of these... the two above afaik are still doing this at the
> entry level... ... supposedly, these kids are 'mostly'
On Sat, May 14, 2011 at 11:24 AM, rusi wrote:
> def fib(n):
> if n==1 or n==2:
> return 1
> elif even(n):
> return sq(fib (n//2)) + 2 * fib(n//2) * fib(n//2 - 1)
> else:
> return sq(fib (n//2 + 1)) + sq(fib(n // 2))
>
> This is a strange algo -- logarithmic because i
On Sat, May 14, 2011 at 6:08 PM, Victor Eijkhout wrote:
> I thought the send call would push the value "2" at the front of the
> queue. Instead it coughs up the 2, which seems senseless to me.
>
> 1/ How should I view the send call? I'm reading the manual and dont' get
> it
There is no queue unle
On Sat, May 14, 2011 at 6:47 PM, Chris Angelico wrote:
> def ints():
> i=0
> queue=[]
> while True:
> if queue: # see other thread, this IS legal and pythonic and
> quite sensible
> sent=(yield queue.pop(0))
> else:
> sent=(yield i)
> i+=1
>
On Sat, May 14, 2011 at 7:17 PM, Chris Angelico wrote:
> You're right. It needs a while loop instead of the if (and some slight
> reordering):
>
> def ints():
> i=0
> queue=[]
> while True:
> if queue: # see other thread, this IS legal and pythonic and
> quite sensible
> sen
On Sun, May 15, 2011 at 4:18 AM, Steven D'Aprano
wrote:
> On Sun, 15 May 2011 11:11:41 +0200, Christoph Groth wrote:
>
>> I would like to avoid having _multiple_ objects which are equal (a == b)
>> but not the same (a is not b). This would save a lot of memory.
>
> Based on the idea of interning,
On Sun, May 15, 2011 at 9:53 PM, Gnarlodious wrote:
> class GnomonBase(object):
> def __init__(self, bench):
> # do stuff
>
> But all I get is:
> TypeError: __init__() takes exactly 1 positional argument (2 given)
>
> I don't understand, I am only sending one variable. What does it think
On Sun, May 15, 2011 at 10:30 PM, Gnarlodious wrote:
> I don't have a trace because I am using mod_wsgi under Apache. Maybe
> there is a way to debug using mod_wsgi but I haven't been able to
> figure out how.
http://code.google.com/p/modwsgi/wiki/DebuggingTechniques
> My problem is that in orde
On Mon, May 16, 2011 at 12:17 AM, Littlefield, Tyler
wrote:
>>Write your "game" for the "web".
>>Write is as a SaaS (Software as a Service) - even if it's free and open
>> source.
> I understood you loud and clear. And that makes a lot of assumptions on my
> game and the design. I don't really car
On Tue, May 17, 2011 at 9:50 AM, RJB wrote:
> I noticed some discussion of recursion. the trick is to find a
> formula where the arguments are divided, not decremented.
> I've had a "divide-and-conquer" recursion for the Fibonacci numbers
> for a couple of years in C++ but just for fun rewrote
On Tue, May 17, 2011 at 11:04 AM, Chris Withers wrote:
> Now, since the sequence is long, and comes from a file, I wanted the
> provider to be an iterator, so it occurred to me I could try and use the new
> 2-way generator communication to solve the "communicate back with the
> provider", with som
901 - 1000 of 3558 matches
Mail list logo