Michael J. Fromberger wrote:
...
>
> Of course, I could just bypass super, and explicitly invoke them as:
>
> C.__init__(self, ...)
> D.__init__(self, ...)
>
> ... but that seems to me to defeat the purpose of having super in the
> first place.
As others have pointed out, super, is designe
Mark E. Fenner wrote:
>
> and the copy is taking the majority (42%) of my execution time.
> So, I'd like to speed up my copy. I had an explicit copy method that did
> what was needed and returned a new object, but this was quite a bit slower
> than using the standard lib copy.copy().
>
How are
Mark E. Fenner wrote:
> Michael Spencer wrote:
>
>> Mark E. Fenner wrote:
>>
>>> and the copy is taking the majority (42%) of my execution time.
>>> So, I'd like to speed up my copy. I had an explicit copy method that did
>>> what was needed a
Announcing: compiler2
-
For all you bytecode enthusiasts: 'compiler2' is an alternative to the
standard
library 'compiler' package, with several advantages.
Improved pure-python compiler
- Produces identical bytecode* to the built-in compile function for all /Lib
and L
Georg Brandl wrote:
> Michael Spencer wrote:
>> Announcing: compiler2
>> -
>>
>> For all you bytecode enthusiasts: 'compiler2' is an alternative to the
>> standard
>> library 'compiler' package, with several adva
Paul Boddie wrote:
> Martin v. Löwis wrote:
...The compiler package is largely unmaintained and
>> was known to be broken (and perhaps still is).
>
> I don't agree entirely with the "broken" assessment. Although I'm not
> chasing the latest language constructs, the AST construction part of
> the p
Martin v. Löwis wrote:
> Georg Brandl schrieb:
>> Perhaps you can bring up a discussion on python-dev about your improvements
>> and how they could be integrated into the standard library...
>
> Let me second this. The compiler package is largely unmaintained and
> was known to be broken (and perh
Kenneth McDonald wrote:
> I'm trying to write a 'flatten' generator which, when give a
> generator/iterator that can yield iterators, generators, and other data
> types, will 'flatten' everything so that it in turns yields stuff by
> simply yielding the instances of other types, and recursively
David Hirschfield wrote:
> Another deep python question...is it possible to have code run whenever
> a particular object is assigned to a variable (bound to a variable)?
>
> So, for example, I want the string "assignment made" to print out
> whenever my class "Test" is assigned to a variable:
>
David Hirschfield wrote:
> I'm not sure this is possible, but it sure would help me if I could do it.
>
> Can a function learn the name of the variable that the caller used to
> pass it a value? For example:
>
> def test(x):
> print x
>
> val = 100
> test(val)
>
> Is it possible for function
I'd like to make code.InteractiveConsole function just like the normal
Python console. However, when I try to use the arrow keys to recall
command history, all I get is ^[[A^[[B. I've seen the example at
http://docs.python.org/lib/readline-example.html
but this doesn't seem to work at all, altho
David Isaac wrote:
> Thanks to both Roberto and George.
> I had considered the recursive solution
> but was worried about its efficiency.
> I had not seen how to implement the numpy
> solution, which looks pretty nice.
>
> Thanks!
> Alan
>
>
You could also use pyarray, which mimics numpy's index
[EMAIL PROTECTED] wrote:
> Hello,
>
> i'm looking for this behaviour and i write a piece of code which works,
> but it looks odd to me. can someone help me to refactor it ?
>
> i would like to walk across a list of items by series of N (N=3 below)
> of these. i had explicit mark of end of a seque
[EMAIL PROTECTED] wrote:
> actually for the example i have used only one sentry condition by they
> are more numerous and complex, also i need to work on a huge amount on
> data (each word are a line with many features readed from a file)
An open (text) file is a line-based iterator that can be fed
George Sakkis wrote:
> Michael Spencer wrote:
>
>> Here's a small update to the generator that allows optional handling of the
>> head
>> and the tail:
>>
>> def chunker(s, chunk_size=3, sentry=".", keep_first = False, keep_last =
>>
George Sakkis wrote:
> Michael Spencer wrote:
>> George Sakkis wrote:
>>> Michael Spencer wrote:
>>>
>>>> def chunker(s, chunk_size=3, sentry=".", keep_first = False, keep_last =
>>>> False):
>>>> buffer=[]
>
Gregg Lind wrote:
> I wish something like this was part of the standard python installation,
> and didn't require one to use Numpy or Numarray. This sort of list
> subsetting is useful in many, many contexts.
>
Many of numpy's multi-dimensional slicing and indexing operations are
implemented
Nick Maclaren wrote:
>
> Well, I am already doing that, and regretting the fact that Python
> doesn't seem to allow a class instantiation to return a new class :-)
>
>>> class Fake(object):
... def __new__(cls):
... return 42
...
>>> Fake()
42
>>>
"instantiation" (i.e.
John Henry wrote:
> Carl Banks wrote:
>
>> The function can be extended to allow arbitrary arguments. Here's a
>> non-minmal recursive version.
>>
>> def cartesian_product(*args):
>> if len(args) > 1:
>> for item in args[0]:
>> for rest in cartesian_product(*args[1:]):
>>
BartlebyScrivener wrote:
> Python pseudo code limericks anywhere?
I wrote the following in response to Steve Holden's limerick challenge a
couple of years ago:
# run me or voice the alphanumeric tokens
from itertools import repeat
for feet in [3,3,2,2,3]:
print " ".join("DA-DA-DUM"
Daniel Nogradi wrote:
...
> - database content ---
>
> Alice 25
> Bob 24
>
> - program1.py -
>
> class klass:
...
>
> inst = klass()
>
> - program2.py ---
>
> import program1
>
> # The code in klass above should be such that the following
Fredrik Lundh wrote:
> Fabiano Sidler wrote:
>
>> I'm looking for a way to compile python source to bytecode instead of
>> code-objects. Is there a possibility to do that? The reason is: I want
>> to store pure bytecode with no additional data.
>
> use marshal.
>
>> The second question is, there
Raymond Hettinger wrote:
>> from itertools import count, izip
>>
>> def dict2str(d, preferred_order = ['gid', 'type', 'parent', 'name']):
>> last = len(preferred_order)
>> rank = dict(izip(preferred_order, count()))
>> pairs = d.items()
>> pairs.sort(key=lambda (k,v): rank.get(k, (l
Charles Krug wrote:
> List:
>
...
> # expensive Object Module
>
> _expensiveObject = None
> def ExpensiveObject():
>
> if not(_expensiveObject):
> _expensiveObject = "A VERY Expensive object"
>
> return _expensiveObject
>
...
> I obviously missed some part of the scoping rules.
DaveM wrote:
> Although I've programmed for fun - on and off - since the mid 70's, I'm
> definitely an OO (and specifically Python) beginner.
>
> My first question is about global variables. Are they, as I'm starting to
> suspect, a sin against God or just best avoided? Having got my current
> ap
Hi all,
I am very new to Python programming. I am writing a program to manage
wireless connections, this is for GNOME on Linux. I present the user with
a "connect" button. I want to handle the connection for them slightly
different depending on whether or not the wireless access point they are
try
On Sun, 05 Feb 2006 10:39:18 -0800, Rick Spencer wrote:
>I just want to fire
> off the command line utility (iwconfig) for connecting. In this case, I
> want my program to wait until iwconfig is done before continuing on. I
> figure that I could just write a line of code to read
Dylan Moreland wrote:
> I'm trying to implement a bunch of class methods in an ORM object in
> order to provide functionality similar to Rails' ActiveRecord. This
> means that if I have an SQL table mapped to the class "Person" with
> columns name, city, and email, I can have class methods such as:
Swroteb wrote:
> Paul Rubin wrote:
>> I think the natural approach is to make a generator that yields a
>> 5-tuple for each combination, and then have your application iterate
>> over that generator. Here's my version:
>>
>> def comb(x,n):
>> """Generate combinations of n items from li
[EMAIL PROTECTED] wrote:
...
>
> But i am stuck on how to do a random chooser that works according to my
> idea of choosing according to rating system. It seems to me to be a bit
> different that just choosing a weighted choice like so:
>
...
>
> And i am not sure i want to have to go through w
john peter wrote:
> I'd like to write two generators: one is a min to max sequence number
> generator that
> rolls over to min again once the max is reached. the other is a generator
> that cycles
> through N (say, 12) labels. currently, i'm using these generators in nested
> loops like
>
Rob Cowie wrote:
> I'm having a bit of trouble with this so any help would be gratefully
> recieved...
>
> After splitting up a url I have a string of the form
> 'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be
> preceeded by an operator if it is a '-', if it is preceded by n
[EMAIL PROTECTED] wrote:
> Hi All,
>
> I wonder could someone help me with this?
>
> What I want to do is search through a list of letters and look for
> adjacent groups of letters that form sequences, not in the usual way of
> matching say abc to another appearance later on in the list but to lo
Michael Spencer wrote:
>
> def compare_forms(sequence):
> """test whether all groups of a sequence have the same form"""
> for length in range(4,2,-1): # look for longest match first
oops, make that range(4,1,-1) or, simply (4,3,2)
Michael
-
[EMAIL PROTECTED] wrote:
> Hi Michael,
>
> Thanks for a quick response, I appreciate it. I will have to get back
> to you tomorrow, as I can't check what you've given me right now. I
> presume the fact that you mention the word note in your code you have
> realised that I'm trying to search for mu
[EMAIL PROTECTED] wrote:
> Your code will identify sequences in a list, but how to index them? I
> have an idea, which seems ridiculously long-winded, but should work.
> First, put the groups from the âmake_diffsâ function into a list
> and do a search for the sequence identified from the
> âcompa
Martijn Pieters wrote:
> Dan Christensen wrote:
>
>> Any hints for level 13? I know how to make a call, but don't know "who"
>> to call.
>
>
> I haven't figured this one out yet either. Rather frustrating really.
> All the hints I've been given so far is to rmember the solution for
> level 12.
Martijn Pieters wrote:
> Roel Schroeven wrote:
>
>> Unless Martijn Pieters here and mjpieters in the Python Challenge forum
>> are two differen persons, you've found it in the meantime, haven't you?
>
>
> Yup, I found it. How evil and devious. I found the hint without
> Googling, BTW, but can se
John Machin wrote:
> On Thu, 5 May 2005 13:00:32 +1200, Thomas Thomas <[EMAIL PROTECTED]>
> wrote:
>
>
>>Hi all,
>>
>>Forgot to mention I am using python 2.3 on windows.
>>
>>
>
>
> This message (sent to python_list) would seem to be referencing a
> previous posting/message -- but it's not show
Dan Bishop wrote:
> Martijn Pieters wrote:
>
>>Martijn Pieters wrote:
>>
>>>I haven't figured this one out yet either. Rather frustrating
>
> really.
>
>>>All the hints I've been given so far is to remember the solution
>
> for
>
>>>level 12.
>>
>>A, that was devious! I found it finally, h
Ximo wrote:
> I am doing my own interpreter with the Python languaje.
>
> Do you understand me?
>
>
>
> "Fredrik Lundh" <[EMAIL PROTECTED]> escribió en el mensaje
> news:[EMAIL PROTECTED]
>
>>"Ximo" wrote:
>>
>>
>>>I am doing a interpret of lines and it show me a prompt, and I want if I
>>>wr
[EMAIL PROTECTED] wrote:
> I've to use ConfigParser.
>
> It returns values that are exactly in the config file, so get string
> variables like:
> int1 with quotes and characers: "42"
> this is easy to convert to int:
> realint = int(int1)
>
> I've read the tutorial, and the FAQ, and not sure if I
ironfroggy wrote:
> Hoping this isn't seeming too confusing, but I need to create a
> metaclass and a class using that metaclass, such that one of the bases
> of the metaclass is the class created with that metaclass. I can't
> figure out a way to do this, even after trying to add the class as a
>
PyPK wrote:
> Yep that improved the speed by about 50% now it takes about 10 secs
> instead of 24 seconds..Thanks much. I guess that is the best we could
> do right.It would be really helpful if I could get it less than 5
> seconds. Any suggestions on that??
>
Things to try:
* in-lining the min a
Michael Spencer wrote:
> def search1(m):
> box = {}
> for r,row in enumerate(m):
> for c,e in enumerate(row):
> try:
> minc, minr, maxc, maxr = box[e]
> box[e] = ( c < minc and c or minc,
>
, which it seems to do correctly for everything except
namespace prefixes. The docs mention "proper" output can be achieved by
using the Qname object, but they don't go into any detail. Any help is
appreciated.
Thanks,
Chris Spencer
--
http://mail.python.org/mailman/listinfo/python-list
Kalle Anke wrote:
> On Sun, 12 Jun 2005 13:59:27 +0200, deelan wrote
> (in article <[EMAIL PROTECTED]>):
>
> void doSomething( data : SomeClass ){ ... }
>
> and I would be sure at compile time that I would only get SomeClass objects
> as parameters into the method.
Being an untyped language, Py
Andrew Dalke wrote:
> On Sun, 12 Jun 2005 15:06:18 +, Chris Spencer wrote:
>
>
>>Does anyone know how to make ElementTree preserve namespace prefixes in
>>parsed xml files?
>
>
> See the recent c.l.python thread titled "ElemenTree and namespaces&q
Bruno Desthuilliers wrote:
> And *this* is highly unpythonic. And un-OO too, since it makes foo()
> dependant on *class* Bar, when it should most probably be enough that it
> only depends on (probably part of) the *interface* of class Bar.
I was providing the original poster with a simple way t
Bruno Desthuilliers wrote:
> Chris Spencer a écrit :
>
>> I was providing the original poster with a simple way to ensure
>> appropriate type.
>
>
> s/appropriate type/specific implementation/
>
> Hint : the appropriate type for print &g
Peter Dembinski wrote:
> Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
>
>>Nope. Python *is* typed. But it doesnt confuse implementation
>>with semantic.
>
>
> Python is typed. And its type system may look strange for anyone who
> did only Java or C++ programming before :>
Of course, in tha
Peter Dembinski wrote:
> Chris Spencer <[EMAIL PROTECTED]> writes:
>
>
>>Peter Dembinski wrote:
>>
>>Of course, in that Python is dynamically typed as opposed to the
>>static typing of Java or C++. Please excuse my previous mis-wording :)
>
>
jean-marc wrote:
> if you are familiar with eclipse, you could use the PyDev python
> plugin.
>
> jm
Thanks for that reference. I had been using SPE for my Python editing,
but it's gone unmaintained as of late, so I've been looking for an
alternative. Aside from an autocomplete bug (which I've
Sergio Correia wrote:
> spam = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]
>
> Into something like
> eggs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
>
> There are *no* special cases (no empty sub-lists).
eggs = [i for j in spam for i in j]
Michael
--
http://mail.python.org/mailman/listinfo/
Gabriel Genellina wrote:
>
> (I cannot find peephole.c on the source distribution for Python 2.5, but
> you menctioned it on a previous message, and the comment above refers to
> the peephole optimizer... where is it?)
>
The peephole optimizer is in compile.c - the entry point is optimize_c
n00m wrote:
> http://www.spoj.pl/problems/SUMFOUR/
>
> 3
> 0 0 0 0
> 0 0 0 0
> -1 -1 1 1
> Answer for this input data is 33.
>
> My solution for the problem is
> ==
>
> import time
> t = time.clock()
>
> q,w,e,r,sch,h = [],[],[
alain wrote:
> I have a problem I wonder if it has been solved before.
> I have a dictionnary and I want the values in the dictionnary to be
> annotated with the rank that would be obtained by sorting the values
>
> def annotate_with_rank(my_dict):
>
> return my_annotated_dict
>
"7stud" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Can someone show me how to manually implement staticmethod()? Here is
> my latest attempt:
>
Raymond Hettinger can:
http://users.rcn.com/python/download/Descriptor.htm#static-methods-and-class-methods
Boudreau, Emile wrote:
> Hey all,
> So I'm trying to filter a list with the built-in function
> filter(). My list looks something like this:
> ['logs', 'rqp-8.2.104.0.dep', 'rqp-8.2.93.0.dep',
> 'rqp-win32-app-8.2.96.0-inst.tar.gz', 'rqp-win32-app-8.2.96.0-inst.tar.gz']
>
> Calling filte
Mark Morss wrote:
> I would like to construct a class that includes both the integers and
> None. I desire that if x and y are elements of this class, and both
> are integers, then arithmetic operations between them, such as x+y,
> return the same result as integer addition. However if either x o
Python Maniac wrote:
> I am new to Python however I would like some feedback from those who
> know more about Python than I do at this time.
>
> def scrambleLine(line):
> s = ''
> for c in line:
> s += chr(ord(c) | 0x80)
> return s
>
> def descrambleLine(line):
> s = ''
>
+1 Subject line of the week (SLOTW)
rjcarr wrote:
> So my question is ... why are they [os.path and logging.handlers] different?
[A] wrote:
> Because you misspelled it. First, do a dir() on logging:
[B] wrote:
> No, he didn't... OP: logging is a package and logging.handlers is one module
> in t
Karlo Lozovina wrote:
>
> Any idea how to do that with metaclasses and arbitrary long list of
> attributes? I just started working with them, and it's driving me nuts :).
>
> Thanks for the help,
> best regards.
>
Try implementing a property factory function before worrying about the
metaclas
Tor Erik Sønvisen wrote:
> Hi,
>
> I've tried locating some code that can recreate an object from it's
> string representation...
> The object in question is really a dictionary containing other
> dictionaries, lists, unicode strings, floats, ints, None, and
> booleans.
>
> I don't want to use ev
J. Clifford Dyer wrote:
> I think that's the first time I've actually seen someone use a Monty
> Python theme for a python example, and I must say, I like it. However,
> "We are all out of Wensleydale."
>
> Cheers,
> Cliff
Oh, then you clearly don't waste nearly enough time on this newsgroup ;
Franz Steinhaeusler wrote:
> Use Spaces, size: 4
> detect mixed line ending
> detect tabs mixed with space
> trim trailing whitespaces.
look at: tools/scripts/reindent.py
> convert structs like: if (a > b): to if a > b:
> fill in spaces, but not in functions between operators:
>
> a+=1 =>
Ben Finney wrote:
>
> I'm not interested in learning some centralised web-application
> interface, and far prefer the discussion forum to be available by a
> standard *protocol*, that I can use my choice of *local client*
> application with.
>
I agree: I use Thunderbird, and it works well. But
Dennis Lee Bieber wrote:
> On Fri, 30 Nov 2007 11:36:44 -0800, Michael Spencer
>>
>> Can anyone recommend a solution that also synchronizes post read status? If
>> Google Reader or something like it handled NNTP, I imagine I'd use it to
>> achieve
>>
Michael Goerz wrote:
> Hi,
>
> I am writing unicode stings into a special text file that requires to
> have non-ascii characters as as octal-escaped UTF-8 codes.
>
> For example, the letter "Í" (latin capital I with acute, code point 205)
> would come out as "\303\215".
>
> I will also have to r
Kay Schluehr wrote:
>
> This unexpected attack in his rear frightened him so much, that he
> leaped forward with all his might: the horse's carcase dropped on the
> ground, but in his place the wolf was in the harness, and I on my part
> whipping him continually: we both arrived in full career saf
Terry Reedy wrote:
> "Maric Michaud" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> |I faced a strange behavior with generator expression, which seems like a
> bug, for both
> | python 2.4 and 2.5 :
>
> Including the latest release (2.5.2)?
>
> | >>> class A :
> | ... a = 1
MonkeeSage wrote:
> A quick question about how python parses a file into compiled
> bytecode. Does it parse the whole file into AST first and then compile
> the AST, or does it build and compile the AST on the fly as it reads
> expressions? (If the former case, why can't functions be called before
cf29 wrote:
> Greetings,
>
> I designed in JavaScript a small program on my website called 5
> queens.
..
Has anyone tried to do a such script? If anyone is
> interested to help I can show what I've done so far.
Tim Peters has a solution to 8 queens in test_generators in the standard
library
Edward Elliott wrote:
...
>
> for x in list1:
> i += 1
> # for y in list2:
> print x * i
>
> and have the print line execute as part of the for x block. In other
> words, I want the block with print to be in the scope of the for x loop.
> But instead it raises a SyntaxError bec
Clodoaldo Pinto wrote:
> Is there a simple way to build a dictionary from a string without using
> eval()?
>
s = '{"a":1}'
d = eval(s)
d
> {'a': 1}
>
> Regards, Clodoaldo Pinto
>
Here is a discussion about one way to do it:
http://tinyurl.com/o8mmm
HTH
Michael
--
http://mail.p
Clodoaldo Pinto wrote:
> Michael Spencer wrote:
>
>> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/364469
>
> Very nice work. It will be very useful. Thanks.
>
> Only a small problem when I try to evaluate this:
>
> safe_eval('True')
>
>
Anthony Liu wrote:
> I am at my wit's end.
>
> I want to generate a certain number of random numbers.
> This is easy, I can repeatedly do uniform(0, 1) for
> example.
>
> But, I want the random numbers just generated sum up
> to 1 .
>
> I am not sure how to do this. Any idea? Thanks.
>
> __
Kay Schluehr wrote:
> Just reasoning about conversion of classic to new style classes (
> keeping deprecation of ClCl in Py3K in mind ) I wonder if there is a
> metaclass that can be used to express the semantics of ClCl in terms of
> new style classes? Intuitively I would expect that there is quit
Ian Bicking wrote:
> I got a puzzler for y'all. I want to allow the editing of functions
> in-place. I won't go into the reason (it's for HTConsole --
> http://blog.ianbicking.org/introducing-htconsole.html), except that I
> really want to edit it all in-process and in-memory. So I want the
> id
Terry Reedy wrote:
> "CC" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> I wanna compile a 6000x1000 array with python. The array starts from
>> 'empty', each time I get a 6000 length list, I wanna add it to the
>> exist array as a column vector. Is there any function to do so?
>
Terry Reedy wrote:
> "Michael Spencer" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> If you're just looking for a multi-dimensional array type, and don't need
>> maximum speed or the vast range of array-processing that numpy offers,
Devan L wrote:
> Is there any safe way to create an instance of an untrusted class
> without consulting the class in any way? With old-style classes, I can
> recreate an instance from another one without worrying about malicious
> code (ignoring, for now, malicious code involving attribute access)
Wildemar Wildenburger wrote:
> Arnaud Delobelle wrote:
>> Personally, between
>>
>> * foo if foo else bar
>> * foo or bar
>>
>> I prefer the second. Maybe it could be spelt
>>
>> * foo else bar ?
>>
> How about
>
> val = foo rather than bar
>
> If that is not clear and obvios, I don't know what i
ki lo wrote:
> I have type variable which may have been set to 'D' or 'E'
>
> Now, which one of following statements are more efficient
>
> if type =='D' or type == 'E':
>
> or
>
> if re.search("D|E", type):
>
> Please let me know because the function is going to called 10s of
> millions of t
t3chn0n3rd wrote:
> Do you think it is relatively easy to write sort algorithms such as
> the common Bubble sort in Python as compared to other high level
> programming langauges
yes
--
http://mail.python.org/mailman/listinfo/python-list
After I "compile" my program with py2exe 0.6.9 with Python 2.6, I'm
still getting the "Application Did Not Initialize Properly" error
dialog whenever I run my code. What am I doing wrong?
Note that py2exe 0.6.9 with Python 2.5 works just fine.
Help!
Chris.
On Sat, 15 Nov 2008 23:21:15 -0800,
thomas.han...@gmail.com wrote:
...
So any ideas on how to get a function called on an object just after
__init__ is done executing?
--
http://mail.python.org/mailman/listinfo/python-list
Yes, you *can* use metaclasses - you need to override the type.__call__ method,
which is what normally ca
Alexzive wrote:
Hello there,
I'd like to get the same result of set() but getting an indexable
object.
How to get this in an efficient way?
Example using set
A = [1, 2, 2 ,2 , 3 ,4]
B= set(A)
B = ([1, 2, 3, 4])
B[2]
TypeError: unindexable object
Many thanks, alex
--
http://mail.python.org/m
Saketh wrote:
Hi everyone:
I'm using "translation" in the sense of string.maketrans here.
I am trying to efficiently compare if two string translations
"conflict" -- that is, either they differently translate the same
letter, or they translate two different letters to the same one.
...
Anoth
Robert Kern wrote:
On 2009-04-20 23:04, per wrote:
to be more formal by very different, i would be happy if they were
maximally distant in ordinary euclidean space... so if you just plot
the 3-tuples on x, y, z i want them to all be very different from each
other. i realize this is obviously b
Saketh wrote:
Thank you, Peter and Michael, for your solutions! I think that
Michael's is what I was edging towards, but Peter's has demonstrated
to me how efficient Python's set functions are. I have a lot more to
learn about optimizing algorithms in Python... :)
--
http://mail.python.org/mail
Ross wrote:
If I have a list of tuples a = [(1,2), (3,4), (5,6)], and I want to
return a new list of each individual element in these tuples, I can do
it with a nested for loop but when I try to do it using the list
comprehension b = [j for j in i for i in a], my output is b =
[5,5,5,6,6,6] inste
Robert Kern wrote:
> KraftDiner wrote:
>> I have a list that starts out as a two dimensional list
>> I convert it to a 1D list by:
>>
>> b = sum(a, [])
>>
>> any idea how I can take be and convert it back to a 2D list?
>
> Alternatively, you could use real multidimensional arrays instead of fakin
KraftDiner wrote:
> I have a 2D array. Say it is 10x10 and I want a 1D Array of 100
> elements...
> What is the syntax?
>
> oneD = reshape(twoD, (100,1))
> or
> oneD = reshape(twoD, (1,100))
>
> One I guess is the transpose of the other but both seem to be
> arrays of arrays...
>
> help?!
>
Us
[EMAIL PROTECTED] wrote:
> I write a lot of code that looks like this:
>
> for myElement, elementIndex in zip( elementList,
> range(len(elementList))):
> print "myElement ", myElement, " at index: ",elementIndex
>
>
> My question is, is there a better, cleaner, or easier way to get at the
>
[EMAIL PROTECTED] wrote:
> Hi All,
> First, I hope this post isn't against list rules; if so, I'll take note in
> the future.
>
> I'm working on a project for school (it's not homework; just for fun).
> For it, I need to make a list of words, starting with 1 character in length,
> up to 15 or so.
> [EMAIL PROTECTED] wrote:
...
>> I'm working on a project for school (it's not homework; just for fun).
>> For it, I need to make a list of words, starting with 1 character in length,
>> up to 15 or so.
>> It would look like:
>>
>> A B C d E F G ... Z Aa Ab Ac Ad Ae Aaa Aab Aac
...
>> If there is
Don Taylor wrote:
> Is there a way to discover the original string form of the instance that
> is represented by self in a method?
>
> For example, if I have:
>
> fred = C()
> fred.meth(27)
>
> then I would like meth to be able to print something like:
>
> about to call meth(
ProvoWallis wrote:
>
> My document looks like this
>
> A. Title Text
> 1. Title Text
> 1. Title Text
> 1. Title Text
> B. Title Text
> 1. Title Text
> 1. Title Text
>
> but I want to change the numbering of the second level to sequential
> numbers like 1, 2, 3, etc. so my output would look like
Fredrik Lundh wrote:
> [EMAIL PROTECTED] wrote:
>
>> The problem I'm trying to solve is.
>> There is a 5x5 grid.
>> You need to fit 5 queens on the board such that when placed there are
>> three spots left that are not threatened by the queen.
>
> when you're done with your homework (?), you can
301 - 400 of 428 matches
Mail list logo