Re: Wrap a function

2010-01-28 Thread alex23
Joan Miller pelok...@gmail.com wrote: Does anybody knows any library to help me to avoid the use of the main quotes, and brackets? I would to use anything as: $ ls /home = run(ls /home) It's not a library, but IPython[1] provides a lot of what you're after: IPython 0.9.1 -- An enhanced

Re: myths about python 3

2010-01-28 Thread alex23
Terry Reedy tjre...@udel.edu wrote: This statement was to counter the 'myth' that US was only targeted at 2.x when the current situation is quite the opposite. Not so much 'myth' as 'outdated information', they were very clear that 2.x was the initial target. In particular, several people

Re: python 3's adoption

2010-01-28 Thread alex23
Roy Smith r...@panix.com wrote: I'm inclined to call it a docs bug that these keywords are not in the HTML index.  Yes? No. The indices don't list the named parameters for any other built- in, so why would they for print()? -- http://mail.python.org/mailman/listinfo/python-list

Re: Perl 6 [was Re: myths about python 3]

2010-01-28 Thread alex23
geremy condra debat...@gmail.com wrote: Steven D'Aprano st...@remove-this-cybersource.com.au wrote: Out of curiosity, and completely off-topic, why has Perl 6 gone so badly? Too much like Perl. I was going to suggest that it's probably due to the multitude of ways to it could be done :) --

Re: which one is faster?

2010-01-28 Thread alex23
On Jan 29, 4:29 pm, Stephen.Wu 54wut...@gmail.com wrote: str.find(targetStr) str.index(targetStr) with exception str.count(targetStr) targetStr in str which is the fastest way to check whether targetStr is in str? It's generally a lot quicker to investigate this kind of question yourself

Re: Sikuli: the coolest Python project I have yet seen...

2010-01-27 Thread alex23
Tim Roberts t...@probo.com wrote: it's not the most efficient way to automate applications Sikuli doesn't seem that much different from Python in this way: it may not be the most efficient use of the computer's time, but I dare say it's significantly less demanding on the end user's. I can see

Re: myths about python 3

2010-01-27 Thread alex23
Terry Reedy tjre...@udel.edu wrote: Actually, Unladen Swallow is now targeted at 3.1; its developers have conservatively proposed its integration in CPython 3.3. I would not be completely shocked if it happens in 3.2. Why do I feel like there's less of an onus on Unladen Swallow to _actually

Re: List weirdness - what the heck is going on here?

2010-01-27 Thread alex23
Rotwang sg...@hotmail.co.uk wrote: Can anybody tell me what's going on? Your problem is basically this: a = [1] b = [a] * 2 b [[1], [1]] a.append(2) b [[1, 2], [1, 2]] The expression '[a] * 2' doesn't make two copies of list of a list of a, it makes two nested _references_ to it. When you

Re: python 3's adoption

2010-01-26 Thread alex23
Alf P. Steinbach al...@start.no wrote: Actually not, IMHO. All it does is is to provide incompatibility. They forgot Ronald Reagan's old maxim: if it don't need fixin', don't fix it. [...] Probably there must have been some rationale, but to put it bluntly removing the comparator is more

Re: Interesting Problem

2010-01-20 Thread alex23
Victor Subervi wrote: I think I finally have an interesting problem for y'all. I need to import a script from a lower dir, forcing me to change dirs: I'm surprised that no one has yet mentioned packages. Suppose you have the following folder layout and you stick an empty __init__.py in each

Re: python replace/sub/wildcard/regex issue

2010-01-18 Thread alex23
On Jan 19, 2:04 pm, tom badoug...@gmail.com wrote: trying to figure out how to solve what should be an easy python/regex/ wildcard/replace issue. but i'm missing something... Well, some would say you've missed the most obvious solution of _not_ using regexps :) I'd probably do it via string

Re: Is python not good enough?

2010-01-17 Thread alex23
Blog blogtes...@gmail.com wrote: Have you not heard about the Unladen Swallow project from google? There's a new PEP coming up which will propose google's codebase to be merged with Py3k, resulting in superior performance. This kind of worries me for a number of reasons: * unladen is _way_

Re: The answer

2010-01-17 Thread alex23
On Jan 18, 12:30 pm, Jive Dadson notonthe...@noisp.com wrote: These instructions are for MS Windows. 1) Create your modules folder. Let's say it's named Modules.  The documentation calls it a package. 2) In an explorer window or on the desktop, right click on My Computer, and select

Re: IDLE Namespace Toolbox? Windows.

2010-01-17 Thread alex23
On Jan 18, 8:22 am, W. eWatson wolftra...@invalid.com wrote: I've found it a bit aggravating that using dir and help, for example, that the output just rolls on off the screen and I have to play around with the shell scroll bars to find what I'm looking for. A few simple changes to mydir

Re: The answer

2010-01-17 Thread alex23
Jive Dadson notonthe...@noisp.com wrote: That requires a directory whose name embeds the Python version number, which is the evil from which I flee, or rather sought to flee.  Imagine if all your C++ code had to go into directories that were named for some specific C++ compiler.  It's just

Re: Dynamic HTML controls

2010-01-11 Thread alex23
On Jan 12, 1:26 pm, Alan Harris-Reid aharrisr...@googlemail.com wrote: Does anyone know where I can find any decent dynamically-constructed HTML control classes (dropdown list, table, input field, checkbox, etc.) written in Python. There's pyWeb[1], which seems pretty close to what you're

Re: Convert month name to month number faster

2010-01-06 Thread alex23
On Jan 6, 9:03 pm, wiso gtu2...@alice.it wrote: I'm optimizing the inner most loop of my script. I need to convert month name to month number. I'm using python 2.6 on linux x64. month_dict = {Jan:1,Feb:2,Mar:3,Apr:4, May:5, Jun:6,            Jul:7,Aug:8,Sep:9,Oct:10,Nov:11,Dec:12} def

Re: please help shrink this each_with_index() implementation

2010-01-06 Thread alex23
Phlip phlip2...@gmail.com wrote: And I, not my language, should pick and chose how to be rigorous. The language should not make the decision for me. Since you seem unwilling to put the minimal effort into producing the support code you'd need to work with Python the way you want, perhaps Perl

Re: File transfer with python

2010-01-06 Thread alex23
Valentin de Pablo Fouce thi...@gmail.com wrote: My intention is to be able to transfer files from one computer to another in this environment. Looking (and surfing) at internet the only suggestion given is to use low level sockets for this file transfer. Is there another way to do it, is

Re: Assertions, challenges, and polite discourse

2010-01-06 Thread alex23
r0g aioe@technicalbloke.com wrote: Well I think sometimes, for the sake of expediency and overall pleasantness, it's better to let the smaller things go: and if you just can't let them go then at least try and issue corrections in a friendly manner rather than a cold or pious one. The

Re: please help shrink this each_with_index() implementation

2010-01-05 Thread alex23
Phlip phlip2...@gmail.com wrote: They will tell me how to use except: (which is a good example why a program should not use exceptions for its normal control flow if at all possible). Really? Magic functions that coerce and eat errors are a better coding technique than exceptions and explicit

Re: please help shrink this each_with_index() implementation

2010-01-05 Thread alex23
Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: Stick around and you might learn something, but if you bite every time somebody tries to teach you, you'll soon run out of people willing to help you. The ongoing crowdsourced development by this group of Victor Subervi's project

Re: chown'ing by script

2010-01-05 Thread alex23
Carsten Haese carsten.ha...@gmail.com wrote: What is the underlying problem you're trying to solve with this approach? To be paid for developing a web site shopping cart without actually having to learn Python. -- http://mail.python.org/mailman/listinfo/python-list

Re: python mechanize proxy support question

2010-01-04 Thread alex23
On Jan 4, 5:42 pm, elca high...@gmail.com wrote: how can i add proxy support into my mechanize script? i was look for some reference , but not so much good hint from google. There are examples on using proxies with mechanize on the module's home page: http://wwwsearch.sourceforge.net/mechanize/

Re: python mechanize proxy support question

2010-01-04 Thread alex23
On Jan 4, 9:25 pm, elca high...@gmail.com wrote: that is only support mechanize.browser module.. actually im looking mechanize.urlopen method. From the docs: In these examples, the workings are hidden inside the mechanize.urlopen () function, which is an extension of urllib2.urlopen().

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread alex23
On Jan 5, 9:33 am, Nav navjotmu...@gmail.com wrote: what are the risks of globalnamespace use You're unnecessarily tying your code to the implementation. and what are the benefits? Absolutely none that using a dictionary doesn't also give you. --

Re: Can't Add Variable

2010-01-04 Thread alex23
On Jan 5, 3:40 am, Joe Riopel goo...@gmail.com wrote: On Mon, Jan 4, 2010 at 12:28 PM, Victor Subervi victorsube...@gmail.com wrote: Hi; I have this code snippet:     sql '''create table if not exists %sCustomerData ( I think you may have forgotten the = after sql. Jesus wept. How

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread alex23
On Jan 5, 1:12 pm, Nav navjotmu...@gmail.com wrote: When we create instances of objects by doing x = className () are we using globalnamespace? Well, you're using a namespace, which namespaces its in would depend on the scope in which that assignment occurred. And there's not really a global

Re: Potential Conflicts by Installing Two Versions of Python (Windows)?

2010-01-01 Thread alex23
On Jan 2, 11:37 am, W. eWatson wolftra...@invalid.com wrote: I suspect that if one installs v2.4 and 2.5, or any two versions, that one will dominate, or there will be a conflict.  I suppose it would not be possible to choose which one should be used. Comments? I suspect that you're not the

Re: pyZui - anyone know about this?

2009-12-15 Thread alex23
Donn donn.in...@gmail.com wrote: I find the notion of minute hot areas to be a little obscure -- Quick! Zoom into the last full-stop, it's a whole word in there! This aspect reminds me of the Red Dwarf episode Back to Reality, in which Rimmer is criticised for not finding information contained

Re: How to create a docstring for a module?

2009-12-06 Thread alex23
Phillip M. Feldman pfeld...@verizon.net wrote: It does seem as though IPython could be a bit more clever about this.   I disagree. I _like_ that IPython is only reporting on the current state of the interpreter and not trying to second guess what I meant. If the user asks for documentation on

Re: What is the significance of after() in this code?

2009-12-06 Thread alex23
zeph zep...@gmail.com wrote: True, though by *context* the after method looks like it takes a time (probably in milliseconds, given its size), and a method, and calls the method after that amount of time, and returning some process/ thread id to self.after_id.  Though if that's right, we still

Re: xmlrpc idea for getting around the GIL

2009-12-02 Thread alex23
Patrick Stinson patrickstinson.li...@gmail.com wrote: Not true. We sell the industry leading sampler engine, and it has been paying my salary for three years. It's high performance - every cycle counts. Our sampled instruments is loaded as a plugin from third-party applications and has been

Re: Python Programming Challenges for beginners?

2009-11-26 Thread alex23
On Nov 27, 1:24 pm, astral orange 457r0...@gmail.com wrote: I would like to test out what I know so far by solving programming challenges. Project Euler can be a lot of fun: http://projecteuler.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: IDE+hg

2009-11-24 Thread alex23
NiklasRTZ nikla...@gmail.com wrote: no py IDE I found has easy hg access. ActiveState's Komodo IDE has support for CVS, Perforce, subversion, bazaar, git and mercurial. -- http://mail.python.org/mailman/listinfo/python-list

Re: Where to put the error handing test?

2009-11-23 Thread alex23
On Nov 24, 1:15 pm, Peng Yu pengyu...@gmail.com wrote: Suppose that I have function f() that calls g(), I can put a test on the argument 'x' in either g() or f(). I'm wondering what is the common practice. If I put the test in f(), then g() becomes more efficient when other code call g() and

Re: midi file parser

2009-11-23 Thread alex23
On Nov 24, 3:15 pm, Sean McIlroy sean_mcil...@yahoo.com wrote: [code snipped] Great stuff. Have you considered bundling it up and putting it onto PyPI? -- http://mail.python.org/mailman/listinfo/python-list

Re: is there any FIX message handle modules in Python?

2009-11-18 Thread alex23
On Nov 19, 3:21 pm, Stephen.Wu 54wut...@gmail.com wrote: FIX message is the Financial information Exchange protocol messages... any 3rd libs we have? You mean like this one that was the first result when I googled 'python financial information exchange'? http://www.quickfixengine.org/ --

Re: ANN: Urwid 0.9.9 - Console UI Library

2009-11-17 Thread alex23
Daniel Fetchinson fetchin...@googlemail.com wrote: How did you make the html 'screenshots'? I guess you have some kind of urwid2html tool or some such or is it plain ncurses? It's all handled in the demo code. This is from tour.py: if urwid.web_display.is_web_request(): screen =

Re: WindowsError is not available on linux?

2009-11-17 Thread alex23
Peng Yu pengyu...@gmail.com wrote: But the document doesn't say shutil need to be imported in order to use WindowsError. Shall the document or the code be corrected? Neither, it's your understanding that needs correction. Benjamin wasn't trying to say that WindowsError is defined within

Re: WindowsError is not available on linux?

2009-11-17 Thread alex23
Peng Yu pengyu...@gmail.com wrote: I don't know about others. The wording Windows-specific error occurs was ambiguous to me. It could refers to some errors resulted from copying (on a linux machine) some files from linux file systems to windows files systems (via samba, maybe). I recommend to

Re: Language mavens: Is there a programming with if then else ENDIF syntax?

2009-11-16 Thread alex23
Steve Ferg steve.ferg.bitbuc...@gmail.com wrote: Does anybody know a language with this kind of syntax for ifThenElseEndif? VBScript. Is there any particular reason why this might be a *bad* language- design idea? VBScript. -- http://mail.python.org/mailman/listinfo/python-list

Re: Linux, Python 2.5.2, serverless binding LDAP?

2009-11-12 Thread alex23
On Nov 13, 10:47 am, Kevin Cole dc.l...@gmail.com wrote: Hi, I recently asked our IT department how to gain access to an addressbook.  After carefully explaining that I was on a Linux system using Python, I got the reply: You should use our LDAP. With LDAP you can pull any data you want

Re: Why Error is derived from EnvironmentError in shutil.py?

2009-11-11 Thread alex23
On Nov 12, 2:46 pm, Peng Yu pengyu...@gmail.com wrote: I see Error is derived from EnvironmentError in shutil.py. class Error(EnvironmentError):     pass I'm wondering why EnvironmentError can not be raised directly. Why Error is raised instead? This way you can explicitly trap on

Re: Pyfora, a place for python

2009-11-04 Thread alex23
Daniel Fetchinson fetchin...@googlemail.com wrote: Yes, this is about the right kind of response I think everybody deserves who puts energy/enthusiasm/effort/time into putting together a python-related forum. So what's the right kind of response deserved by those who put energy/

Re: About one class/function per module

2009-11-02 Thread alex23
Peng Yu pengyu...@gmail.com wrote: I don't think that this is a problem that can not be overcome. A simple solution might be to associate a unique identifier to each file, so that even the filename has been changed, the new version and the old version can still be identified as actually the

Re: About one class/function per module

2009-11-01 Thread alex23
On Nov 2, 8:11 am, Peng Yu pengyu...@gmail.com wrote: I prefer organized my code one class/function per file (i.e per module in python). I know the majority of programmers don't use this approach. Therefore, I'm wondering what its disadvantage is. You mean, what disadvantages it has _other_

Re: Pyfora, a place for python

2009-11-01 Thread alex23
Saketh saketh.bhamidip...@gmail.com wrote: If you have any suggestions, let me know -- this is a community effort! I'd like to suggest Pyaspora as a more apropos name ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: About one class/function per module

2009-11-01 Thread alex23
Peng Yu pengyu...@gmail.com wrote: So I am asking disadvantages besides python import mechanism is not friendly to it. Which part of name collisions have to be resolved somehow isn't explicit enough for you? You can't keep saying this works in C++ while refusing to accept that this is an

Re: Regular express question

2009-11-01 Thread alex23
On Oct 31, 12:48 pm, elca high...@gmail.com wrote: Hello, i have some text document to parse. sample text is such like follow in this document, i would like to extract such like SUBJECT = 'NETHERLANDS MUSIC EPA' CONTENT = 'Michael Buble performs in Amsterdam Canadian singer Michael Buble

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-30 Thread alex23
Alf P. Steinbach al...@start.no wrote: And no, I didn't do any research on that. If it mattered more (e.g. appearing as statement in the text) I'd have done that. The nice thing about Usenet is that people rush in to correct things. ;-) url:http://xkcd.com/386/ Unfortunately, the idiocy

Re: list comprehension problem

2009-10-30 Thread alex23
Terry Reedy tjre...@udel.edu wrote: alex23 wrote: You're completely wrong. Immutability has nothing to do with identity, which is what 'is' is testing for: What immutability has to do with identity is that 'two' immutable objects with the same value *may* actually be the same object

Re: Newbie advice

2009-10-29 Thread alex23
CSharpner csharp...@gmail.com wrote: Here's what I /want/ to do, but don't know where to begin: Welcome to the fun :) - Write web services in Python (I've done plenty of this in .NET, BTW). I'm a big fan of CherryPy: http://www.cherrypy.org/ It's very straightforward and easy to get into.

Re: Python newbie data structures question

2009-10-29 Thread alex23
On Oct 29, 4:31 pm, codingJoe tracy.monte...@gmail.com wrote: I am trying to choose the right data structure to do a value lookup with multiple keys. Hey Joe, Is something like this what you're after? from collections import defaultdict sports = defaultdict(list)

Re: Aaaargh! global name 'eggz' is not defined

2009-10-29 Thread alex23
kj no.em...@please.post wrote: As my Python apps grow in complexity and execution, I'm finding it more often the situation in which a program dies after a lengthy (i.e. expensive) run because the execution reaches, say, a typo. This is a good reason for breaking your program down into testable

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-29 Thread alex23
Alf P. Steinbach al...@start.no wrote: However, given what I've now learned about the current situation wrt. versions of Python, where Python 3.x is effectively a new language, and where apparently ActiveState has no installer for that, I'm rewriting to use the official distribution. I hope

Re: list comprehension problem

2009-10-29 Thread alex23
On Oct 30, 1:10 pm, Nick Stinemates n...@stinemates.org wrote: Some objects are singletons, ie there's only ever one of them. The most common singleton is None. In virtually every other case you should be using == and !=. Please correct me if I am wrong, but I believe you meant to say some

Re: What IDE has good git and python support?

2009-10-28 Thread alex23
On Oct 28, 1:56 am, Aweks a...@ewadev.com wrote: what do you use? ActiveState's Komodo IDE. -- http://mail.python.org/mailman/listinfo/python-list

Re: transpose array

2009-10-27 Thread alex23
On Oct 28, 8:26 am, yoshco yes@gmail.com wrote: hello everyone i have 3 arrays xVec=[a1,a2,a3,a4,a5] yVec=[b1.b2.b3.b4.b5] zVec=[c1,c2,c3,c4,c5] and i want to output them to a ascii file like so a1,b1,c1 a2,b2,c2 a3,b3,c3 ... I'd probably go with something like the following:

Re: Is there a command that returns the number of substrings in a string?

2009-10-27 Thread alex23
Gerard Flanagan grflana...@gmail.com wrote: I realise that calling this count function with a single argument would be functionally identical to calling str.count(), yes. But I can imagine the situation of wanting to find multiple (disjoint) substrings. Is there a reason for preferring

Re: ANN: WHIFF += Mako treeview url rewrites

2009-10-27 Thread alex23
Aaron Watters aaron.watt...@gmail.com wrote: I just tried it.  How do you get a traceback?  For me none of the javascript links work: they just do nothing. I'm getting the same as Paul in Firefox 3.5.3 with javascript disabled: class 'whiff.resolver.ModuleRootResolutionException' Python 2.5:

Re: Is there a command that returns the number of substrings in a string?

2009-10-26 Thread alex23
Gerard Flanagan grflana...@gmail.com wrote: def count(text, *args): Other than the ability to handle multiple substrings, you do realise you've effectively duplicated str.count()? -- http://mail.python.org/mailman/listinfo/python-list

Re: Reverse Iteration Through Integers

2009-10-19 Thread alex23
On Oct 19, 3:53 pm, Jabba Laci jabba.l...@gmail.com wrote: Would someone explain how str[::-1] work? I'm new to Python and I only saw so far the str[begin:end] notation. What is the second colon? Slice notation is of the form [start:stop:step]. start defaults to the start of the sequence, stop

Re: Checking a Number for Palindromic Behavior

2009-10-18 Thread alex23
On Oct 19, 12:32 pm, ru...@yahoo.com wrote: On Oct 18, 4:20 pm, MRAB pyt...@mrabarnett.plus.com wrote: Benjamin Middaugh wrote: Thanks to everyone who helped with my query on reversing integers. I have one more simple problem I'm having trouble solving. I want to check a number for

Re: Checking a Number for Palindromic Behavior

2009-10-18 Thread alex23
ru...@yahoo.com wrote: One, it was suggested without any evidence the the OP was probably asking about homework.  My observation over several years is that this group has a very poor record of identifying homework problems.  And if someone can conclude that the OPs problem was homework with

Re: HTMLgen???

2009-10-15 Thread alex23
On Oct 15, 6:58 pm, an...@vandervlies.xs4all.nl wrote: Does HTMLgen (Robin Friedrich's) still exsist?? And, if so, where can it be found? If you're after an easy to use html generator, I highly recommend Richard Jones' html[1] lib. It's new, supported and makes very nice use of context

Re: Sentiment analysis using Python

2009-10-08 Thread alex23
On Oct 9, 10:26 am, Henrik Lied henrikl...@gmail.com wrote: An experiment I'm currently involved with requires some form of texual analysis to figure out the mood of sentences (ergo, if the sentence in any way seem negative or positive). I vaguely recall seeing a presentation on exactly this

Re: When ‘super’ is not a good idea

2009-10-07 Thread alex23
Jean-Michel Pichavant jeanmic...@sequans.com wrote: a possible answer: - explicit implicit I'm not sure this is the correct one though :) To me, the explicit reference to the base class violates DRY. It also means you need to manually change all such references should the base class ever

Re: When ‘super’ is not a good idea

2009-10-07 Thread alex23
Jean-Michel Pichavant jeanmic...@sequans.com wrote: alex23 wrote: To me, the explicit reference to the base class violates DRY. It also means you need to manually change all such references should the base class ever change, something that using super() avoids. I found the correct answer

Re: How to sort a list of strings on a substring

2009-10-05 Thread alex23
Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: Oh please. That's a ridiculous excuse. Your post started with Here you are -- the implication is that you thought it *was* a solution, not a hint. A hint would be something like Write a key function, perhaps using lambda, and pass it

Re: Skeletal animation

2009-10-04 Thread alex23
On Oct 5, 8:05 am, Manowar r_marcanto...@netzero.net wrote: I am new to pyton and have asked this question several times the answer is always not sure. Here is my question sekeltal animation ( bone animation) is it possible with python? What i want to develop is an aquarium in realtime,

Re: Enormous Input and Output Test

2009-10-03 Thread alex23
On Oct 3, 11:54 pm, n00m n...@narod.ru wrote: I need your help to understand howhttp://www.spoj.pl/problems/INOUTEST/ can be passed in Python. My code for this is: === import psyco psyco.full() import sys def noo(b):     b = b.split()     return

Re: Enormous Input and Output Test

2009-10-03 Thread alex23
On Oct 4, 1:58 pm, n00m n...@narod.ru wrote: Do you know how big the input data set actually is? Of course, I don't know exact size of input. It's several MBs, I guess. And mind the fact: their testing machines are PIII (750MHz). Well, then, that's moved the problem from challenging to

Re: Python and lost files

2009-10-01 Thread alex23
Timothy W. Grove tim_gr...@sil.org wrote: I was just wondering if there was a way using python to view and recover files from the hard drive which would otherwise remain lost forever? I'm not familiar with any Python-based tools for data recovery, but you might be interested in mercurial[1],

Re: Partial directory search question

2009-09-30 Thread alex23
Tim Chase python.l...@tim.thechases.com wrote: If you're doing more processing than just printing it, your for-loop is a better (clearer) way to go.  If you have lots of processing code, it might help to do the inverse:    for filename in os.listdir(location):      if not

Re: Simple if-else question

2009-09-30 Thread alex23
dksr dksre...@gmail.com wrote: Yes thats what I thought. for-else looks similar to if-else and in if- else, else part is executed only when if part is not executed, but in for-else it has entirely a different job. If you think of if-else more in terms of the else-branch occurring when the

Re: How to pass a global variable to a module?

2009-09-29 Thread alex23
Mars creature jin...@gmail.com wrote: Assume that I have 10 parameters need to pass to the function. If these parameters are fixed, I can use another module to store these 10 parameters, and import to the module, as suggested by jean-michel. But what if these 10 parameters will be changed in

Re: two html pages from twisted server

2009-09-29 Thread alex23
On Sep 30, 1:30 am, Mikie thephantom6...@hotmail.com wrote: Could soneone show me a simple example of a twisted server that loads 2 html pages www..com:7899/page1/ www..com:7899/page2/ Thanx Hey Mikie, Jp Calderone has been writing a very handy 'Twisted Web in 60 seconds' series,

Re: How to jump out of nested 'for'-loops?

2009-09-28 Thread alex23
Peng Yu pengyu...@gmail.com wrote: I want some command to jump out of nested loop. I'm wondering what is the most convenient way to do so in python. I'm sure I'm wasting my breath by saying this, but would it hurt you to actually check the list before posting? You're not the only person to ever

Re: Pipeline Generator presentation - where?

2009-09-28 Thread alex23
Sean DiZazzo half.ital...@gmail.com wrote: I remember reading (a few times) a presentation about using generators to create pipelines  The idea was to create very specific and small generator functions, and then combine them together to get larger results.  The example used was to parse log

Re: Combining sets/dictionaries

2009-09-22 Thread alex23
Alfons Nonell-Canals alfons.non...@upf.edu wrote: finally I've solved it using a combinatorics library which allows to do this kind of things. If you're using a version of Python 2.6 you might find that itertools.combinations does what you want without requiring the additional code. --

Re: Combining sets/dictionaries

2009-09-22 Thread alex23
On Sep 23, 12:44 pm, alex23 wuwe...@gmail.com wrote: Alfons Nonell-Canals alfons.non...@upf.edu wrote: finally I've solved it using a combinatorics library which allows to do this kind of things. If you're using a version of Python 2.6 you might find that itertools.combinations does what

Re: Can print() be reloaded for a user defined class?

2009-09-20 Thread alex23
Peng Yu pengyu...@gmail.com wrote: Is __repr__ = __str__ copy by reference or by value? If I change __str__ later on, will __repr__ be changed automatically? What would you expect the outcome to be if these were functions rather than class methods? (Or any type of object, really...) Wouldn't

Re: How to refer to class name and function name in a python program?

2009-09-20 Thread alex23
Peng Yu pengyu...@gmail.com wrote: What does @echo mean? Have you read _any_ of the documentation? Or is this all an exercise in seeing if you can convince a group of disparate strangers to teach you Python for free? -- http://mail.python.org/mailman/listinfo/python-list

Re: testing code in python source package

2009-09-20 Thread alex23
Peng Yu pengyu...@gmail.com wrote: I'm wondering if the development of python is test driven. If it is, where in the Python-2.6.2 source directory is the test code for the modules in ./Lib? Unsurprisingly, they're located in Lib/test. Is it _really_ that difficult to find? --

Re: An assessment of the Unicode standard

2009-09-17 Thread alex23
Hendrik van Rooyen hend...@microcorp.co.za wrote: The opposite thing is of course a continual source of trouble - we all have words for stuff we have never  seen, like  dragon,  ghost,  goblin,  leprechaun,  the current King of France, God, Allah, The Holy Trinity, Lucifer, Satan, Griffin -

Re: SQLite or files?

2009-09-17 Thread alex23
TerryP bigboss1...@gmail.com wrote: Yeah, I'm sure that is the same kind of thinking that caused 16-bit MS- DOS applications to remain a part of Windows NT so long. So what part of the standard library do you recommend using instead? Or was there no time for advice between snarkiness? --

Re: An assessment of the Unicode standard

2009-09-17 Thread alex23
On Sep 18, 2:39 pm, Dennis Lee Bieber wlfr...@ix.netcom.com wrote:         Granted, a proper version would use a class where the two Venus objects have a different description... I think I'd be more inclined to model Venus and treat the others as views :) --

Re: class initialization problem

2009-09-17 Thread alex23
On Sep 18, 3:08 pm, rantingrick rantingr...@gmail.com wrote: ok here is some code. this will cause an infinite recursion. class A():     def __init__(self, *args):         self.nestedA = A(*args) #NO GOOD! there must be a way to create an instance of an object within the same objects

Re: class initialization problem

2009-09-17 Thread alex23
On Sep 18, 3:08 pm, rantingrick rantingr...@gmail.com wrote: ok here is some code. this will cause an infinite recursion. class A():     def __init__(self, *args):         self.nestedA = A(*args) #NO GOOD! How about: class A(object): def __init__(self, first=True, *args): if

Re: class initialization problem

2009-09-17 Thread alex23
On Sep 18, 3:31 pm, alex23 wuwe...@gmail.com wrote: On Sep 18, 3:08 pm, rantingrick rantingr...@gmail.com wrote: ok here is some code. this will cause an infinite recursion. class A():     def __init__(self, *args):         self.nestedA = A(*args) #NO GOOD! How about:   class

Re: Does python 3.1 support sybase module?

2009-09-10 Thread alex23
On Sep 10, 4:17 pm, Michel Claveau - MVPenleverlesx_xx...@xmclavxeaux.com.invalid wrote: What is this final comma?   My guess without looking at the code is that the line occurs in a dict definition: PACKET_OF_VALUES = dict( maintainer=uSebastien Sable, version=3.0, ... )

Re: Usage of main()

2009-09-04 Thread alex23
Sean DiZazzo half.ital...@gmail.com wrote: What are you using to test the scripts?  I could be completely wrong, but I find it hard to believe that the second version is much (if any) faster than the first.  Then again, I don't know much about the internals... Sorry, Sean, unfortunately you

Re: Usage of main()

2009-09-04 Thread alex23
Carl Banks pavlovevide...@gmail.com wrote: Sorry, alex, unfortunately you are wrong, although it's understandable that you've missed this. [...] The speedup comes because local lookups are much faster.  Accessing a local is a simple index operation, and a nonlocal is a pointer deref or two,

Re: map

2009-09-01 Thread alex23
Piet van Oostrum p...@cs.uu.nl wrote: [myFunc(elt, 'booHoo') for elt in myList] is also a good candidate and in this case I think it is preferable to both the loop and the map with a partial or lambda in terms of clarity. From memory, a listcomp with a non-builtin function is also faster than

Re: lambda functions

2009-09-01 Thread alex23
Pierre pierre.gaill...@gmail.com wrote: I would like to know if it is possible to define a loop in a lambda function It is if you can easily replace the for loop with a call to map(): s_minus_1 = lambda s: map(lambda x: x-1, s) test = range(1, 100, 10) test [1, 11, 21, 31, 41, 51, 61,

Re: Can't set attribute?!

2009-09-01 Thread alex23
dolgion ch dolgi...@gmail.com wrote: the NETRPCGateway attribute self.db can't be set? why not? i've tried changing the RPCSession login function to set the variable like this as well: self.gateway.db = db which doesn't work either, same exception. any suggestions? The problem is

Re: can python make web applications?

2009-08-25 Thread alex23
Mark markonli...@internode.on.net wrote: On Sun, 23 Aug 2009 21:45:17 +0100, Goke Aruna wrote: http://www.openerp.com, all done is python. That does look impressive. Is that Django or Turbogears? Turbogears, according to the product's wikipedia page. --

Re: Python on the Web

2009-08-25 Thread alex23
Phil phil...@gmail.com wrote: My interest in Python 3.1 was actually to develop a framework. Again, I can feel the flames. :) I understand there are enough frameworks but I actually have no applications that I wish to develop. No offense intended, but that's probably the worst approach to

Re: Simple IRC library

2009-08-24 Thread alex23
devaru ajoys...@gmail.com wrote: I am new to Python language. I want to capture(either in database or a file) the conversation in IRC. Please suggest me some simple IRC library or code snippet for this. I recommend the circuits[1] library, which contains a sample irc bot [2]. You'll want to

<    4   5   6   7   8   9   10   11   12   13   >