How do i set the PYTHONPATH variable
?
From answers to my query on "editing path" I
realized that this is what should be done if i want to include another folder in
the Python search path.
I tried:
import sys
sys.path.append('additional path')
but it worked only at runtime and is forgotte
others already gave good responses, so mine are short.
> 1)where do `is` and `==` yield the same results?
"is" is object identity comparison while
"==" is object value comparison
> 2)where do they not yield the same results?
they give different results when you have two different objects
regar
On 11/6/06, Tim Johnson <[EMAIL PROTECTED]> wrote:
* Kent Johnson <[EMAIL PROTECTED]> [061106 10:31]:>> In [9]: a=[1,2]>> In [10]: b=[1,2] Hmmm! Hmmm! Lookee here: ## console session
>>> a=[1,2]>>> b=[1,2]>>> a is bFalse>>> c='1' ## one byte>>> d='1' ## one byte>>> c is dTrue>>> c='1,2'>>> d='
c='1' ## one byte
d='1' ## one byte
c is d
> True
c='1,2'
d='1,2'
c is d
> False
>
> The Hmmm! is emmitted because I'm thinking that if everything is an
> object in python, then why does `c is d` evaluate to True when
> the assigned value is 1 byte and evaluate to Fa
John,
Thanks...I was a bit deep in a script trying to figure out why I kept
getting global key errors (trying to make sure that re.compile and
import re weren't run but once...doh?) when you responded.
I guess that settles it, then...for this particular instance, '"J" in s'
is indeed faster th
On 07/11/06, Jonathon Sisson <[EMAIL PROTECTED]> wrote:
> Just out of curiousity (since I really can't say myself), does the code
> below import re each time it loops? I ran the same commands and saw
> quite similar results (0.176 usec per loop for the first test and 0.993
> usec per loop for the
Just out of curiousity (since I really can't say myself), does the code
below import re each time it loops? I ran the same commands and saw
quite similar results (0.176 usec per loop for the first test and 0.993
usec per loop for the second test), and I was just curious if that
import (and the
For small string object python has optimization method so it is really the same object!Cheers,pujoOn 11/7/06, Tim Johnson <
[EMAIL PROTECTED]> wrote:* Kent Johnson <
[EMAIL PROTECTED]> [061106 10:31]:>> In [9]: a=[1,2]>> In [10]: b=[1,2] Hmmm! Hmmm! Lookee here: ## console session>>> a=[1,2]>>>
* Kent Johnson <[EMAIL PROTECTED]> [061106 10:31]:
>
> In [9]: a=[1,2]
>
> In [10]: b=[1,2]
Hmmm! Hmmm!
Lookee here:
## console session
>>> a=[1,2]
>>> b=[1,2]
>>> a is b
False
>>> c='1' ## one byte
>>> d='1' ## one byte
>>> c is d
True
>>> c='1,2'
>>> d='1,2'
>>> c is d
False
The Hmmm
On Monday 06 November 2006 22:52, Alan Gauld wrote:
> I wasn't aware we were having a war, but I'm happy to desist :-)
FWIW, I wasn't aware of one either. (Mind you I've often noticed what passes
for plain speaking in the UK passes for vehement flame war elsewhere, so
maybe that's it)
Anyway, i
What does
Pythonw -i test.py -i
do in Mac machine?
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Dear Guys,
I have downloaded CGkit and Aqsis and tried the examples from it.
I run the samples, like the torus with grass. It is simple fantastic.
I would like to make some artistic visualization with the power of python
and the beauty of a professional renderer.
I think about colored semitransl
[Danny]
>> If you're using NumPy, then the correct package name for it is 'numpy',
>> not 'Numeric'.
>>
>> from numpy import *
[Linda]
> I think the code is suing Numeric (is it called numpy now? if so, how
> to make the change?)
So it's not your code? If it's not your own code then, nail
Danny:
> -Original Message-
> Date: Mon, 6 Nov 2006 14:28:30 -0800 (PST)
> From: Danny Yoo <[EMAIL PROTECTED]>
> Subject: Re: [Tutor] (OT) Flame wars
> To: Chris Hengge <[EMAIL PROTECTED]>
> Cc: Tutor
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=f
On Mon, 6 Nov 2006, Chris Hengge wrote:
> I may have just missed the point to your attempt to derail this
> conversation =P
Hi Chris,
Ah! Are we talking about regular expressions anymore?
No?
Good. *grin*
> Why do all that when you can just
>
> str = "Hello World"
> print str * 2
Let
* Alan Gauld <[EMAIL PROTECTED]> [061106 14:01]:
>
> The other advantage in Ruby is that the block can be arbitrarily
> complex, not just a single expression as in a Python lambda. This
> allows us to embed loops and all sorts, effectively adding new
> command structures to the language in a way t
Danny Yoo wrote:
>> Do you know a better way to do this?
>> [snip stuff]
>>
>
> Hi Carlos,
>
> Here's one way to handle it. If you're familiar with modulo "clock"
> arithmetic, you might want to apply it above.
>
Also, consider this example, Carlos:
>>> aList = [1,2,3,4,5,6]
>>> a,b,c =
Chris Hengge wrote:
> I may have just missed the point to your attempt to derail this
> conversation =P
Ah, well, don't worry. I didn't learn of lambda until I'd been using
Python for a year or more.
I was trying to pass arguments to callbacks in TKinter.
one of the Pythonistas (Alan, Danny, Ken
"Danny Yoo" <[EMAIL PROTECTED]> wrote
> So let's try to squash this one now. There are more interesting
> problems
> to solve. Or other flame wars to fight.
I wasn't aware we were having a war, but I'm happy to desist :-)
> Let me see if we can do something constructive. I've been doing a
> s
"Danny Yoo" <[EMAIL PROTECTED]> wrote
> Here's one way to handle it. If you're familiar with modulo "clock"
> arithmetic, you might want to apply it above.
Indeed, I should have thought of that.
Good catch Danny.
Alan G.
___
Tutor maillist - Tut
On 11/6/06, Danny Yoo <[EMAIL PROTECTED]> wrote:
>
>
> On Mon, 6 Nov 2006, linda.s wrote:
>
> > I use Python 2.4 IDLE to open a py code which import numeric.
> > I have installed both scipy and numpy into my c:\python24. However, it
> > was still reported as:
>
> Hi Linda,
>
> We need more details.
"Carlos" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Do you know a better way to do this?
>
>if i < A_Len-1:
>a = A_List[i-1]
>b = A_List[i]
>c = A_List[i+1]
>else:
>a = A_List[i-1]
>
I may have just missed the point to your attempt to derail this conversation =PHowever.. Why do all that when you can just str = "Hello World"print str * 2(Maybe I missed some concept that this small example doesn't accuratly reflect)
On 11/6/06, Danny Yoo <[EMAIL PROTECTED]> wrote:
> Wow... I had
> Do you know a better way to do this?
>
>if i < A_Len-1:
>
>a = A_List[i-1]
>b = A_List[i]
>c = A_List[i+1]
>
>else:
>
>a = A_List[i-1]
>b = A_List[i]
>c = A_List[0]
Hi Carlos,
> Wow... I had to click this e-mail just because I saw the first posts on the
> mentioned thread and could see it turning for the worst..
Hi everyone,
So let's try to squash this one now. There are more interesting problems
to solve. Or other flame wars to fight.
Let me see if we can do som
Hi again,
Thanks for your comments they are really appreciated.
Alan, yes you are right, there is no need to use S, A_Len works the same
way. Beginner mistake
The dictionary way seems to be way better than my idea, will give it a try.
And Danny, your CA is very nice.
Do you know a better way
On 07/11/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
> If anyone really cares which Python implementation is faster, the timeit
> module is your friend. Assertions like "would probably be faster" or
> "it's also quicker" don't hold much weight. In Python, if you want to
> know what is faster, you m
Wow... I had to click this e-mail just because I saw the first posts on the mentioned thread and could see it turning for the worst.. > I'm serious, if you think ^[0-9A-Za-z_.-]*$ is unclear and complex, go> away
> and relearn regales.>> Michael.If this is your method to helping people, you should
Greetings, all:
> -Original Message-
> Date: Mon, 6 Nov 2006 10:32:32 +
> From: Michael Sparks <[EMAIL PROTECTED]>
> Subject: Re: [Tutor] Amazing power of Regular Expressions...
> To: tutor@python.org
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="iso-8859-1"
>
"Michael Sparks" <[EMAIL PROTECTED]> wrote
> A regex compiles to a jump table, and executes as a statemachine.
Sometimes, but it depends on the implementation.
If someone uses a C++ compiler that uses the standard library
implememation of regex (like say the Microsoft Visual C++
version up till V
[Forwarding to Tutor; busy at the moment]
-- Forwarded message --
Date: Mon, 6 Nov 2006 18:41:54 +
From: Asrarahmed Kadri <[EMAIL PROTECTED]>
To: Danny Yoo <[EMAIL PROTECTED]>
Subject: Re: [Tutor] Please help to debug this function.. it takes a date and
num. of days and re
Tim Johnson wrote:
> I've been using python is 1.5* but haven't used `is` that much.
>
> 1)where do `is` and `==` yield the same results?
>
> 2)where do they not yield the same results?
is tests for object identity - 'a is b' is true if a is the same object
as b. There is no special method, no
"Carlos" <[EMAIL PROTECTED]> wrote
> Here is the code:
> Note: Right now maya is not needed to run the code.
>
> import time
>
> #This is the initial state. You can put as many integers as you wish
> A_List = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]
>
> A_Len = len(A_List)
> print 'A_List: ',A_Lis
I've been using python is 1.5* but haven't used `is` that much.
1)where do `is` and `==` yield the same results?
2)where do they not yield the same results?
3)is there a special method for `is'.
4)Pointers to docs are welcome.
thanks
tim
--
Tim Johnson <[EMAIL PROTECTED]>
http://www.al
"Asrarahmed Kadri" <[EMAIL PROTECTED]> wrote
> Please test it, comment on the logic .
I haven't tested it but here are some comments:
> import string
> import datetime
> import traceback
>
> def dateCheck(date1,num_days):
>flag = True
>startdate = None
>enddate = None
>
>if num_
> Eli Brosh schrieb:
>> Hello.
>> I am beginning to use python on windows.
>> how can I add a path to Python search-list where I can store my
>> python
>> scripts ?
As has been said there are two aspects.
If you want your scripts to execute as programs you need to
modify the PATH environment var
"Eli Brosh" <[EMAIL PROTECTED]> wrote
> I wish that my Python program will not be stored on a single file.
> how can I call one python script from another ?
As Kent says normally you don't call one script from another,
instead you write a set of functions (or classes) that you put in
one or mor
On Mon, 6 Nov 2006, Carlos wrote:
> This is my first script, I mean the first that I'm trying to do on my
> own. Its a very simple Cellular Automata thing, the idea is that the
> initial list A_List is rewritten based on some rules, in this case
> Wolfram's rule 30. You can modify the list le
Alan Gauld wrote:
> "Michael Sparks" <[EMAIL PROTECTED]> wrote
>>
>> That's equivalent to the regular expression:
>>* ^[0-9A-Za-z_.-]*$
>
> While using a dictionary is probably overkill, so is a regex.
> A simple string holding all characters and an 'in' test would probably
> be both easier to
On Mon, 6 Nov 2006, Asrarahmed Kadri wrote:
> I have written a function that takes a date and an integer representing
> the number of days.
>
> Please test it, comment on the logic .
Hi Asrarahmed,
You should be able to write your own tests too. You might want to look
at:
http://www.
On Mon, 6 Nov 2006, linda.s wrote:
> I use Python 2.4 IDLE to open a py code which import numeric.
> I have installed both scipy and numpy into my c:\python24. However, it
> was still reported as:
Hi Linda,
We need more details. What version of scipy and numpy did you install?
Where did you
Hello to all,
This is my first script, I mean the first that I'm trying to do on my
own. Its a very simple Cellular Automata thing, the idea is that the
initial list A_List is rewritten based on some rules, in this case
Wolfram's rule 30. You can modify the list length and its initial state,
y
Hi Folks,
I have written a function that takes a date and an integer representing the number of days.
Please test it, comment on the logic .
Here is the code:
""" The function takes two arguments, date and number of days. It checks for the right format and if the format is okay, it calc
Eli Brosh wrote:
> Hello.
> I wish that my Python program will not be stored on a single file.
> how can I call one python script from another ?
Put part of the script in a module that you import from another module.
Read more here:
http://docs.python.org/tut/node8.html
Kent
___
Eli Brosh schrieb:
> Hello.
> I am beginning to use python on windows.
> how can I add a path to Python search-list where I can store my python
> scripts ?
> On IDLE the command *browse path* lets me to see the existing path but
> not to edit it.
Hello,
you may be confusing* two different concept
Hi Eli,
You really dont have to edit the search path, because if all the files lie in the same-directory as the top-level file, then Python automatically includes that directory in its search path.
HTH,
Regards,
Asrarahmed
On 11/6/06, Eli Brosh <[EMAIL PROTECTED]> wrote:
Hello.
I am beginnin
I use Python 2.4 IDLE to open a py code which import numeric.
I have installed both scipy and numpy into my c:\python24. However, it
was still reported as:
from Numeric import *
ImportError: No module named Numeric
I got confused...
___
Tutor maillist
Hello.
I wish that my Python program will not be stored on
a single file.
how can I call one python script from another
?
Thanks
Eli___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hello.
I am beginning to use python on
windows.
how can I add a path to Python search-list
where I can store my python scripts ?
On IDLE the command browse path
lets me to see the existing path but not to edit it.
thanks
Eli___
Tutor maillist - Tut
On Monday 06 November 2006 01:08, Alan Gauld wrote:
> While using a dictionary is probably overkill, so is a regex.
No, in this case it's absolutely the right choice.
> A simple string holding all characters and an 'in' test would probably
> be both easier to read and faster.
I'm stunned you th
Noufal Ibrahim airtelbroadband.in> writes:
>
> Greetings everyone,
>I'm using the python standard logging package for a personal project
> of mine and have initialised it like so.
>
> logger = logging.getLogger("pydagogue")
> handler = logging.StreamHandler()
> handler.setFormatter(logging
51 matches
Mail list logo