Re: Python 3000 vs Perl 6

2008-06-24 Thread cokofreedom
On Jun 24, 8:20 am, "Corey G." <[EMAIL PROTECTED]> wrote: > If Perl 6 ever does get on its feet and get released, how does it > compare to Python 3000? Is Perl 6 more like Java now with Parrot? I > just want to make sure that Python is staying competitive. > > If this is the wrong mailing list, j

Re: String question

2008-06-24 Thread cokofreedom
On Jun 24, 5:38 am, "Mark Tolonen" <[EMAIL PROTECTED]> wrote: > "Andreu" <[EMAIL PROTECTED]> wrote in messagenews:[EMAIL PROTECTED] > > Yes, ... don't ask me why, but in fact v1,v2,v3 = str1.split() > > does not seem to work. My original problem was I forgot about > > the parenthesis as Tim point

Re: Python 3000 vs Perl 6

2008-06-24 Thread cokofreedom
On Jun 24, 10:36 am, "Corey G." <[EMAIL PROTECTED]> wrote: > What I meant, in terms of dealing with accurate or non-accurate rumors > is with speed, yes. There are plenty of comparisons where Perl is > 4-15x faster then Python for 'some' operations regarding regular > expressions, etc. > > For me

Re: binary representation of an integer

2008-06-24 Thread cokofreedom
On Jun 24, 10:38 am, Mark Dickinson <[EMAIL PROTECTED]> wrote: > On Jun 24, 9:03 am, eliben <[EMAIL PROTECTED]> wrote: > > > What would be the quickest way to do this ? I think that for dec2bin > > conversion, using hex() and then looping with a hex->bin lookup table > > would be probably much fast

Re: binary representation of an integer

2008-06-24 Thread cokofreedom
And: # return as a string def itob_string(integer, count = 8): return "".join(str((integer >> i) & 1) for i in range(count - 1, -1, -1)) # return as an iterator (i.e [0, 0, 0, 0, 1, 0, 1, 0]) def itob_list(integer, count = 8): return [(integer >> i) & 1 for i in range(count - 1, -1, -1)]

Re: python -regular expression - list element

2008-06-25 Thread cokofreedom
On Jun 25, 11:55 am, antar2 <[EMAIL PROTECTED]> wrote: > Hello, > > I am a beginner in Python and am not able to use a list element for > regular expression, substitutions. > > list1 = [ 'a', 'o' ] > list2 = ['star', 'day', 'work', 'hello'] > > Suppose that I want to substitute the vowels from lis

Re: IDE on the level of Eclipse or DEVc++?

2008-06-25 Thread cokofreedom
On Jun 25, 12:38 pm, Jorge Godoy <[EMAIL PROTECTED]> wrote: > Ben Finney wrote: > > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > > >> If you're into clickodroms, you may want to have a look at Eric too. > >> As far as i'm concerned, I still wait for something that would be > >> worth dropping

Making code more efficient and effective

2008-06-26 Thread cokofreedom
I've written up a little piece of code that isn't that foolproof to scan through a file (java presently) to find functions and then look for them throughout the document and output the name of the function, followed by how many times it appears and the lines it appears on. What I was looking for w

Re: Making code more efficient and effective

2008-06-26 Thread cokofreedom
On Jun 26, 5:42 pm, [EMAIL PROTECTED] wrote: > Cédric Lucantis: > > > PAT = re.compile('^[ ]*(public|protected|private)[ ]+([a-zA-Z0-9_]+) > > [ ]+([a-zA-Z0-9_]+)[ ]+\((.*)\).*$') > > ... > > It might be hard to read but will avoid a lot of obscure parsing code. > > You can use the VERBOSE mode, to

Re: Why is recursion so slow?

2008-06-30 Thread cokofreedom
In case anyone is interested... # Retrieved from: http://en.literateprograms.org/Fibonacci_numbers_(Python)?oldid=10746 # Recursion with memoization memo = {0:0, 1:1} def fib(n): if not n in memo: memo[n] = fib(n-1) + fib(n-2) return memo[n] # Quick exact computation of large in

Re: what is meaning of "@" in pyhon program.

2008-06-30 Thread cokofreedom
On Jun 28, 8:41 pm, Thierry <[EMAIL PROTECTED]> wrote: > > ie: > > @if os.exists(foo): > >etc > >etc > > > and > > > @for blah: > >etc > >etc > > This sounds more like PHP code, where a @ prefixing a function means > that even if there are errors or warnings, you don't want to see t

Installing paramiko and pycrypto

2008-07-01 Thread cokofreedom
I am really stuck presently, trying to install these on my Windows XP. I have downloaded easy_install and it is now in Python25\Scripts but none of the commands I have read in either program folder have worked to install them. I was hoping someone could give me a step by step guide to installing t

Re: yo...

2008-07-07 Thread cokofreedom
On Jul 7, 11:55 am, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > On 2008-07-07, abhishek <[EMAIL PROTECTED]> wrote: > > > hey guys...me nu 2 python yo...help me...by da way...jus joined > > inthanks > > Ask a specific question and you may get an answer. > > If you want an answer from me, it helps

Re: yo...

2008-07-07 Thread cokofreedom
On Jul 7, 3:47 pm, Bruno Desthuilliers wrote: > [EMAIL PROTECTED] a écrit : > (snip) > > > However welcome to Python and this Google > > Group. > > > This is *not* a google group. This is the usenet newsgroup > comp.lang.python, made accessible TTW by google. > Touche ;) -- http://mail.python.o

Re: Impossible to change methods with special names of instances of new-style classes?

2008-07-09 Thread cokofreedom
> > My question is: did something about the way the special method names are > implemented change for new-style classes? > >>> class old: pass >>> class new(object): pass >>> testone = old() >>> testone.__call__ = lambda : 33 >>> testone() 33 >>> testtwo = new() >>> testtwo.__cal

Re: a simple 'for' question

2008-07-09 Thread cokofreedom
On Jul 9, 2:08 am, Ben Keshet <[EMAIL PROTECTED]> wrote: > Hi fans, > > I want to use a 'for' iteration to manipulate files in a set of folders, > something like: > > folders= ['1A28','1A6W','56Y7'] > for x in folders: > print x # print the current folder > f = open('my/path/way/x/my_fi

You, spare time and SyntaxError

2008-07-09 Thread cokofreedom
def ine(you): yourself = "what?" go = list("something"), list("anything") be = "something" please = be, yourself yourself = "great" for good in yourself: if you is good: good in you please.add(more, good) else: def inition(lacks, c

Re: You, spare time and SyntaxError

2008-07-09 Thread cokofreedom
> > just... great !-) > Thanks :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner Question : Iterators and zip

2008-07-14 Thread cokofreedom
> > zip(*vec_list) will zip together all entries in vec_list > Do be aware that zip stops on the shortest iterable. So if vec[1] is > shorter than vec[0] and matches otherwise, your output line will be > truncated. Or if vec[1] is longer and vec[0] matches as far as it goes, > there will be no si

Re: What is the role of python2.6 and C++?

2008-07-21 Thread cokofreedom
On Jul 21, 10:17 am, "甜瓜" <[EMAIL PROTECTED]> wrote: > Howdy, > > I'm confused about the motivation of releasing python2.6 and python3.0 > at the *same* time. IMO, 2.6 should be compatible with 2.5 while 3.0 > is new style python. Currenly, most python projects works fine in 2.5. > When 3.0 becomes

Re: Python Written in C?

2008-07-22 Thread cokofreedom
On Jul 22, 5:59 am, Larry Bates <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: > > On 2008-07-22, Larry Bates <[EMAIL PROTECTED]> wrote: > > >> You talk about "writing it in assembly language for each MPU > >> chip". Actually it is even better than that. We now have > >> these modern invention

Re: Attack a sacred Python Cow

2008-07-24 Thread cokofreedom
> > Please understand that I'm not arguing about this particular design > choice (and FWIW, I'd mostly agree on the point that having a != b > different from not (a == b) is actually a wart). I'm just correcting > your statement about the behaviour of __eq__ / __ne__ not being > documented, which i

Re: New to Python, familiar with Perl - Seeking info sources

2008-07-24 Thread cokofreedom
On Jul 24, 3:53 pm, Brett Ritter <[EMAIL PROTECTED]> wrote: > After many years happily coding Perl, I'm looking to expand my > horizons. [no flames please, I'm pretty aware of Perl's strengths and > weaknesses and I'm just here to learn more, not to enter religious > debates]. > > I've gone through

Re: Attack a sacred Python Cow

2008-07-24 Thread cokofreedom
> > My words aren't as clear as they should be. I mean that Python lets > *you* do something without documenting, or rather stating to use a > better term, that your intention is the non-obvious one. I'm not > saying that Python itself lacks documentation for its own behaviour; > I'm saying it shou

Re: Attack a sacred Python Cow

2008-07-25 Thread cokofreedom
> > By that logic, C++ is not OO. By that logic, Ruby is not OO. By that > logic, I know of only one OO language: Java :) > > The fact that a language doesn't force you to do object-oriented > programming doesn't mean that it's not object-oriented. In other > words, your words are nonsense. > No,

Re: benchmark

2008-08-07 Thread cokofreedom
> > Honestly, performance benchmarks seem to be the dick size comparison > of programming languages. > But in the honour of dick size: http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all http://shootout.alioth.debian.org/debian/benchmark.php?test=all&lang=all -- http://mail.pyth

Re: benchmark

2008-08-08 Thread cokofreedom
On Aug 8, 9:08 am, alex23 <[EMAIL PROTECTED]> wrote: > On Aug 8, 2:49 pm, Dhananjay <[EMAIL PROTECTED]> wrote: > > > Is it that a question of time and effort, > > or is there something that doesn't make it appropriate to python ? > > I don't think I've ever seen anyone who has raised concerns about

Re: benchmark

2008-08-11 Thread cokofreedom
On Aug 11, 10:55 am, [EMAIL PROTECTED] wrote: > On Aug 10, 10:10 pm, Kris Kennaway <[EMAIL PROTECTED]> wrote: > > > jlist wrote: > > > I think what makes more sense is to compare the code one most > > > typically writes. In my case, I always use range() and never use psyco. > > > But I guess for mo

Re: Nested try...except

2008-04-02 Thread cokofreedom
On Apr 2, 3:06 pm, [EMAIL PROTECTED] wrote: > Hi, > > I found the following code on the net - > > http://mail-archives.apache.org/mod_mbox/httpd-python-cvs/200509.mbox/[EMAIL > PROTECTED] > > def count(self): > -db = sqlite.connect(self.filename, > isolation_level=ISOLATION_LEVEL) > -

who said python can't be obsfucated!?

2008-04-02 Thread cokofreedom
def s(c):return[]if c==[]else s([_ for _ in c[1:]if _=c[0]]) Anyone else got some wonders...? -- http://mail.python.org/mailman/listinfo/python-list

Looking for Advanced Python Tutorials

2008-04-04 Thread cokofreedom
I was wondering if anyone knew of some online (free if possible) advanced tutorials, especially ones that provides tasks and ideas for small projects. The issue for myself is I want to improve my python programming level, and my ability to program in general, but come up blank thinking of a possibl

Re: First Python project - comments welcome!

2008-04-07 Thread cokofreedom
Just a random check. Is __gsignals__ a builtin type? Else it would probably be better not to include the postfix underscores. Though I might be wrong here. Otherwise seems pretty good and well organised. I hate it when people go comment mad, but you've kept them to the places where an explanation i

Re: PROBLEMS WITH PYTHON IN SOME VARIABLE,FUNCTIONS,ETC.

2008-04-08 Thread cokofreedom
'I have designed a program with more than 500 if elif else' This was your first mistake... (ii) x3=x1.find(x2) returns an integer corresponding to the start position in x1 where it found x2, otherwise it will return -1. (i) ... what kind of vague numbers? It should just give you an integer res

Re: PROBLEMS WITH PYTHON IN SOME VARIABLE,FUNCTIONS,ETC.

2008-04-08 Thread cokofreedom
> > I have a car. I have turned the ignition key but it fails to start. > Please tell me what is wrong with it. > The engine is missing! Am I close? -- http://mail.python.org/mailman/listinfo/python-list

Re: PROBLEMS WITH PYTHON IN SOME VARIABLE,FUNCTIONS,ETC.

2008-04-09 Thread cokofreedom
Umm, Mesopotamia is an area geographically located between the Tigris and Euphrates rivers, Bangalore isn't anywhere near that. And most of that is presently under American control. If you don't want to give out your code then try explaining it better. What is the input, what is the output, how ar

Re: questions about Exceptions?

2008-04-10 Thread cokofreedom
In general you should only catch the exceptions you want to catch, therefore avoiding the issue of catching "unexpected" ones, for instances the programming unexpectandly closing. Well, exception handling is expensive (when it catches one) so it really is up to you. If you are using eval and know

Re: questions about Exceptions?

2008-04-10 Thread cokofreedom
> def Calc(): > global nbr > try: > print eval(nbr) > #a = Label(mygui, text=eval(nbr)) > #a.place(relx=0.4, rely=0.1, anchor=CENTER) > except: > print "Not computable" > nbr = "" > > def Erase(): > global nbr > nbr = "" Seems to me you could

Re: questions about Exceptions?

2008-04-10 Thread cokofreedom
> the erase() id alwys need if u wanna abort whilst u wrote something. But if it is meant to only evaluate once you've pressed the enter key (I take it?) you shouldn't need that. And if you are to abort while evaluating it will not do that. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find documentation about methods etc. for iterators

2008-04-10 Thread cokofreedom
> > This for me is Python's chief selling point: dir()dir() and > help(). Python's two selling points are dir(), help(), and very > readable code. Python's *three* selling points are dir(), > help(), very readable code, and an almost fanatical devotion to > the BFDL. Amongst Python's sellin

Re: Rounding a number to nearest even

2008-04-11 Thread cokofreedom
couldn't you just do. #untested new_round(n): answer = round(n) # is answer now odd if answer % 2: return answer - 1 else: return answer -- http://mail.python.org/mailman/listinfo/python-list

Re: Rounding a number to nearest even

2008-04-11 Thread cokofreedom
On Apr 11, 1:19 pm, [EMAIL PROTECTED] wrote: > couldn't you just do. > > #untested > new_round(n): > answer = round(n) > # is answer now odd > if answer % 2: > return answer - 1 > else: > return answer Whoops, this also affects odd numbers... Will try and find a GOOD solution late

Re: Python Success stories

2008-04-23 Thread cokofreedom
Civilisation 4 uses Python everywhere and is the main tool used by Modders of the game. -- http://mail.python.org/mailman/listinfo/python-list

Re: Issue with regular expressions

2008-04-29 Thread cokofreedom
| # Double Quote Text |"# match a double quote |(# - Two Possiblities: |\\. # match two backslashes followed by anything (include newline) ||# OR |[^"]

Re: Code/test ratio wrt static vs dynamic typing [was: Re: Python Success stories]

2008-04-30 Thread cokofreedom
> > A rather off-topic and perhaps naive question, but isn't a 1:4 > production/test ratio a bit too much ? Is there a guesstimate of what > percentage of this test code tests for things that you would get for > free in a statically typed language ? I'm just curious whether this > argument against

Re: Newbie question - probably FAQ (but not exactly answered by regular FAQ)

2008-05-06 Thread cokofreedom
2.5 seems the defacto standard now for a new user, NB: probably not the standard for the common business productions. However are you on Windows or *nix? *nix may ship a certain version, so for ease of use it would be best to use that. Personally I use 2.5 because it is a complete version, and the

Re: computing with characters

2008-05-06 Thread cokofreedom
On May 6, 12:22 pm, Boris Borcic <[EMAIL PROTECTED]> wrote: > Duncan Booth wrote: > > Torsten Bronger <[EMAIL PROTECTED]> wrote: > > >> The biggest ugliness though is ",".join(). No idea why this should > >> be better than join(list, separator=" "). Besides, ",".join(u"x") > >> yields an unicode

Re: Am I missing something with Python not having interfaces?

2008-05-06 Thread cokofreedom
> I would imagine this is why I haven't found any schools teaching > Python in their basic programming classes too. On the dynamic typing, > isn't that the same sort of thing that lots of scripting languages > do? VBScript doesn't require you to define your variables, but I > don't really want to

Re: Reversing a dict?

2008-05-06 Thread cokofreedom
On May 6, 5:20 pm, [EMAIL PROTECTED] wrote: > Hi - further to my earlier query regarding partial matches (which with > all your replies enabled me to advance my understanding, thanks), I > now need to reverse a dict. > > I know how to reverse a list (with the reverse method - very handy), > but it

Re: comparing dictionaries

2008-05-07 Thread cokofreedom
On May 7, 4:08 pm, brad <[EMAIL PROTECTED]> wrote: > I want to compare two dicts that should have identical info just in a > different data structure. The first dict's contents look like this. It > is authoritative... I know for sure it has the correct key value pairs: > > {'001' : '01'} > > The se

Re: What is the purpose of ptyhon in Windows

2008-05-07 Thread cokofreedom
On May 7, 4:08 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > hi All, > I have no idea why I need to learn a new scripting language, > nothing much to the sytnax, > I need to understand what could be the prupose of another scripting > language > > Cna you please help me with this, > Is there

Re: Newbie to python --- why should i learn !

2008-05-08 Thread cokofreedom
C# using System; namespace HelloWorld { Class HelloWorld { static void Main(String[] args) { Console.WriteLine("Hello World"); } } } -- http://mail.python.org/mailman/listinfo/python-list

Re: anagram finder / dict mapping question

2008-05-09 Thread cokofreedom
>>> key = ''.join(sorted(word)) I tend to strip and lower the word as well, otherwise "Hello" and "hello" do not compare...depends on what you want though! Plus you might get a lot of "word\n" as keys... My technique is the this way def anagram_finder(words): anagrams = {} for word in wo

Re: Weird expression result

2008-08-18 Thread cokofreedom
On Aug 18, 5:57 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > I'm probably missing something obvious but I can't put my finger on > it: > > >>> (3 in [3]) == True > > True > > >>> 3 in ([3] == True) > > Traceback (most recent call last): > File "", line 1, in > TypeError: argument of type 'bool

Re: def X(l=[]): weirdness. Python bug ?

2008-08-22 Thread cokofreedom
On Aug 22, 11:13 am, Bart van Deenen <[EMAIL PROTECTED]> wrote: > Hi all. > > I've stumbled onto a python behavior that I don't understand at all. > > Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) > > # function > def X(l=[]): >    l.append(1) >    print l > > # first call of X > X() > [1] > > #

<    1   2