Dear Pythonistas,
http://wiki.python.org/moin/PythonSpeed#Takeadvantageofinterpreteroptimizations%E2%80%8C%E2%80%8Bthis
is a link I found concerning optimizing the speed of python code. Is
anyone familiar with an article or wiki such as this that may cover the
changes that took place in Py3K? An
On Sat, Nov 26, 2011 at 12:49 AM, Andreas Perstinger
wrote:
> On 2011-11-25 13:40, lina wrote:
>>
>> On Fri, Nov 25, 2011 at 7:19 PM, Steven D'Aprano
>> wrote:
>>>
>>> f = open("some file")
>>> dehydrons = {}
>>> occurrence = {}
>>> pairs = {}
>>> for line in f.readlines():
>>> parts = l
On 26/11/11 00:07, Steven D'Aprano wrote:
Its usually better to paste long programs into a pastebin web site and
give us a link.
I'd just like to say that some of us disagree with this advice. Some
people (e.g. me) often read their where getting access to a browser is
less convenient.
Its tr
Hello Mic,
Mic wrote:
Its usually better to paste long programs into a pastebin web site and
give us a link.
This saves cluttering up people mail with long messages, and also the
pastebin rendering will usually be easier to read with syntax coloring
etc.
Please keep a attribution line when
Alan Gauld wrote:
On 24/11/11 16:20, Mic wrote:
and then try to put these parts togheter into a large program, I decided
to post my entire program.
Its usually better to paste long programs into a pastebin web site and
give us a link.
This saves cluttering up people mail with long messages,
On 25/11/11 21:14, Mic wrote:
Alright. Sorry if I should know this, but what is a pastebin web site
and how do I paste my program into a pastebin web site?
A web site that you can paste stuff and then provide a link(url) that
others can use to view it.
You can usually specify the code style
On 2011-11-25 14:46, stm atoc wrote:
Here is the new version of the program:
zvalues = [-200] # starting value
hvalues = [10] # starting value
increments = [1, 1, 1, 1, 1, 1, 1, 1]
for N in increments:
h = hvalues[-1] - N
hvalues.append(h)
z = zvalues[-1] + h
zv
On 25/11/11 17:11, Mic wrote:
for making a function that calls another function with a fixed
argument is
command = lambda button=button: button_clicked(button)
Alright! What is a fixed argument?
Its onre that is the same every time the function is called.
The lambda construct above is eq
Its usually better to paste long programs into a pastebin web site and
give us a link.
This saves cluttering up people mail with long messages, and also the
pastebin rendering will usually be easier to read with syntax coloring etc.
Alright. Sorry if I should know this, but what is a pastebin
On 25/11/11 12:42, nikunj.badja...@emc.com wrote:
I had Python27 and Python32 both installed togethar.
In Windows the PATH env variable, I had set Python27 exe and lib path.
But When I do
C:\> Python [PressEnter]
I get 2.7
But when I run
C:\> script.py [PressEnter]
The script is running wi
Mic wrote:
>
>> >from functools import partial
>
>>I use this kind of explicit import for a few names that I use frequently,
>>namely defaultdict, contextmanager, everything from itertools...
>>I think of these as my personal extended set of builtins ;)
>
>>As to the actual partial() function,
>from functools import partial
I use this kind of explicit import for a few names that I use frequently,
namely defaultdict, contextmanager, everything from itertools...
I think of these as my personal extended set of builtins ;)
As to the actual partial() function, you probably don't see
On 2011-11-25 13:40, lina wrote:
On Fri, Nov 25, 2011 at 7:19 PM, Steven D'Aprano wrote:
f = open("some file")
dehydrons = {}
occurrence = {}
pairs = {}
for line in f.readlines():
parts = line.split()
# convert to ints
parts = [int(s) for s in parts]
pair = frozenset(pa
On 25-Nov-11 04:42, nikunj.badja...@emc.com wrote:
Hi All,
Thanks for the info.
I had Python27 and Python32 both installed togethar.
In Windows the PATH env variable, I had set Python27 exe and lib path.
But When I do
C:\> Python [PressEnter]
I get 2.7
But when I run
C:\> script.py [PressE
Thank you so much for your reply. It was very helpful information and
I used it in order to improve the program
Here is the new version of the program:
zvalues = [-200] # starting value
hvalues = [10] # starting value
increments = [1, 1, 1, 1, 1, 1, 1, 1]
for N in increments:
h = hva
From: Steven D'Aprano wrote:
<>
Right, thanks.
<>
I want to include this info in my presentation because it shows how
data structures can be externalized.
<>
Still though, that is important.
< Sarcasm aside, what else could "import pickle" mean other than import
> the pickle module?>>
I wa
Hi All,
Thanks for the info.
I had Python27 and Python32 both installed togethar.
In Windows the PATH env variable, I had set Python27 exe and lib path.
But When I do
C:\> Python [PressEnter]
I get 2.7
But when I run
C:\> script.py [PressEnter]
The script is running with Python3.2 , thts weir
On Fri, Nov 25, 2011 at 7:19 PM, Steven D'Aprano wrote:
> lina wrote:
>>
>> On Fri, Nov 25, 2011 at 5:06 PM, Steven D'Aprano
>> wrote:
>
>>> pair = frozenset(('66', '69'))
>>> pairs[pair] = pairs.get(pair, 0) + value
>>
>> I don't get this "pairs.get" part.
>
> The "get" method does a look-up on
On 25/11/11 08:41, lina wrote:
pairs
{('66', '69'): 217, ('69', '66'): 75, ('64', '71'): 25}
such as here ('66', '69') and ('69', '66') is one key,
I wanna keep only one and add the value of those two keys, above is a
very simple example:
here is the (failed) code:
for k, v in pair
nikunj.badja...@emc.com wrote:
> Please look at the snippet below.
> When I am running my module its giving me following error.
> Using : Python 2.7, windows Env.
>
> {{{
> # User defined modules
> try:
> from scripts import precheck
> from scripts import input
> from scripts import v
Hi All,
Please look at the snippet below.
When I am running my module its giving me following error.
Using : Python 2.7, windows Env.
{{{
# User defined modules
try:
from scripts import precheck
from scripts import input
from scripts import validate
from scripts import logsetup
stm atoc wrote:
Hi there,
I am a new python user.
I have a question regarding do loop.
This is a simple program that I have written:
-
N=10
h=10.0 # [micrometer]
z=-200.0 # [micrometer]
You define N, h and z here, but later on you use them as loop variables.
So these t
lina wrote:
On Fri, Nov 25, 2011 at 5:06 PM, Steven D'Aprano wrote:
pair = frozenset(('66', '69'))
pairs[pair] = pairs.get(pair, 0) + value
I don't get this "pairs.get" part.
The "get" method does a look-up on a dict, but instead of failing if the
key is missing, it returns a default val
regarding to the last email:
what I am trying to do is seeing the variation of 'nu' over (changes of) 'z'.
My concern is how to arrange this!
Basically, I am not able to define the variation of nu by z ( 1 to
200). I am looking for a statement to show the changes of 'nu' for
each step of z (
for key, value in pairs.items():
if key[::-1] in pairs.keys() and pairs[key] != 0:
pairs[key] += pairs[key[::-1]]
pairs[key[::-1]]=0
for k, v in pairs.items():
if v != 0:
print(v,k)
Now very trivial, but works.
Sue,
I'm not familiar with FORTRAN, and since I'm not completely sure what you're
trying to accomplish please take this simply as an 'educated guess'.
My guess is that you're not getting the curve because Z is only defined to one
decimal location (1/10th) precision and probably needs higher p
#!/usr/bin/python3
dehydrons={}
pairs={}
#frozen set way pairs
fs_pairs={}
occurence={}
total=0
dictionary={}
candidate_dehydron={}
if __name__=="__main__":
with open("dehydron_refined_data_18.txt","r") as f:
for line in f.readlines():
parts=line.split()
#pai
On Fri, Nov 25, 2011 at 5:19 PM, Christian Witts wrote:
> On 2011/11/25 11:15 AM, lina wrote:
>
> On Fri, Nov 25, 2011 at 5:05 PM, Christian Witts
> wrote:
>
> On 2011/11/25 10:41 AM, lina wrote:
>
> pairs
>
> {('66', '69'): 217, ('69', '66'): 75, ('64', '71'): 25}
>
>
> such as here ('66', '69')
On Fri, Nov 25, 2011 at 5:06 PM, Steven D'Aprano wrote:
> lina wrote:
>
> pairs
>>
>> {('66', '69'): 217, ('69', '66'): 75, ('64', '71'): 25}
>>
>>
>> such as here ('66', '69') and ('69', '66') is one key,
>>
>> I wanna keep only one and add the value of those two keys, above is a
>> very
On 2011/11/25 11:15 AM, lina wrote:
On Fri, Nov 25, 2011 at 5:05 PM, Christian Witts wrote:
On 2011/11/25 10:41 AM, lina wrote:
pairs
{('66', '69'): 217, ('69', '66'): 75, ('64', '71'): 25}
such as here ('66', '69') and ('69', '66') is one key,
I wanna keep only one and add the value of th
Hi there,
I am a new python user.
I have a question regarding do loop.
This is a simple program that I have written:
-
N=10
h=10.0 # [micrometer]
z=-200.0 # [micrometer]
num = 0.05 #m**2/s
dz = 1.0
nuh=[]
tmax=3600
dt=20.
nu=[]height = arange(z*dz,0,dz)
outfile=open('nu.da
On Fri, Nov 25, 2011 at 5:05 PM, Christian Witts wrote:
> On 2011/11/25 10:41 AM, lina wrote:
>
> pairs
>
> {('66', '69'): 217, ('69', '66'): 75, ('64', '71'): 25}
>
>
> such as here ('66', '69') and ('69', '66') is one key,
>
> I wanna keep only one and add the value of those two keys, above is a
On 2011/11/25 10:41 AM, lina wrote:
pairs
{('66', '69'): 217, ('69', '66'): 75, ('64', '71'): 25}
such as here ('66', '69') and ('69', '66') is one key,
I wanna keep only one and add the value of those two keys, above is a
very simple example:
here is the (failed) code:
for k, v in
lina wrote:
pairs
{('66', '69'): 217, ('69', '66'): 75, ('64', '71'): 25}
such as here ('66', '69') and ('69', '66') is one key,
I wanna keep only one and add the value of those two keys, above is a
very simple example:
Which one do you want to keep?
If the order ('66', '69') is unimporta
>>> pairs
{('66', '69'): 217, ('69', '66'): 75, ('64', '71'): 25}
such as here ('66', '69') and ('69', '66') is one key,
I wanna keep only one and add the value of those two keys, above is a
very simple example:
here is the (failed) code:
for k, v in pairs.items():
if str(k
35 matches
Mail list logo