comp.lang.python - 25 new messages in 14 topics - digest
comp.lang.python
http://groups.google.com/group/comp.lang.python?hl=en
comp.lang.python@googlegroups.com
Today's topics:
* Conditional based on whether or not a module is being used - 2 messages, 1
author
http://groups.google.com/group/comp.lang.python/t/ee22c223fa73a429?hl=en
* pyserial script doesnt execute properly - 3 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/376d3eb2decbe3d5?hl=en
* Are there in Python some static web site generating tools like webgen, nanoc
or webby in Ruby ? - 4 messages, 4 authors
http://groups.google.com/group/comp.lang.python/t/307b95318504ebe4?hl=en
* remove element with ElementTree - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/b071ed88e051fb4b?hl=en
* related lists mean value - 4 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/b42119eb1a7ccd25?hl=en
* Newbie question: python versions differ per user? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/b09501ef6d3c1faf?hl=en
* Duplicate keys in dict? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/4372a73f1e51af35?hl=en
* Calculating very large exponents in python - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/f43b4d63b0630386?hl=en
* odd error - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/94000527479b5538?hl=en
* a newbie's question - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/320e51e1c2180149?hl=en
* imported var not being updated - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/332637a32c618bca?hl=en
* NoSQL Movement? - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/942e22a0145599b2?hl=en
* Hermes Watch wholesale (paypal payment) (www.globlepurchase.com) - 1
messages, 1 author
http://groups.google.com/group/comp.lang.python/t/16b116473698eddd?hl=en
* (updated) Choosing a collection of common modules/packages for a general
purpose reusable PY2EXE runtime - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/d4570c53d000cdbf?hl=en
==============================================================================
TOPIC: Conditional based on whether or not a module is being used
http://groups.google.com/group/comp.lang.python/t/ee22c223fa73a429?hl=en
==============================================================================
== 1 of 2 ==
Date: Tues, Mar 9 2010 12:17 am
From: Vinay Sajip
On Mar 7, 12:34 pm, Steve Holden <st...@holdenweb.com> wrote:
> My own impression of theloggingmodule, formed from trying to use its
> documentation in the past, is that it's somewhat unapproachable, and
> difficult to use for simple purposes.
>
> I am happy to say that now I see the current (3.1) documentation it has
> improved to the point where I would be happy to try using it again.
> Thanks for your long-term maintenance of this package.
>
Hi Steve,
Thanks for the positive feedback. The initial documentation for the
logging package, because it lives in the library section of the
overall documentation, was focused more on completeness of coverage
for reference usage, rather than a more tutorial-based approach.
Thanks to work by Doug Hellmann and others, the documentation has
grown, over time, more accessible to Python novices. It's still not
perfect, and I hope to be able to improve its clarity in the future,
by getting help where possible from people who are better at technical
writing than I am.
I'm reviewing the documentation at the moment, as it happens, and it
still seems hard to be able to put together a structure which is good
for everyone. A full treatment, it seems to me, would talk a little
about the detail of why things work as they do; but a lot of the time,
people are just interested in getting going with the package, and less
interested in the whys and wherefores. But for people trying to do
more than the basics, that deeper understanding is sometimes
necessary. The hard part is satisfying all audiences in one document!
Regards,
Vinay Sajip
== 2 of 2 ==
Date: Tues, Mar 9 2010 12:54 am
From: Vinay Sajip
On Mar 6, 11:13 pm, Pete Emerson <pemer...@gmail.com> wrote:
>
> 1) In debug mode, send what would have gone to syslog to STDOUT or
> STDERR
> 2) In non-debug mode, use /dev/log or localhost:514 depending on what
> is set
> 3) Allow for multiple levels ofloggingbeyond INFO, WARNING, CRIT ...
> essentially allow multiple levels of INFO depending on how much detail
> is desired. A high level of messaging when programs are running
> poorly is desired, but when programs are running smoothly, I don't
> need to send as much to syslog.
By "debug mode", do you mean the value of the __debug__ variable, or
something else (e.g. a flag in your application)?
You could certainly do something like (in your logging initialization
code):
if __debug__:
handler = logging.StreamHandler()
else:
#use domain socket, UDP, etc.
handler = logging.handlers.SocketHandler(...)
logger.addHandler(handler)
where logger is the root logger or some other high-level logger in
your application.
By the way, are you aware that accessing syslog via openlog etc. may
not thread-safe, at least in some environments? Search the Web for
"syslog openlog thread" for more info.
You can certainly add additional levels to logging (see addLevelName),
but I'm not sure that's what you really need. Generally, I find that
when there are problems to be debugged, I get more benefits from using
the logger hierarchy: I keep the level at logging.DEBUG but just log
different things to different loggers. Just as a fr'instance, if I
were logging the parsing of HTTP requests, I might use loggers named
'request', 'request.headers', 'request.headers.cookies',
'request.body', 'request.body.multipart' etc. When everything is
working well, I have the verbosity of these loggers turned low by e.g.
setting the level for the 'request' logger to WARNING or higher; when
I want to debug header processing in more detail I might set the level
of the 'request.headers' logger to DEBUG, which would output events
from request header processing (but not the body), or just turn up the
'request.headers.cookies' level to look in more detail at what's
happening during processing "Cookie:" headers.
Regards,
Vinay Sajip
==============================================================================
TOPIC: pyserial script doesnt execute properly
http://groups.google.com/group/comp.lang.python/t/376d3eb2decbe3d5?hl=en
==============================================================================
== 1 of 3 ==
Date: Tues, Mar 9 2010 12:39 am
From: kishore
hello there
Iam using python 2.5.4
pyserial 2.4
pywin32-214
on windows 7
i hav a small test script written to query a serial device (arduino)
and get back reply appropriately
////file: test.py
import serial
print 'hi'
ser=serial.Serial(port='\\.\COM2', baudrate=9600)
ser.close()
ser.open()
ser.write('1')
ser.readline()
ser.readline()
ser.close()
the device waits for '1' through its serial interface and print two
lines if it gets '1'
"Some Data found" and "Header received"
the script works on IDLE well when given one line at a time
but when given in command line as python test.py it prints hi and wait
forever
can anyone help?
thanks in advance
== 2 of 3 ==
Date: Tues, Mar 9 2010 1:19 am
From: News123
Hi,
kishore wrote:
> hello there
>
> Iam using python 2.5.4
> pyserial 2.4
> pywin32-214
>
> on windows 7
>
>
> i hav a small test script written to query a serial device (arduino)
> and get back reply appropriately
>
>
>
> ////file: test.py
>
> import serial
> print 'hi'
> ser=serial.Serial(port='\\.\COM2', baudrate=9600)
> ser.close()
> ser.open()
> ser.write('1')
> ser.readline()
> ser.readline()
> ser.close()
>
>
>
> the device waits for '1' through its serial interface and print two
> lines if it gets '1'
>
> "Some Data found" and "Header received"
>
>
> the script works on IDLE well when given one line at a time
>
> but when given in command line as python test.py it prints hi and wait
> forever
>
Unfortunately I don't remember exacty, but try following:
close IDLE and try then to start the script from the command line.
I remember having had a problem with idle, that it did not always close
the UART port
(especially, when an error (e.g. syntax) occured before the close statement)
bye
N
== 3 of 3 ==
Date: Tues, Mar 9 2010 7:01 am
From: kishore
On Mar 9, 2:19 pm, News123 <news...@free.fr> wrote:
> Hi,
>
>
>
> kishore wrote:
> > hello there
>
> > Iam using python 2.5.4
> > pyserial 2.4
> > pywin32-214
>
> > on windows 7
>
> > i hav a small test script written to query a serial device (arduino)
> > and get back reply appropriately
>
> > ////file: test.py
>
> > import serial
> > print 'hi'
> > ser=serial.Serial(port='\\.\COM2', baudrate=9600)
> > ser.close()
> > ser.open()
> > ser.write('1')
> > ser.readline()
> > ser.readline()
> > ser.close()
>
> > the device waits for '1' through its serial interface and print two
> > lines if it gets '1'
>
> > "Some Data found" and "Header received"
>
> > the script works on IDLE well when given one line at a time
>
> > but when given in command line as python test.py it prints hi and wait
> > forever
>
> Unfortunately I don't remember exacty, but try following:
>
> close IDLE and try then to start the script from the command line.
> I remember having had a problem with idle, that it did not always close
> the UART port
> (especially, when an error (e.g. syntax) occured before the close statement)
>
> bye
>
> N
Thanks for your response
i tried closing idle and the following code prints
port opened
Write failed
code:
import serial
import time
ser=serial.Serial(port='\\.\COM2', baudrate=9600)
if ser:
print 'port opened'
ser.open()
if ser.write('1'):
print 'Write success'
else:
print 'write failed'
time.sleep(1)
a=ser.readline()
time.sleep(1)
b=ser.readline()
print b
ser.close()
I believe this might be a serial port access error.
how to solve this?
Any suggestions?
==============================================================================
TOPIC: Are there in Python some static web site generating tools like webgen,
nanoc or webby in Ruby ?
http://groups.google.com/group/comp.lang.python/t/307b95318504ebe4?hl=en
==============================================================================
== 1 of 4 ==
Date: Tues, Mar 9 2010 12:57 am
From: KLEIN Stéphane
Hi,
Today, I've show this static web site generating tools write in ruby :
* http://webgen.rubyforge.org/index.html
* http://nanoc.stoneship.org/about/
* http://webby.rubyforge.org/tutorial/
I like this tools, I'm wonder if there are similar tools in Python ?
I know Sphinx, but this tools is oriented documentation.
Thanks for your information,
Stephane
--
Stéphane Klein <stephane@harobed.org>
Blog : http://harobed.org
Jabber : stephane.klein@jabber.fr
== 2 of 4 ==
Date: Tues, Mar 9 2010 2:21 am
From: dorzey
On Mar 9, 8:57 am, KLEIN Stéphane <steph...@harobed.org> wrote:
> Hi,
>
> Today, I've show this static web site generating tools write in ruby :
>
> *http://webgen.rubyforge.org/index.html
> *http://nanoc.stoneship.org/about/
> *http://webby.rubyforge.org/tutorial/
>
> I like this tools, I'm wonder if there are similar tools in Python ?
>
> I know Sphinx, but this tools is oriented documentation.
>
> Thanks for your information,
> Stephane
I'm only aware of Hyde (http://ringce.com/hyde)
Paul
== 3 of 4 ==
Date: Tues, Mar 9 2010 2:43 am
From: Javier Collado
> I'm only aware of Hyde (http://ringce.com/hyde)
There are also jekyll and cyrax:
http://github.com/mojombo/jekyll/
http://pypi.python.org/pypi/cyrax/0.1.5
I haven't tried any of them, but it looks like cyrax is in active
development and its design was inspired in both jekyll and hyde.
Best regards,
Javier
== 4 of 4 ==
Date: Tues, Mar 9 2010 3:28 am
From: garabik-news-2005-05@kassiopeia.juls.savba.sk
KLEIN Stéphane <stephane@harobed.org> wrote:
> Hi,
>
> Today, I've show this static web site generating tools write in ruby :
>
> * http://webgen.rubyforge.org/index.html
> * http://nanoc.stoneship.org/about/
> * http://webby.rubyforge.org/tutorial/
>
> I like this tools, I'm wonder if there are similar tools in Python ?
>
rst2web
--
-----------------------------------------------------------
| Radovan Garabík http://kassiopeia.juls.savba.sk/~garabik/ |
| __..--^^^--..__ garabik @ kassiopeia.juls.savba.sk |
-----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!
==============================================================================
TOPIC: remove element with ElementTree
http://groups.google.com/group/comp.lang.python/t/b071ed88e051fb4b?hl=en
==============================================================================
== 1 of 1 ==
Date: Tues, Mar 9 2010 1:34 am
From: Justin Ezequiel
On Mar 9, 11:35 am, tdan <df.tr...@gmail.com> wrote:
> I have been using ElementTree to write an app, and would like to
> simply remove an element.
> But in ElementTree, you must know both the parent and the child
> element to do this.
> There is no getparent() function, so I am stuck if I only have an
> element.
>
see http://effbot.org/zone/element.htm#accessing-parents
==============================================================================
TOPIC: related lists mean value
http://groups.google.com/group/comp.lang.python/t/b42119eb1a7ccd25?hl=en
==============================================================================
== 1 of 4 ==
Date: Tues, Mar 9 2010 2:30 am
From: Michael Rudolf
Am 08.03.2010 23:34, schrieb dimitri pater - serpia:
> Hi,
>
> I have two related lists:
> x = [1 ,2, 8, 5, 0, 7]
> y = ['a', 'a', 'b', 'c', 'c', 'c' ]
>
> what I need is a list representing the mean value of 'a', 'b' and 'c'
> while maintaining the number of items (len):
> w = [1.5, 1.5, 8, 4, 4, 4]
This kinda looks like you used the wrong data structure.
Maybe you should have used a dict, like:
{'a': [1, 2], 'c': [5, 0, 7], 'b': [8]} ?
> I have looked at iter(tools) and next(), but that did not help me. I'm
> a bit stuck here, so your help is appreciated!
As said, I'd have used a dict in the first place, so lets transform this
straight forward into one:
x = [1 ,2, 8, 5, 0, 7]
y = ['a', 'a', 'b', 'c', 'c', 'c' ]
# initialize dict
d={}
for idx in set(y):
d[idx]=[]
#collect values
for i, idx in enumerate(y):
d[idx].append(x[i])
print("d is now a dict of lists: %s" % d)
#calculate average
for key, values in d.items():
d[key]=sum(values)/len(values)
print("d is now a dict of averages: %s" % d)
# build the final list
w = [ d[key] for key in y ]
print("w is now the list of averages, corresponding with y:\n \
\n x: %s \n y: %s \n w: %s \n" % (x, y, w))
Output is:
d is now a dict of lists: {'a': [1, 2], 'c': [5, 0, 7], 'b': [8]}
d is now a dict of averages: {'a': 1.5, 'c': 4.0, 'b': 8.0}
w is now the list of averages, corresponding with y:
x: [1, 2, 8, 5, 0, 7]
y: ['a', 'a', 'b', 'c', 'c', 'c']
w: [1.5, 1.5, 8.0, 4.0, 4.0, 4.0]
Could have used a defaultdict to avoid dict initialisation, though.
Or write a custom class:
x = [1 ,2, 8, 5, 0, 7]
y = ['a', 'a', 'b', 'c', 'c', 'c' ]
class A:
def __init__(self):
self.store={}
def add(self, key, number):
if key in self.store:
self.store[key].append(number)
else:
self.store[key] = [number]
a=A()
# collect data
for idx, val in zip(y,x):
a.add(idx, val)
# build the final list:
w = [ sum(a.store[key])/len(a.store[key]) for key in y ]
print("w is now the list of averages, corresponding with y:\n \
\n x: %s \n y: %s \n w: %s \n" % (x, y, w))
Produces same output, of course.
Note that those solutions are both not very efficient, but who cares ;)
> thanks!
No Problem,
Michael
== 2 of 4 ==
Date: Tues, Mar 9 2010 3:11 am
From: Michael Rudolf
OK, I golfed it :D
Go ahead and kill me ;)
x = [1 ,2, 8, 5, 0, 7]
y = ['a', 'a', 'b', 'c', 'c', 'c' ]
def f(a,b,v={}):
try: v[a].append(b)
except: v[a]=[b]
def g(a): return sum(v[a])/len(v[a])
return g
w = [g(i) for g,i in [(f(i,v),i) for i,v in zip(y,x)]]
print("w is now the list of averages, corresponding with y:\n \
\n x: %s \n y: %s \n w: %s \n" % (x, y, w))
Output:
w is now the list of averages, corresponding with y:
x: [1, 2, 8, 5, 0, 7]
y: ['a', 'a', 'b', 'c', 'c', 'c']
w: [1.5, 1.5, 8.0, 4.0, 4.0, 4.0]
Regards,
Michael
== 3 of 4 ==
Date: Tues, Mar 9 2010 4:02 am
From: Peter Otten <__peter__@web.de>
Michael Rudolf wrote:
> OK, I golfed it :D
> Go ahead and kill me ;)
>
> x = [1 ,2, 8, 5, 0, 7]
> y = ['a', 'a', 'b', 'c', 'c', 'c' ]
>
> def f(a,b,v={}):
> try: v[a].append(b)
> except: v[a]=[b]
> def g(a): return sum(v[a])/len(v[a])
> return g
> w = [g(i) for g,i in [(f(i,v),i) for i,v in zip(y,x)]]
>
> print("w is now the list of averages, corresponding with y:\n \
> \n x: %s \n y: %s \n w: %s \n" % (x, y, w))
>
> Output:
> w is now the list of averages, corresponding with y:
>
> x: [1, 2, 8, 5, 0, 7]
> y: ['a', 'a', 'b', 'c', 'c', 'c']
> w: [1.5, 1.5, 8.0, 4.0, 4.0, 4.0]
>>> [sum(a for a,b in zip(x,y) if b==c)/y.count(c)for c in y]
[1.5, 1.5, 8.0, 4.0, 4.0, 4.0]
Peter
== 4 of 4 ==
Date: Tues, Mar 9 2010 7:00 am
From: Michael Rudolf
Am 09.03.2010 13:02, schrieb Peter Otten:
>>>> [sum(a for a,b in zip(x,y) if b==c)/y.count(c)for c in y]
> [1.5, 1.5, 8.0, 4.0, 4.0, 4.0]
> Peter
... pwned.
Should be the fastest and shortest way to do it.
I tried to do something like this, but my brain hurt while trying to
visualize list comprehension evaluation orders ;)
Regards,
Michael
==============================================================================
TOPIC: Newbie question: python versions differ per user?
http://groups.google.com/group/comp.lang.python/t/b09501ef6d3c1faf?hl=en
==============================================================================
== 1 of 1 ==
Date: Tues, Mar 9 2010 3:23 am
From: BobAalsma
On Mar 8, 8:15 pm, BobAalsma <bob.aal...@aalsmacons.nl> wrote:
> I'm on Mac OS X 10.5.8 and downloaded 2.6.4 Mac Installer Disk Image
> as/in(?) the sys admin user. For this user Pyhton 2.6.4 is now the
> current version.
> I want to use Python outside the sys asdmin user. However, all other
> users still use Python 2.5.1 (Apple delivered).
>
> The sys admin user looks in /Library/Frameworks/Python.framework/
> Versions/2.6/lib/...
> The other users look in /System/Library/Frameworks/
> Python.framework/Version/2.5/lib/...
>
> I could not find any questions on this matter, so am I the only one?
> Did I do something wrong?
> I assumed the paths for all users would be modified - too easy?
OK, sorry, found out.
==============================================================================
TOPIC: Duplicate keys in dict?
http://groups.google.com/group/comp.lang.python/t/4372a73f1e51af35?hl=en
==============================================================================
== 1 of 1 ==
Date: Tues, Mar 9 2010 4:27 am
From: Yinon Ehrlich
On Mar 7, 6:23 pm, vsoler <vicente.so...@gmail.com> wrote:
> Hello,
>
> My code snippet reads data from excel ranges. First row and first
> column are column headers and row headers respectively. After reding
> the range I build a dict.
>
> What is the best approach for this problem? Can anybody help?
Have you tried xlread ? (http://www.python-excel.org/)
Best,
-- Yinon
==============================================================================
TOPIC: Calculating very large exponents in python
http://groups.google.com/group/comp.lang.python/t/f43b4d63b0630386?hl=en
==============================================================================
== 1 of 1 ==
Date: Tues, Mar 9 2010 5:54 am
From: casevh
On Mar 8, 10:39 pm, casevh <cas...@gmail.com> wrote:
> [also replying to Geremy since the OP's message doesn't appear...]
>
> On Mar 8, 11:05 am, geremy condra <debat...@gmail.com> wrote:
>
>
>
>
>
> > On Mon, Mar 8, 2010 at 2:15 AM, Fahad Ahmad <miracles...@hotmail.com> wrote:
> > > Thanks Geremy,
>
> > > That has been an absolute bump........... GOD i cant sit on my chair, it has
> > > worked even on 512 bit number and with no time..........
> > > superb i would say.
>
> > > lastly, i am using the code below to calculate Largest Prime factor of a
> > > number:
>
> > > print
> > > ('''==============================================================================='''
> > > ''' CALCULATE HIGHEST PRIME
> > > FACTOR '''
>
> > > '''===============================================================================''')
>
> > > #!/usr/bin/env python
> > > def highest_prime_factor(n):
> > > if isprime(n):
> > > return n
> > > for x in xrange(2,n ** 0.5 + 1):
> > > if not n % x:
> > > return highest_prime_factor(n/x)
> > > def isprime(n):
> > > for x in xrange(2,n ** 0.5 + 1):
> > > if not n % x:
> > > return False
> > > return True
> > > if __name__ == "__main__":
> > > import time
> > > start = time.time()
> > > print highest_prime_factor(1238162376372637826)
> > > print time.time() - start
>
> > > the code works with a bit of delay on the number : "1238162376372637826" but
> > > extending it to
> > > (109026109913291424366305511581086089650628117463925776754560048454991130443047109026109913291424366305511581086089650628117463925776754560048454991130443047)
> > > makes python go crazy. Is there any way just like above, i can have it
> > > calculated it in no time.
>
> > > thanks for the support.
>
> > If you're just looking for the largest prime factor I would suggest using
> > a fermat factorization attack. In the example you gave, it returns
> > nearly immediately.
>
> > Geremy Condra- Hide quoted text -
>
> > - Show quoted text -
>
> For a Python-based solution, you might want to look at pyecm (http://
> sourceforge.net/projects/pyecm/)
>
> On a system with gmpy installed also, pyecm found the following
> factors:
>
> 101, 521, 3121, 9901, 36479, 300623, 53397071018461,
> 1900381976777332243781
>
> There still is a 98 digit unfactored composite:
>
> 60252507174568243758911151187828438446814447653986842279796823262165159406500174226172705680274911
>
> Factoring this remaining composite using ECM may not be practical.
>
> casevh- Hide quoted text -
>
> - Show quoted text -
After a few hours, the remaining factors are
6060517860310398033985611921721
and
9941808367425935774306988776021629111399536914790551022447994642391
casevh
==============================================================================
TOPIC: odd error
http://groups.google.com/group/comp.lang.python/t/94000527479b5538?hl=en
==============================================================================
== 1 of 1 ==
Date: Tues, Mar 9 2010 5:55 am
From: Alex Hall
Hi all,
In the same program I wrote about yesterday, I have a dictionary of
keystrokes which are captured. I just tried adding a new one, bringing
the total to 11. Here are entries 10 and 11; 10 has been working fine
for months.
10 : (57, win32con.MOD_CONTROL),
11 : (99, win32con.MOD_CONTROL | win32con.MOD_SHIFT)
Now, though, when I press ctrl-shift-c (keystroke 11), nothing
happens. Pressing any other keystroke after that will crash the
program with some sort of Python internal com server exception that I
have never seen before. When set to a keystroke I already use, such as
#10, the function called by #11 works just fine. Does anyone see a
problem with the above syntax? The trouble almost definitely has to be
there; again, using an already-working keystroke instead of making a
new one works perfectly, it is just when I add this new one that
things break.
--
Have a great day,
Alex (msg sent from GMail website)
mehgcap@gmail.com; http://www.facebook.com/mehgcap
==============================================================================
TOPIC: a newbie's question
http://groups.google.com/group/comp.lang.python/t/320e51e1c2180149?hl=en
==============================================================================
== 1 of 1 ==
Date: Tues, Mar 9 2010 6:00 am
From: Simon Brunning
On 9 March 2010 13:51, Lan Qing <efiish@gmail.com> wrote:
> Hi all,
> I'm a newbie of python programming language.
Welcome!
> I have used c/c++ for 5
> years, and one year experience in Lua programming language. Can any one give
> me some advice on learning python. Think you for any help!!
You'll find some useful starting points here -
<http://wiki.python.org/moin/BeginnersGuide/Programmers>.
--
Cheers,
Simon B.
==============================================================================
TOPIC: imported var not being updated
http://groups.google.com/group/comp.lang.python/t/332637a32c618bca?hl=en
==============================================================================
== 1 of 2 ==
Date: Tues, Mar 9 2010 6:18 am
From: John Posner
On 3/8/2010 11:55 PM, Gary Herron wrote:
<snip>
>
> The form of import you are using
> from helpers import mostRecent
> makes a *new* binding to the value in the module that's doing the
> import.
<snip>
> What you can do, is not make a separate binding, but reach into the
> helpers module to get the value there. Like this:
>
> import helpers
> print helpers.mostRecent
>
Gary, are you asserting that in these separate situations:
one.py:
from helpers import mostRecent
x = mostRecent
two.py:
import helpers
x = helpers.mostRecent
... the name "x" will be bound to different objects?
Tx,
John
== 2 of 2 ==
Date: Tues, Mar 9 2010 6:48 am
From: Bruno Desthuilliers
John Posner a écrit :
> On 3/8/2010 11:55 PM, Gary Herron wrote:
> <snip>
>>
>> The form of import you are using
>> from helpers import mostRecent
>> makes a *new* binding to the value in the module that's doing the
>> import.
>
> <snip>
>
>> What you can do, is not make a separate binding, but reach into the
>> helpers module to get the value there. Like this:
>>
>> import helpers
>> print helpers.mostRecent
>>
>
> Gary, are you asserting that in these separate situations:
>
> one.py:
>
> from helpers import mostRecent
> x = mostRecent
>
> two.py:
>
> import helpers
> x = helpers.mostRecent
>
>
> ... the name "x" will be bound to different objects?
Nope. What he's saying is that one.x and two.x are two different names -
each living in it's own namespace - that happen to be bound to the same
object. Now rebiding one.x to a different object will _of course_ have
no impact on the object two.x is bound to.
That's exactly the same as:
one = dict()
two = dict()
# one['x'] and two['x'] refer to the same object
one['x'] = two['x'] = ["foo", "bar"]
print one['x'], two['x'], one['x'] is two['x']
# mutating one['x'], visible in two['x']
# (of course since it's the same object)
one['x'].append("baaz")
print one['x'], two['x'], one['x'] is two['x']
# now rebind one['x']
one['x'] = 42
# obvious result: one['x'] and two['x'] now refer to 2 different objects
print one['x'], two['x'], one['x'] is two['x']
If in doubt about namespaces, think dicts. Namespaces are like dicts -
and are often nothing else that a plain old dict FWIW.
HTH
==============================================================================
TOPIC: NoSQL Movement?
http://groups.google.com/group/comp.lang.python/t/942e22a0145599b2?hl=en
==============================================================================
== 1 of 2 ==
Date: Tues, Mar 9 2010 6:24 am
From: Xah Lee
On Mar 8, 11:14 am, Duncan Booth <duncan.bo...@invalid.invalid> wrote:
> Xah Lee <xah...@gmail.com> wrote:
> > For example, consider, if you are within world's top 100th user of
> > database in terms of database size, such as Google, then it may be
> > that the off-the-shelf tools may be limiting. But how many users
> > really have such massive size of data?
>
> You've totally missed the point. It isn't the size of the data you have
> today that matters, it's the size of data you could have in several years'
> time.
so, you saying, in several years, we'd all become the world's top 100
database users in terms of size, like Google?
Xah
∑ http://xahlee.org/
☄
== 2 of 2 ==
Date: Tues, Mar 9 2010 7:02 am
From: Bruno Desthuilliers
mk a écrit :
> Bruno Desthuilliers wrote:
>>> Well, Zope is backed by an object database rather than a relational one.
>>
>> And it ended up being a *major* PITA on all Zope projects I've worked
>> on...
>
> Care to write a few sentences on nature of problems with zodb? I was
> flirting with the thought of using it on some project.
Would require more than a few sentences. But mostly, it's about the very
nature of the Zodb : it's a giant graph of Python objects.
So :
1/ your "data" are _very_ tightly dependant on the language and
applicative code
2/ you have to hand-write each and every graph traversal
3/ accessing a given object usually loads quite a few others in memory
I once thought the Zodb was cool.
==============================================================================
TOPIC: Hermes Watch wholesale (paypal payment) (www.globlepurchase.com)
http://groups.google.com/group/comp.lang.python/t/16b116473698eddd?hl=en
==============================================================================
== 1 of 1 ==
Date: Tues, Mar 9 2010 6:26 am
From: brandmarket
Ebel Watch wholesale (paypal payment) (www.globlepurchase.com)
Bape Watch wholesale (paypal payment) (www.globlepurchase.com)
Bell&Ross Watch wholesale (paypal payment) (www.globlepurchase.com)
Breit Ling Watch wholesale (paypal payment) (www.globlepurchase.com)
Burberry Watch wholesale (paypal payment) (www.globlepurchase.com)
Cartier Watch wholesale (paypal payment) (www.globlepurchase.com)
Chopard Watch wholesale (paypal payment) (www.globlepurchase.com)
D&G Watch wholesale (paypal payment) (www.globlepurchase.com)
Givenchy Watch wholesale (paypal payment) (www.globlepurchase.com)
Jacob&Co Watch wholesale (paypal payment) (www.globlepurchase.com)
Kappa Watch wholesale (paypal payment) (www.globlepurchase.com)
Prada Watch wholesale (paypal payment) (www.globlepurchase.com)
Tissot Watch wholesale (paypal payment) (www.globlepurchase.com)
Titoni Watch wholesale (paypal payment) (www.globlepurchase.com)
U-BOAT Watch wholesale (paypal payment) (www.globlepurchase.com)
Zenith Watch wholesale (paypal payment) (www.globlepurchase.com)
A.Lange&Sohne Watch wholesale (paypal payment)
(www.globlepurchase.com)
Audemars Piguet Watch wholesale (paypal payment)
(www.globlepurchase.com)
Baume&Mercier Watch wholesale (paypal payment)
(www.globlepurchase.com)
Blancpain Watch wholesale (paypal payment) (www.globlepurchase.com)
Breguet Watch wholesale (paypal payment) (www.globlepurchase.com)
BRM Watch wholesale (paypal payment) (www.globlepurchase.com)
Bvlgari Watch wholesale (paypal payment) (www.globlepurchase.com)
Chanel Watch wholesale (paypal payment) (www.globlepurchase.com)
Concord Watch wholesale (paypal payment) (www.globlepurchase.com)
Corum Watch wholesale (paypal payment) (www.globlepurchase.com)
Dewitt Watch wholesale (paypal payment) (www.globlepurchase.com)
Ferrari Watch wholesale (paypal payment) (www.globlepurchase.com)
Franck Muller Watch wholesale (paypal payment)
(www.globlepurchase.com)
Girard Perregaux Watch (paypal payment) (www.globlepurchase.com)
Glashutte Watch (paypal payment) (www.globlepurchase.com)
Graham Watch wholesale (paypal payment) (www.globlepurchase.com)
GUCCI Watch wholesale (paypal payment) (www.globlepurchase.com)
GUESS Watch wholesale (paypal payment) (www.globlepurchase.com)
Hamilton Watch wholesale (paypal payment) (www.globlepurchase.com)
Hermes Watch wholesale (paypal payment) (www.globlepurchase.com)
Hublot Watch wholesale (paypal payment) www.globlepurchase.com)
IWC Watch wholesale (paypal payment) (www.globlepurchase.com)
Jaeger Le Coultre Watch wholesale (paypal payment)
(www.globlepurchase.com)
Longines Watch wholesale (paypal payment) (www.globlepurchase.com)
LV Watch wholesale (paypal payment) (www.globlepurchase.com)
Montblanc Watch wholesale (paypal payment) (www.globlepurchase.com)
Movado Watch wholesale (paypal payment) (www.globlepurchase.com)
Omega Watch wholesale (paypal payment) (www.globlepurchase.com)
Oris Watch wholesale (paypal payment) (www.globlepurchase.com)
Paket Philippe Watch wholesale (paypal payment)
(www.globlepurchase.com)
Panerai Watch wholesale (paypal payment) (www.globlepurchase.com)
Parmigiani Fleurier Watch wholesale (paypal payment)
(www.globlepurchase.com)
Piaget Watch wholesale (paypal payment) (www.globlepurchase.com)
Porsche Design Watch wholesale (paypal payment)
(www.globlepurchase.com)
Rolex Watch wholesale (paypal payment) (www.globlepurchase.com)
Romain Jerome Titanic-Dna Watch wholesale (paypal payment)
(www.globlepurchase.com)
Tag Heuer Watch wholesale (paypal payment) (www.globlepurchase.com)
Tudor Watch wholesale (paypal payment) (www.globlepurchase.com)
Vach.Constantine Watch wholesale (paypal payment)
(www.globlepurchase.com)
Armani Watch wholesale (paypal payment) (www.globlepurchase.com)
RADO Watch wholesale (paypal payment) (www.globlepurchase.com)
Ebel Watch wholesale (paypal payment) (www.globlepurchase.com)
Bape Watch wholesale (paypal payment) (www.globlepurchase.com)
Bell&Ross Watch wholesale (paypal payment) (www.globlepurchase.com)
Breit Ling Watch wholesale (paypal payment) (www.globlepurchase.com)
Burberry Watch wholesale (paypal payment) (www.globlepurchase.com)
Cartier Watch wholesale (paypal payment) (www.globlepurchase.com)
Chopard Watch wholesale (paypal payment) (www.globlepurchase.com)
D&G Watch wholesale (paypal payment) (www.globlepurchase.com)
Givenchy Watch wholesale (paypal payment) (www.globlepurchase.com)
Jacob&Co Watch wholesale (paypal payment) (www.globlepurchase.com)
Kappa Watch wholesale (paypal payment) (www.globlepurchase.com)
Prada Watch wholesale (paypal payment) (www.globlepurchase.com)
Tissot Watch wholesale (paypal payment) (www.globlepurchase.com)
Titoni Watch wholesale (paypal payment) (www.globlepurchase.com)
U-BOAT Watch wholesale (paypal payment) (www.globlepurchase.com)
Zenith Watch wholesale (paypal payment) (www.globlepurchase.com)
A.Lange&Sohne Watch wholesale (paypal payment)
(www.globlepurchase.com)
Audemars Piguet Watch wholesale (paypal payment)
(www.globlepurchase.com)
Baume&Mercier Watch wholesale (paypal payment)
(www.globlepurchase.com)
Blancpain Watch wholesale (paypal payment) (www.globlepurchase.com)
Breguet Watch wholesale (paypal payment) (www.globlepurchase.com)
BRM Watch wholesale (paypal payment) (www.globlepurchase.com)
Bvlgari Watch wholesale (paypal payment) (www.globlepurchase.com)
Chanel Watch wholesale (paypal payment) (www.globlepurchase.com)
Concord Watch wholesale (paypal payment) (www.globlepurchase.com)
Corum Watch wholesale (paypal payment) (www.globlepurchase.com)
Dewitt Watch wholesale (paypal payment) (www.globlepurchase.com)
Ferrari Watch wholesale (paypal payment) (www.globlepurchase.com)
Franck Muller Watch wholesale (paypal payment)
(www.globlepurchase.com)
Girard Perregaux Watch (paypal payment) (www.globlepurchase.com)
Glashutte Watch (paypal payment) (www.globlepurchase.com)
Graham Watch wholesale (paypal payment) (www.globlepurchase.com)
GUCCI Watch wholesale (paypal payment) (www.globlepurchase.com)
GUESS Watch wholesale (paypal payment) (www.globlepurchase.com)
Hamilton Watch wholesale (paypal payment) (www.globlepurchase.com)
Hermes Watch wholesale (paypal payment) (www.globlepurchase.com)
Hublot Watch wholesale (paypal payment) www.globlepurchase.com)
IWC Watch wholesale (paypal payment) (www.globlepurchase.com)
Jaeger Le Coultre Watch wholesale (paypal payment)
(www.globlepurchase.com)
Longines Watch wholesale (paypal payment) (www.globlepurchase.com)
LV Watch wholesale (paypal payment) (www.globlepurchase.com)
Montblanc Watch wholesale (paypal payment) (www.globlepurchase.com)
Movado Watch wholesale (paypal payment) (www.globlepurchase.com)
Omega Watch wholesale (paypal payment) (www.globlepurchase.com)
Oris Watch wholesale (paypal payment) (www.globlepurchase.com)
Paket Philippe Watch wholesale (paypal payment)
(www.globlepurchase.com)
Panerai Watch wholesale (paypal payment) (www.globlepurchase.com)
Parmigiani Fleurier Watch wholesale (paypal payment)
(www.globlepurchase.com)
Piaget Watch wholesale (paypal payment) (www.globlepurchase.com)
Porsche Design Watch wholesale (paypal payment)
(www.globlepurchase.com)
Rolex Watch wholesale (paypal payment) (www.globlepurchase.com)
Romain Jerome Titanic-Dna Watch wholesale (paypal payment)
(www.globlepurchase.com)
Tag Heuer Watch wholesale (paypal payment) (www.globlepurchase.com)
Tudor Watch wholesale (paypal payment) (www.globlepurchase.com)
Vach.Constantine Watch wholesale (paypal payment)
(www.globlepurchase.com)
Armani Watch wholesale (paypal payment) (www.globlepurchase.com)
RADO Watch wholesale (paypal payment) (www.globlepurchase.com)
==============================================================================
TOPIC: (updated) Choosing a collection of common modules/packages for a
general purpose reusable PY2EXE runtime
http://groups.google.com/group/comp.lang.python/t/d4570c53d000cdbf?hl=en
==============================================================================
== 1 of 1 ==
Date: Tues, Mar 9 2010 6:27 am
From: python@bdurham.com
We've decided to build a re-usable *general purpose* PY2EXE
"runtime" that can be shared by a number of scripts vs.
distributing a monolithic EXE for each of our scripts.
A list of the Python 2.6.4 compatible modules/packages we decided
to include (and exclude) in our "runtime" follows my signature.
Any suggestions on additions or deletions appreciated.
Thanks,
Malcolm
3rd party modules/packages:
- jsonpickle
- wmi <--- forgot this one in my original post
- win32api
- winshell
We've included all modules from the Python standard library
EXCEPT the following:
http://www.python.org/doc/2.6.4/modindex.html
- aifc
- audioop
- bsddb
- Carbon
- dbhash
- distutils
- dumbdbm
- netrc
- plistlib
- robotparser
- ScrolledText
- shelve
- sunau
- tabnanny
- Tix
- Tkinter
- turtle
- whichdb
==============================================================================
You received this message because you are subscribed to the Google Groups "comp.lang.python"
group.
To post to this group, visit http://groups.google.com/group/comp.lang.python?hl=en
To unsubscribe from this group, send email to comp.lang.python+unsubscribe@googlegroups.com
To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.python/subscribe?hl=en
To report abuse, send email explaining the problem to abuse@googlegroups.com
==============================================================================
Google Groups: http://groups.google.com/?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home