Michele Simionato wrote:
but I am asking a question instead: should I add this feature to the
next release of the decorator module?
I think it would be an excellent addition to your module.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Andrew Berg wrote:
On 5/24/2012 8:59 PM, Dave Angel wrote:
so I fixed that, and got
inconsistent use of tabs and spaces in indentation
because you mistakenly used tabs for indentation.
Not to start another tabs-vs.-spaces discussion, but tabs are perfectly
legal indentation in Python. Tha
I'm getting towards an actual non-beta release, which means even more
tests, polishings, cleaning up of various things, and actual
documentation. :)
However, I am wondering about my current record API:
Currently, one does things like:
record.scatter_fields()
or
record.has_been_deleted
MRAB wrote:
On 01/06/2012 18:50, Ethan Furman wrote:
I'm getting towards an actual non-beta release, which means even more
tests, polishings, cleaning up of various things, and actual
documentation. :)
However, I am wondering about my current record API:
Currently, one does things
Tim Chase wrote:
On 06/01/12 19:05, Jon Clements wrote:
On 01/06/12 23:13, Tim Chase wrote:
dbf.scatter_fields
*always* trump and refer to the method.
I did think about *trumping* one way or the other, but both *ugh*.
For the record, it sounded like the OP wanted to be able to use the
do
Dan Stromberg wrote:
Did the import semantics change in cpython 3.3a4?
I used to be able to import treap.py even though I had a treap directory
in my cwd. With 3.3a4, I have to rename the treap directory to see
treap.py.
Check out PEP 420 -- Implicit Namespace Packages
[http://www.python.
Eric V. Smith wrote:
On 6/8/2012 6:41 PM, Ethan Furman wrote:
Dan Stromberg wrote:
On Fri, Jun 8, 2012 at 3:16 PM, Ethan Furman wrote:
Dan Stromberg wrote:
Did the import semantics change in cpython 3.3a4?
I used to be able to import treap.py even though I had a treap
directory in my cwd
Julio Sergio wrote:
Jose H. Martinez gmail.com> writes:
You should define the function first and then call it.
def something(i): return i
a = something(5)
If you want a reference to the function somewhere else you can do this:
I know that. That was what I meant by "changing the
Julio Sergio wrote:
Ethan Furman stoneleaf.us> writes:
No. The reply from MRAB explains this.
~Ethan~
Thanks, you're right!
I was confusing statemens with declarations.
Yeah, it took me a while to get that straight as well.
~Ethan~
--
http://mail.python.org/mailman/listinf
Ben Finney wrote:
Curt writes:
On 2012-06-16, Christian Heimes wrote:
Actually it's "van Rossum, Guido", not "Rossum, Guido van". The
"van" is part of the family name, not a middle name. It's like "da
Vinci, Leonardo" or "von Sydow, Max". On one occasion Guido
complained that Americans alway
Nick Buchholz wrote:
Hi all,
I've been wandering through the DOCs for an hour and haven't found a
solution to this
I'm just starting to convert from 2.5 to 3.2 and I have a problem. I have a
code that looks like this.
I just ran the posted code in both 2.5 and 3.2 and experienced no
prob
Nick Buchholz wrote:
First thanks to all who replied. FYI the classes in the file have been working in various
environments since I wrote them in python1.3 and updated them to python 2.x in 2005.
I think I solved the problem, well not solved in that I don't know why the
technique I used failed
Chris Torek wrote:
On 2011-06-03, ru...@yahoo.com wrote:
[prefers]
re.split ('[ ,]', source)
This is probably not what you want in dealing with
human-created text:
>>> re.split('[ ,]', 'foo bar, spam,maps')
['foo', '', 'bar', '', 'spam', 'maps']
I think you've got a typo in th
Steven D'Aprano wrote:
NANs are not necessarily errors, they're hardly silent, and if you don't
want NANs, the standard mandates that there be a way to turn them off.
So how does one turn them off in standard Python?
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
On Fri, 03 Jun 2011 23:04:38 -0700, Ethan Furman wrote:
Steven D'Aprano wrote:
NANs are not necessarily errors, they're hardly silent, and if you
don't want NANs, the standard mandates that there be a way to turn them
off.
So how does one turn
Steven D'Aprano wrote:
On Fri, 03 Jun 2011 13:09:43 -0700, Raymond Hettinger wrote:
On Jun 3, 10:55 am, Billy Mays wrote:
I'm trying to shorten a one-liner I have for calculating the standard
deviation of a list of numbers. I have something so far, but I was
wondering if it could be made any
Ian Kelly wrote:
On Mon, Jun 6, 2011 at 10:08 AM, Neil Cerutti wrote:
import re
print("re solution")
with open("data.txt") as f:
for line in f:
fixed = re.sub(r"(TABLE='\S+)\s+'", r"\1'", line)
print(fixed, end='')
print("non-re solution")
with open("data.txt") as f:
for l
Steve Crook wrote:
On Mon, 6 Jun 2011 12:15:35 -0400, Jabba Laci wrote in
Message-Id: :
solo = 'Han Solo'
jabba = 'Jabba the Hutt'
print "{solo} was captured by {jabba}".format(solo=solo, jabba=jabba)
# Han Solo was captured by Jabba the Hutt
How about:-
print "%s was captured by %s" % (solo
Prasad, Ramit wrote:
print "{} was captured by {}".format(solo, jabba)
Is this Python2.7 specific?
Python 2.6.x :
print "{} was captured by {}".format('t1', 't2')
ValueError: zero length field name in format
Apparently it is 2.7 and greater -- my apologies for not specifying that.
~Ethan~
Carl Banks wrote:
On Monday, June 6, 2011 9:03:55 PM UTC-7, Gabriel Genellina wrote:
En Sat, 28 May 2011 14:05:16 -0300, Steven D'Aprano
escribi�:
On Sat, 28 May 2011 09:39:08 -0700, John Nagle wrote:
Python allows patching code while the code is executing.
Can you give an example of w
Friedrich Clausen wrote:
Hello All,
I want to print some integers in a zero padded fashion, eg. :
print("Testing %04i" % 1)
Testing 0001
but the padding needs to be dynamic eg. sometimes %05i, %02i or some
other padding amount. But I can't insert a variable into the format
specification to a
Cathy James wrote:
I am almost there, but I need a little help:
I would like to
a) print my dogs in the format index. name: breed as follows:
0. Mimi:Poodle
1.Sunny: Beagle
2. Bunny: German Shepard
I am getting
(0, ('Mimi', 'Poodle')) . Mimi : Poodle instead-what have I done wrong?
b) I wou
Larry Hudson wrote:
On 06/08/2011 01:09 PM, Cathy James wrote:
Dog Breed: "))
while not dogs:
print("Goodbye!!")
sys.exit()
else:
else does not belong with while.
else works just fine with while; it is the path taken when the while is
exhausted, but not broken ou
Ethan Furman wrote:
Larry Hudson wrote:
On 06/08/2011 01:09 PM, Cathy James wrote:
Dog Breed: "))
while not dogs:
print("Goodbye!!")
sys.exit()
else:
else does not belong with while.
else works just fine with while; it is the path taken wh
Eric Snow wrote:
p.s. Am I missing something or can you really not change the docstring
of a class? I was thinking about the idea of inheriting class
docstrings too.
8<
"""module level docstring"""
def func():
"""function level docst
Chris Angelico wrote:
On Tue, Jun 14, 2011 at 4:20 AM, geremy condra wrote:
I know that, but I mean what were you talking about before if you
weren't talking about cmp?
Not sure what you mean.
I suspect Geremy is referring to your "most of the batteries you're used
to, included" comment -
Steven D'Aprano wrote:
On Mon, 13 Jun 2011 00:21:53 -0700, Elena wrote:
On 13 Giu, 06:30, Tim Roberts wrote:
Studies have shown that even a
strictly alphabetical layout works perfectly well, once the typist is
acclimated.
Once the user is acclimated to move her hands much more (about 40% mo
Patty wrote:
So I am wondering if you learned this
in Computer Science or Computer Engineering?, on the job?
I learned it on this list. :)
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
MRAB wrote:
On 14/06/2011 23:28, Eric Snow wrote:
I would rather have something like this:
"""some module"""
import sys
import importlib
import util # some utility module somewhere...
if __name__ == "__main__":
name = util.get_module_name(sys.modules[__name__])
m
In my continuing quest for Python Mastery (and because I felt like it ;)
I decided to code a Path object so I could dispense with all the
os.path.join and os.path.split and os.path.splitext, etc., etc., and so
forth.
While so endeavoring a couple threads came back and had a friendly
little ch
Steven D'Aprano wrote:
On Wed, 15 Jun 2011 19:00:07 -0700, Ethan Furman wrote:
Thread 1: "objects of different types compare unequal" self:
"nonsense! we have the power to say what happens in __eq__!"
Thread 2: "objects that __hash__ the same *must* compar
Steven D'Aprano wrote:
If Path is intended to be platform independent, then
these two paths could represent the same location:
'a/b/c:d/e' # on Linux or OS X
'a:b:c/d:e' # on classic Mac pre OS X
and be impossible on Windows. So what's the canonical path it should be
converted to?
Are the
Christian Heimes wrote:
Am 16.06.2011 18:16, schrieb Ethan Furman:
Steven D'Aprano wrote:
If Path is intended to be platform independent, then
these two paths could represent the same location:
'a/b/c:d/e' # on Linux or OS X
'a:b:c/d:e' # on classic Mac pre O
Steven D'Aprano wrote:
On Thu, 16 Jun 2011 09:16:22 -0700, Ethan Furman wrote:
Steven D'Aprano wrote:
If Path is intended to be platform independent, then these two paths
could represent the same location:
'a/b/c:d/e' # on Linux or OS X
'a:b:c/d:e' # o
Chris Torek wrote:
Steven D'Aprano wrote:
Why do you think there's no Path object in the standard library? *wink*
In article
Ethan Furman wrote:
Because I can't find one in either 2.7 nor 3.2, and every reference I've
found has indicated that the other Path cont
Erik Max Francis wrote:
Chris Angelico wrote:
On Fri, Jun 17, 2011 at 10:48 AM, Steven D'Aprano
wrote:
Perhaps the most sensible alternative is conditional importing:
# === module extras.py ===
def ham(): pass
def cheese(): pass
def salad(): pass
# === module other.py ===
def spam(): pass
Erik Max Francis wrote:
Chris Angelico wrote:
On Fri, Jun 17, 2011 at 9:29 AM, Erik Max Francis
wrote:
Chris Angelico wrote:
On Fri, Jun 17, 2011 at 8:07 AM, Erik Max Francis
wrote:
It's quite consistent on which control structures you can break out
of --
it's the looping ones.
Plus funct
pyt...@bdurham.com wrote:
Looking for some real-world advice on what is the best way to access
MS SQL Server 2008R2 databases via Python 2.7 running under Windows XP,
Vista, and Windows 7 and Windows Server 2005 and 2008.
Based on my research, here's my list of choices:
mxODBC
http://www.
Giampaolo Rodolà wrote:
I've written this decorator to deprecate a function and (optionally)
provide a callable as replacement
I can see providing the replacement function so that you can say, for
example, "you are calling a deprecated function -- is the
replacement".
If your replacement f
Windows platform (XP Pro, SP2).
This works fine on local drives, but on network (both 2003 Server, and
Samba running on FreeBSD) the following produces an error:
--> data = '?' * 119757831 # use b'?' if on 3.x
--> test = open(r's:\junk.tst', 'wb')
--> test.write(data)
Traceback (most recent c
Ethan Furman wrote:
Windows platform (XP Pro, SP2).
This works fine on local drives, but on network (both 2003 Server, and
Samba running on FreeBSD) the following produces an error:
--> data = '?' * 119757831 # use b'?' if on 3.x
--> test = open(r's:\junk.
MRAB wrote:
On 17/06/2011 20:15, Ethan Furman wrote:
Ethan Furman wrote:
Windows platform (XP Pro, SP2).
This works fine on local drives, but on network (both 2003 Server, and
Samba running on FreeBSD) the following produces an error:
--> data = '?' * 119757831 # use b'?
SherjilOzair wrote:
What has the community to say about this ? What is the best (fastest)
way to insert sorted in a list ?
Check out the bisect module.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
John Salerno wrote:
On Jun 17, 2:23 pm, Terry Reedy wrote:
If you follow the second part of Greg's suggestion 'or one of the other
related function in the shutil module', you will find copytree()
"Recursively copy an entire directory tree rooted at src. "
Yeah, but shutil.copytree says:
"Th
Chris Torek wrote:
Appending to the list is much faster, and if you are going to
dump a set of new items in, you can do that with:
# wrong way:
# for item in large_list:
#a.append(item)
# right way, but fundamentally still the same cost (constant
# factor is much smaller
[re-posting to list]
pyt...@bdurham.com wrote:
Within the folder where the python.exe exists, I have tried the
following, all of which report Python 2.7.0 vs. 2.7.2
Confirming I'm running what I think I'm running:
import sys
sys.hexversion
34013424
sys.executable
'C:\\Python27\\python.ex
John Salerno wrote:
1)
class Character:
def __init__(self, name, base_health=50, base_resource=10):
self.name = name
self.health = base_health
self.resource = base_resource
You said above that health and resource will never be explicitly passed,
yet here you have a
Lie Ryan wrote:
On 06/18/11 00:45, Franck Ditter wrote:
Hi, I'm just wondering about the complexity of some Python operations
to mimic Lisp car and cdr in Python...
def length(L) :
if not L : return 0
return 1 + length(L[1:])
Should I think of the slice L[1:] as (cdr L) ? I mean, is the s
Ethan Furman wrote:
IANAL (I am not a Lisper), but shouldn't that be 'return L[1:]' ?
Ah, thanks all for the clarification.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
On Mon, 20 Jun 2011 12:43:52 -0700, deathweaselx86 wrote:
I've been converting lists to sets, then back to lists again to get
unique lists.
I used to use list comps to do this instead.
foo = ['1','2','3']
bar = ['2','5']
foo.extend([a for a in bar if a not in foo]) foo
Spencer Pearson wrote:
I was recently trying to implement a dict-like object which would do
some fancy stuff when it was modified, and found that overriding the
__setitem__ method of an instance did not act the way I expected.
The __magic__ methods are only looked up on the class, never the in
Adam Chapman wrote:
Hi,
Howdy!
I'm trying to put together a lot of pieces of source code in matlab,
java, perl and python.
[snippety]
Basically I just want to run a single script from the python command
window. Once I know how to do that I can be off on my way to perform
the matlab interf
Billy Mays wrote:
I have always found that iterating over the indices of a list/tuple is
not very clean:
for i in range(len(myList)):
doStuff(i, myList[i])
Definitely not beautiful. ;)
I know I could use enumerate:
for i, v in enumerate(myList):
doStuff(i, myList[i])
If you actu
Adam Chapman wrote:
Thanks Ethan
No way could I have worked that out in my state of stress!
For your second idea, would I need to type that into the python command
line interface (the one that looks like a DOS window?
If you are actually in a python CLI, at the top of that screen does it
sa
Adam Chapman wrote:
On Jun 21, 9:12 pm, Adam Chapman
wrote:
On Jun 21, 8:00 pm, Ethan Furman wrote:
Adam Chapman wrote:
Thanks Ethan
No way could I have worked that out in my state of stress!
For your second idea, would I need to type that into the python command
line interface
Adam Chapman wrote:
On Jun 22, 4:54 pm, Adam Chapman
wrote:
On Jun 21, 9:12 pm, Adam Chapman
wrote:
On Jun 21, 8:00 pm, Ethan Furman wrote:
Adam Chapman wrote:
Thanks Ethan
No way could I have worked that out in my state of stress!
For your second idea, would I need to type that
Adam Chapman wrote:
Thanks a lot, must be getting close now...
I changed the indentation one lines 136-168, and put in the command
window:
nfold.py --booster=Adaboost --folds=5 --data=spambase.data --
spec=spambase.spec --rounds=500 --tree=ADD_ALL --generate
no syntax errors this time, it just
Adam Chapman wrote:
Thanks again Ethan, It did begin to run nfold.py this time, after I
added the environment variable "CLASSPATH" to my system. It threw back
a java error, but I guess this isn;t the right place to be asking
about that
C:\Users\Adam\Desktop\JBOOST\jboost-2.2\jboost-2.2\scripts>n
Neal Becker wrote:
AFAICT, the python iterator concept only supports readable iterators, not write.
Is this true?
for example:
for e in sequence:
do something that reads e
e = blah # will do nothing
I believe this is not a limitation on the for loop, but a limitation on the
python itera
Terry Reedy wrote:
On 6/24/2011 12:32 AM, Chetan Harjani wrote:
x=y="some string"
And we know that python interprets from left to right.
Read the doc. "5.14. Evaluation order
Python evaluates expressions from left to right. Notice that while
evaluating an assignment, the right-hand side is ev
Ahmed, Shakir wrote:
Hi,
I am getting following error message while unziping a .zip file. Any
help or idea is highly appreciated.
Error message>>>
Traceback (most recent call last):
File "C:\Zip_Process\py\test2_new.py", line 15, in
outfile.write(z.read(name))
IOError: (22, '
Ahmed, Shakir wrote:
Thanks for your help and really appreciate your time.
I changed the code as you mentioned and here it is:
fn = open('T:\\applications\\tst\\py\\Zip_Process\\Zip\\myzip.zip',
'rb')
z = zipfile.ZipFile(fn)
for name in z.namelist():
data = z.read(name)
ptr = 0
Ahmed, Shakir wrote:
Thanks once again and you are right I am trying to unzip in the network
share drive. here is the script now: If I am doing any wrong. :
## code start here
import zipfile
import os
import time
dir1 = "T:\\applications\\tst\\py\\Zip_Process"
test = '%s/shp'%dir1
os.chdir(test)
Tycho Andersen wrote:
On Fri, Jun 24, 2011 at 12:14:27AM -0700, Ethan Furman wrote:
The example given to me when I had this question:
--> x = x['huh'] = {}
--> x
{'huh': {...}}
As you can see, the creation of the dictionary is evaluated, and
bound to the name
Ahmed, Shakir wrote:
Here is the final code that worked to unzip a large file in the network
drive.
CHUNK_SIZE = 10 * 1024 * 1024
fh = open('T:\\applications\\tst\\py\\Zip_Process\\Zip\\myzip.zip',
'rb')
z = zipfile.ZipFile(fh)
for name in z.namelist():
fn = open(name, 'wb')
ptr = 0
Steven D'Aprano wrote:
On Fri, 24 Jun 2011 19:17:29 +, Cousin Stanley wrote:
Chris Rebert wrote:
Netiquette comment: Please avoid SHOUTING
The brilliant beam of light that first thought capitilized words
amounted to shouting never programmed cobol, fortran, or pl/1 in the
1960
Harold wrote:
On Jun 25, 9:04 pm, Chris Torek wrote:
I'm curious. Is there a way to get the number of significant digits
for a particular Decimal instance?
Yes:
def sigdig(x):
"return the number of significant digits in x"
return len(x.as_tuple()[1])
Great, Chris, this is (almost)
Harold Fellermann wrote:
Hi Ethan,
Empirical('1200.').significance
2
Empirical('1200.0').significance
5
What about when 1200 is actually 4 significant digits? Or 3?
Then you'd simply write 1.200e3 and 1.20e3, respectively.
That's just how the rules are defined.
But your code is not foll
John Posner wrote:
Investigating how this fact fit in with the current thread, I came up
with an alternative to the three levels of "def" (pronounced "three
levels of death"). Following is code for two decorators:
* the first one encloses the output of a function with lines of "#"
characters, an
Ian Kelly wrote:
On Wed, Jun 29, 2011 at 1:30 PM, Ethan Furman wrote:
How about just having one bit of code that works either way?
How would you adapt that code if you wanted to be able to decorate a
function that takes arguments?
8
Ian Kelly wrote:
@enclose
def test5(string, func):
print(func(string))
test5('broken', func=str.upper)
Yes, that is a limitation -- one loses the func keyword for the
decorated function. If I were to actually use this, I'd probably go
with '_func' as the keyword.
~Ethan~
PS
Thanks f
Tim Chase wrote:
If it came in as an effortless (i.e. O(1) where I do it once and never
again; not an O(n) where n=the number of times I invoke Python) default
replacement for dir(), I'd reach for it a lot more readily. I seem to
recall there's some environment-var or magic file-name that gets
Phlip wrote:
On 2011.07.06 12:38 PM, Phlip wrote:
Python sucks. m = md5() looks like an initial assignment, not a
special magic storage mode. Principle of least surprise fail, and
principle of most helpful default behavior fail.
>>>
If I call m = md5() twice, I expect two objects.
You didn'
linda wrote:
I have this simple palindrome program that yields different results
depending on whether I run it from Windows or from IDLE. The answer
is correct off IDLE, but why is this the case? Here's the code:
def reverse(text):
return text[::-1]
def is_palindrome(text):
return text
John Gordon wrote:
By the way, I could not make your program work as you provided it; I had
to replace input() with raw_input(). Does it really work for you this way?
input() is the 3.x name for raw_input()
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
linda wrote:
I tried something = input('enter text:').rstrip('\n') as suggested but
the problem persists. BTW, the intermediate print commands agree and
so are not an issue. The disagreement is in IDLE correctly
identifying palindromes and Windows not. I do suspect it may be a
trailing '\r' is
Ethan Furman wrote:
Tim Chase wrote:
If it came in as an effortless (i.e. O(1) where I do it once and never
again; not an O(n) where n=the number of times I invoke Python)
default replacement for dir(), I'd reach for it a lot more readily. I
seem to recall there's some environm
John Keisling wrote:
After too much time coding Python scripts and reading Mark Lutz's
Python books, I was inspired to write the following lyrics. For those
too young to remember, the tune is that of "Pinball Wizard," by The
Who. May it bring you as much joy as it brought me!
Absolutely hilari
Neil Berg wrote:
Hello all,
I am having an issue with my attempts to accurately filter some data from a CSV file I am importing. I have attached both a sample of the CSV data and my script.
The attached CSV file contains two rows and 27 columns of data. The first column is the station ID "B
Mel wrote:
Steven D'Aprano wrote:
Well yes, but None is an explicit missing value too. The question I have
is if I should support None as that value, or something else. Or if anyone
can put a good case for it, both, or neither and so something completely
different.
If it's any help, I think (
Billy Mays wrote:
A sentinel does provide a work around, but it also passes the problem
onto the caller rather than the callee
The callee can easily take care of it -- just block until more is ready.
If blocking is not an option, then the caller has to deal with it no
matter how callee is im
Gregory Ewing wrote:
Ethan Furman wrote:
some of the return values (Logical, Date, DateTime, and probably
Character) will have their own dedicated singletons (Null, NullDate,
NullDateTime, NullChar -- which will all compare equal to None)
That doesn't seem like a good idea to me. It
Steven D'Aprano wrote:
Thomas Jollans wrote:
The "correct" solution in many cases is to not assume any particular
path separator at all, and use os.path.join when dealing with paths.
This will work even on systems that do not accept forward slashes as
path separators. (does Python still support
Chess Club wrote:
Hello,
I used sys.path.append() to add to the path directory, but the changes
made are not saved when I exit the compiler. Is there a way to save
it?
Do you mean saved as in your PATH environment variable is now changed?
This would be bad. Not sure about *nix, but on M$ Win
Billy Mays wrote:
On 07/25/2011 10:16 AM, Archard Lias wrote:
On Jul 25, 2:03 pm, Ian Collins wrote:
On 07/26/11 12:00 AM, Archard Lias wrote:
Still I dont get how I am supposed to understand the pipe and its task/
idea/influece on control flow, of:
return|
??
It's simply a bitwise OR.
Ed Leafe wrote:
Religious fervor is one thing; freedom of religion is another! ;-)
We strive for readability in our code, yet every printed material
> designed to be read, such as books, newspapers, etc., uses a
> proportional font.
The books I purchase use monospaced fonts for code examples.
Brandon Harris wrote:
I don't really think lining things up makes them any easier to read.
I *totally* disagree. Often I'm scanning a dict looking for either a
key or a value, and having them lined up makes it much easier. Yes, I
have to reindent once in a while, but it's still a write few,
Neil Cerutti wrote:
I use them all the time now, even when the resource being managed
is used for just one line, and never need be assigned an explicit
name. Is it good style, or annoying?
with open(in_fname, newline='') as in_file:
folk = list(csv.DictReader(in_file))
The obvious a
John Salerno wrote:
On Jul 9, 9:01 pm, John Salerno wrote:
Thanks everyone! I probably should have said something like "Python,
if possible and efficient, otherwise any other method" ! :)
I'll look into the Task Scheduler. Thanks again!
Hmm, okay I'm finally trying Task Scheduler, but how do
Consider:
Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
--> for ins in ({0:'0'}, (1,), set([2, 3]), [4, 5], 6, 'seven',
... 8.0, True, None):
... print(type(ins))
... type(ins)()
...
Ian Kelly wrote:
On Thu, Jul 28, 2011 at 9:39 AM, Ethan Furman wrote:
Why is NoneType unable to produce a None instance? I realise that None is a
singleton, but so are True and False, and bool is able to handle returning
them:
The bool constructor works (actually just returns one of the
Neil Cerutti wrote:
If an elegant solution doesn't occur to me right away, then I
first compose the most obvious solution I can think of. Finally,
I refactor it until elegance is either achieved or imagined.
+1 QOTW
--
http://mail.python.org/mailman/listinfo/python-list
Chris Angelico wrote:
On Fri, Jul 29, 2011 at 7:03 AM, Ethan Furman wrote:
I'll use a lambda to get around it, but that's not very elegant. Why
shouldn't NoneType be able to return the singleton None?
Why a lambda?
def ThisFunctionWillReturnNone():
pass
Although, sinc
Ben Finney wrote:
Ethan Furman writes:
Why is NoneType unable to produce a None instance? I realise that None
is a singleton
That answers your question. Because None is a singleton, the job of its
type is to make sure there are no other instances.
Which it can do quite easily by returning
John Roth wrote:
ACK. That is exactly what I wanted to show. (With the difference that
this is probably nt the bash, but the linux loader trying to link a .so,
but for the problem, it doesn't make any difference.)
Sorry. I thought what you posted was from the OP. I guess I don't
really expect s
Andrew Berg wrote:
I know I really shouldn't be spending too much time and effort on a
name, but for some reason, it's really bothering me that I can't come up
with good names for the projects I'm working on.
I came up with abstract names (see below) that I don't really like
(because they're so
I came across question http://stackoverflow.com/questions/6485678/ which
has to do with setting the console title from sitecustomize.py. With
some help from the folks on python-win32 (for the title portion ;) I
came up with this:
8<-- sitecustomize.py -
import
Chris Angelico wrote:
I'm afraid I don't understand this. Why create an object and do the
work in the destructor? When will the destructor be called? Will you
subsequently be overwriting sys.argv with the actual arguments?
This code snippet makes excellent sense if and only if it's executed
befo
Chris Angelico wrote:
On Sat, Jul 30, 2011 at 7:39 PM, Ethan Furman wrote:
Well, you /could/ have followed the link and read the explanation there...
;)
I tend to avoid clicking random links in posts :)
Ah -- I understand.
How it works: since the sys.argv object does yet exist
Chris Angelico wrote:
On Sat, Jul 30, 2011 at 8:48 PM, Laszlo Nagy wrote:
the exec statement can be used to execute a def statement. However, I see no
way to change the globals, so I cannot use the exec statement.
A quick test in Python 2.4.5:
exec "def foo():\n\tbar+=1\n\treturn 1\n"
bar=2
201 - 300 of 1928 matches
Mail list logo