Am 28.07.2011 20:01 schrieb Ian Kelly:
The advantage of Thomas's decorator here is that it lets you place the
denotation of whether a function is exported alongside its definition,
whereas simply declaring the __all__ list forces you to separate them.
It also avoids the problem of possibly mis
Am 29.07.2011 14:51 schrieb John Roth:
Sorry. I thought what you posted was from the OP. I guess I don't
really expect someone to post a completely irrelevant trace in a
thread started by someone who has a problem.
In what way do you find the trace irrelevant? It clearly shows that it
is not
Am 29.07.2011 17:12 schrieb Ciantic:
class MyObject(object):
... pass
...
my = MyObject()
my.myvar = 'value' # No error!
obj = object()
obj.myvar = 'value' # Causes error!
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'object' object has no attribute 'myvar'
Am 01.08.2011 11:11 schrieb jc:
except:
print "EXCEPT: " + str(n)
If you catch all exceptions here, it is clear that you only get this.
Why don't you do
except Exception, e:
print "EXCEPT: " + str(n), e
? Then you could at least ask "why do I get a unsupported operand
typ
Am 02.08.2011 09:30 schrieb AndDM:
The function works for SIGHUP and SIGINT, but it doesn't work for
SIGTERM. I've tried with simple killall and with -15 option.
Have you some ideas?
SIGTERM cannot be caught - it kills the process the hard way.
HTH,
Thomas
--
http://mail.python.org/mailman/
Am 02.08.2011 09:12 schrieb harrismh777:
The following is intended as a helpful small extension to the xrange()
range() discussion brought up this past weekend by Billy Mays...
With Python2 you basically have two ways to get a range of numbers:
range() , which returns a list, and
xrange() , whic
Am 02.08.2011 10:26 schrieb Thomas Rachel:
Am 02.08.2011 09:30 schrieb AndDM:
The function works for SIGHUP and SIGINT, but it doesn't work for
SIGTERM. I've tried with simple killall and with -15 option.
Have you some ideas?
SIGTERM cannot be caught - it kills the process th
Am 03.08.2011 04:15 schrieb Steven D'Aprano:
> I'm not greatly experienced with context managers and the with
> statement, so I would like to check my logic.
>
> Somebody (doesn't matter who, or where) stated that they frequently
> use this idiom:
>
> spam = MyContextManager(*args)
> for ham in m
Am 03.08.2011 19:27 schrieb Chris Rebert:
shell= True,
I would strongly encourage you to avoid shell=True.
ACK, but not because it is hard, but because it is unnecessary and
unelegant at this point.
You really don't want to have to worry about doing proper shell esca
Am 03.08.2011 17:29 schrieb Phlip:
Groupies:
This is either a code snippet, if you like it, or a request for a
critique, if you don't.
Well, at first, I cannot see the real point about it...
def command(*cmdz):
process = Popen( flatten(cmdz),
shell= True,
Am 04.08.2011 10:42 schrieb Chris Rebert:
I was considering the more general case where one of the strings may
have come from user input. You then need to also escape
$looks_like_a_var, `some_command`, and way more other such stuff that
your simple function doesn't cover.
Even these things are
Am 10.08.2011 08:38 schrieb Danny Wong (dannwong):
Hi All,
I'm trying to execute some external commands from multiple database.
I'm using threads and subprocess.Popen ( from docs, all the popen*
functions are deprecated and I was told to use subprocess.Popen) to
execute the external commands
Am 12.08.2011 03:40 schrieb Steven D'Aprano:
The only exception I can think of is *very* early Fortran, and that rightly
is considered a mistake.
ATARI 800XL. Built-in BASIC, acknowledging every command with "READY".
Going over it with the cursor results in "ERROR- 6", meaning "no READ
witho
Am 16.08.2011 09:03 schrieb Danny Wong (dannwong):
Hi All,
I'm executing a command which I want to capture the
standard/stderr output into a file (which I have with the code below),
but I also want the standard output to go into a variable so I can
process the information for the next com
Am 01.09.2011 16:05 schrieb Daniel:
In pseudocode it looks like this, I am using @ to give loops a name:
@loop1
for c in configurations:
@loop2
while not_done:
@loop3
while step1_did_not_work:
@loop4
for substeps in step1 # loop 4a
Am 06.09.2011 07:57 schrieb xyz:
hi all:
As we know , 1.1 * 1.1 is 1.21 .
But in python ,I got following :
1.1 * 1.1
1.2102
why python get wrong result? Who can tell me where's the 0.0002
from?
1.1 does not fit in a binary floating point number. It is approximate
[posted in de.clp in German]
Hello,
I want to implement an alternative concept to worker threads processing
a job queue. The alternative consists of threads being the jobs
themselves and thus running only this one job. The job threads are
started after a Semaphore's acquire() "giving the OK"
Am 07.04.2011 21:14, schrieb Anssi Saari:
Chris Angelico writes:
Depending on what exactly is needed, it might be easier to run a
separate daemon on the computers, one whose sole purpose is to do the
task / get the statistics needed and return them. Then the Python
script need only collect eac
Am 20.04.2011 09:34, schrieb Bastian Ballmann:
No system is totally secure. You can _always_ poke around if a program
uses user input.
It depends on what the program does with the input. If it treats it
appropriately, nothing can happen.
For example one can totally own a complete computer
Am 13.04.2011 01:06, schrieb Ethan Furman:
--> def func():
--> var1 = something()
--> var2 = something_else('this')
--> return? var1.hobgle(var2)
--> var3 = last_resort(var1)
--> return var3.wiglat(var2)
This makes me think of a decorator which can mimic the wantend behaviour:
def getfirst(f)
Hi folks,
it is possible to close a generator. That is (among others) for the
following case:
I run a for loop over the iterator, but then I break it. Now I can leave
the generator to the GC (which is AFAI have been told a thing which I
should not do), or I can clean up myself.
Example:
f
Am 22.04.2011 09:01, schrieb Wolfgang Rohdewald:
On Freitag 22 April 2011, Terry Reedy wrote:
When returning from the function, g, if local, should
disappear.
yes - it disappears in the sense that it no longer
accessible, but
AFAIK python makes no guarantees as for when an object
is destro
Am 23.04.2011 04:15, schrieb Terry Reedy:
.close() methods that release operating system resources are needed
*because* there is no guarantee of immediate garbage collection. They
were not needed when CPython was the only Python. The with statement was
added partly to make it easier to make sure
Am 25.04.2011 14:46, schrieb rjmccorkle:
hi - I need to open a serial port in 9600 and send a command followed
by closing it, open serial port again and send a second command at
115200. I have both commands working separately from the python
command line but it won't work in the script. Any ide
Am 10.04.2011 18:21, schrieb Mel:
Chris Angelico wrote:
Who would use keyword arguments with a function that takes only one arg
anyway?
It's hard to imagine. Maybe somebody trying to generalize function calls
(trying to interpret some other language using a python program?)
# e.g. input win
Am 12.04.2011 04:58, schrieb rantingrick:
That's sounds good MRAB! After you mentioned this i had an epiphany...
why not just add an extra argument to dict.update?
dict.update(D, clobberexistingkeys=False)
This is AFAICS inconsistent to the possibility to do dict.update(a,
k1=v1, k2=v2).
Am 25.04.2011 16:41, schrieb rjmccorkle:
The code is fine but it seems it won't switch baud rates using
pyserial. I have to initiate the first msg in 9600 to change the
setting of the gps
And then send the second command in 115200 because it's in
configuration mode on the unit.
Ok.
> I can s
Am 25.04.2011 22:14 schrieb Hans Georg Schaathun:
On Tue, 26 Apr 2011 05:49:07 +1000, Chris Angelico
wrote:
: The way you talk of "the" external interface, I'm assuming this
: computer has only one. Is there a reason for not simply binding to
: INADDR_ANY aka 0.0.0.0?
Ah. That's wha
Am 25.04.2011 22:30, schrieb Chris Angelico:
If you don't care what port you use, you don't need to bind at all.
That may be why it's not mentioned - the classic TCP socket server
involves bind/listen/accept, and the classic TCP client has just
connect; bind/connect is a lot less common.
That
Am 25.04.2011 16:29, schrieb Thomas Rachel:
or maybe even better (taking care for closures):
function = bool
value = 'the well at the end of the world'
## ...
actions.append(lambda val=value: function(val))
## ...
for function in actions:
results.append(function())
Or yet even bett
Am 26.04.2011 14:21, schrieb Thomas Rachel:
Especially look at the concepts called "borrowed reference" vs. "owned
reference".
http://docs.python.org/extending/extending.html#reference-counting-in-python
will be quite helpful.
Thomas
--
http://mail.python.org/mailman/listinfo/python-list
Am 26.04.2011 11:48, schrieb Ervin Hegedüs:
Everything works fine, but sorry for the recurrent question: where
should I use the Py_INCREF()/Py_DECREF() in code above?
That depends on the functions which are called. It should be given in
the API description. The same counts for the incoming pa
Am 26.04.2011 15:48, schrieb Oltmans:
Following doesn't work
config = ConfigParser.ConfigParser()
config.read('configs.txt')
server_info = config.get("DB_INFO","server")
db = config.get("DB_INFO","database")
username = config.get("DB_INFO","user")
pwd = config.get("DB_INFO","password")
print s
Am 26.04.2011 16:03, schrieb Hegedüs Ervin:
I've read API doc (which you've included in another mail), but
that's not clear for me. :(
No probem, I'll go in detail, now as I have read it again. (I didn't
want to help from memory, as it is some time ago I worked with it, and
didn't have time
Am 26.04.2011 19:28, schrieb Hegedüs Ervin:
Another question: here is an another part ot my code:
static PyObject*
mycrypt_decrypt(PyObject *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, "ss",&data,&path)) {
return NULL;
}
...
}
When I call this function from Python
Am 26.04.2011 16:39, schrieb snorble:
When I write a Python app, I have several unorganized scripts in a
directory (usually with several named test1.py, test2.py, etc., from
random ideas I have tested), and maybe a todo.txt file. Then I hack
away, adding features in a semi-random order. Then I g
Am 26.04.2011 20:42, schrieb Algis Kabaila:
Thomas, have you tried bzr (Bazaar) and if so do you consider hg
(Mercurial) better?
I have played around with bzr, but afterwards more with hg which gave me
a better beeling (don't know why)...
Thomas
--
http://mail.python.org/mailman/listinfo/py
Am 26.04.2011 21:55, schrieb Hans Georg Schaathun:
Now, I would like to use remote hosts as well, more precisely, student
lab boxen which are rather unreliable. By experience I'd expect to
lose roughly 4-5 jobs in 100 CPU hours on average. Thus I need some
way of detecting lost connections and
Am 26.04.2011 20:44, schrieb Hegedüs Ervin:
and (maybe) final question: :)
I defined many exceptions:
static PyObject *cibcrypt_error_nokey;
static PyObject *cibcrypt_error_nofile;
static PyObject *cibcrypt_error_badpad;
...
void handle_err(int errcode) {
switch(errcode) {
case
Am 27.04.2011 13:17, schrieb Jean-Michel Pichavant:
You're mistaking, SVN is not restricted to solo work. However it's more
suitable for solo work than git.
Why?
I personally found hg much better than svn. That's why I migrated all my
projects.
Thomas
--
http://mail.python.org/mailman/lis
Am 28.04.2011 13:14, schrieb Chris Rebert:
import a, b, sys
def c():
orig_stdout = sys.stdout
sys.stdout = open('my_log_file.log', 'w')
a.a()
b.b()
sys.stdout.close()
sys.stdout = orig_stdout
Someone may have written a with-statement context manager that
abstracts
Am 30.04.2011 09:43 schrieb harrismh777:
On the other hand, I am very much interested in "yield," because of its
obvious persistent state, On the other hand, I don't like you fib()
function because it does not encapsulate the fib generator. I suppose
you are considering whatever module is holdin
Am 30.04.2011 07:35, schrieb harrismh777:
Ian Kelly wrote:
since the fact is that if
the function were properly coded, the call stack for fib(20) would
never be more than 20 entries deep at any one time.
Not so much... and much more !
... because each recursion level 'return' calls fib()
Am 30.04.2011 11:10 schrieb Matthias Kievernagel:
In my top-level script I want to select if my program
is to use random.xxx functions or the random.SystemRandom.xxx
ones.
On which criteria do you fix that?
Anyway, you could use a module myrandom.py:
import random
if use_sys:
randobj =
Am 01.05.2011 22:00, schrieb Hegedüs Ervin:
My module contains just 4 functions (in C), which translate 3rd
party lib to Python. The name would be _mycrypt.so example.
I wrapped it a pure Python module, its name is mycrypt.py.
Then, I've import pure Python module in a main program, like
this:
Am 07.05.2011 11:09, schrieb Gregory Ewing:
Ethan Furman wrote:
Ian Kelly wrote:
next(iter(myDict.items()))
Which is becoming less elegant.
If you're doing this sort of thing a lot you can make
a little helper function:
def first(x):
return next(iter(x))
then you get to say
first(myDict
Am 15.05.2011 17:56 schrieb TheSaint:
SigmundV wrote:
I think the OP wants to find the intersection of two lists.
list(set(list1)& set(list2)) is indeed one way to achieve this. [i
for i in list1 if i in list2] is another one
Exactly. I was confused on that I wasn't able to have a list in re
Am 17.05.2011 07:13 schrieb Andy Baxter:
self.window = self.wTree.get_widget("mainWindow")
self.outputToggleMenu = self.wTree.get_widget("menuitem_output_on")
self.outputToggleButton = self.wTree.get_widget("button_toggle_output")
self.logView = self.wTree.get_widget("textview_log")
self.logScro
Am 11.05.2011 23:02 schrieb Ian:
On 11/05/2011 20:13, Hans Georg Schaathun wrote:
Lists do not have truth values in the
application domain, and therefore truth values in the
implementation domain is complicated.
Exactly. Its just a convention. If it exists, its true, if if doesn't
its false.
Am 27.05.2011 17:52 schrieb Steven D'Aprano:
On Fri, 27 May 2011 09:40:53 -0500, harrismh777 wrote:
3.x is completely incompatible with 2.x (some call it a dialect,
but that is a lie).
"Completely incompatible"? A "lie"?
Hard word, but it is true. Many things can and will fall on your feet
Am 28.05.2011 01:57 schrieb sturlamolden:
Yes. And opposite: CPython cannot know that builtin super() is not
called,
even if it does not see the name 'super'. I can easily make foo()
alias super().
Another alternative would have been to make use of __xxx magic.
If every class had an "automati
Am 31.05.2011 02:28 schrieb Henry Olders:
This suggests that the decision to make unassigned (ie "free"
variables) have a global scope, was made somewhat arbitrarily to
prevent clutter. But I don't believe that the feared clutter would
materialize. My understanding is that when a variable is ref
Am 31.05.2011 12:08 schrieb Jussi Piitulainen:
The same sharing-an-i thing happens here:
fs = []
for i in range(4):
...fs.append(lambda n : i + n)
...
fs[0](0)
3
And the different private-j thing happens here:
gs = []
for i in range(4):
...gs.append((lambda j : lambda n : j + n)
Am 12.01.2014 08:50 schrieb wxjmfa...@gmail.com:
sys.version
2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]
s = 'Straße'
assert len(s) == 6
assert s[5] == 'e'
Wow. You just found one of the major differences between Python 2 and 3.
Your assertins are just wrong, as s = '
Am 13.01.2014 10:54 schrieb wxjmfa...@gmail.com:
Not at all. I'm afraid I'm understanding Python (on this
aspect very well).
IBTD.
Do you belong to this group of people who are naively
writing wrong Python code (usually not properly working)
during more than a decade?
Why should I be?
'ß
Am 12.01.2014 01:24 schrieb Ethan Furman:
I must admit I'm not entirely clear how this should be used. Is anyone
using this now? If so, how?
I am not, as I currently am using Py2, but if I would, I would do it e.
g. for serialization of objects in order to send them over the line or
to sav
Am 29.10.2014 07:02 schrieb satishmlm...@gmail.com:
What does %%(%s)s mean in Python?
Weird question, as this has nothing to do with the code you just posted.
In general, what comes up to my mind, is that it is a format string to
build another format string.
Example:
metafmt = '%%(%s)s'
f
Am 14.11.2014 00:42 schrieb satishmlm...@gmail.com:
fileno() in not supported. Is it only in 3.1? What is the workaround?
You have been asked many times about the details of your environment.
Especially, you have been told that it is important to know if you
directly use the Python CLI or som
Am 09.12.2014 09:14 schrieb pengsir:
My vps ip is x.y.z.w ,i want to download /etc/passwd from linux server
into my local window disk c: .
localpath = 'c:'
[...]
with open(localpath, 'wb') as fl:
PermissionError: [Errno 13] Permission denied: 'c:'
That's completely clear: you are n
Am 08.12.2014 19:11 schrieb Luuk:
no, it's the ssh-server denying a log on from 'root'
You are repating yourself.
How could possibly
with open(localpath, 'wb') as fl:
PermissionError: [Errno 13] Permission denied: 'c:'
be a problem with the SSH server?
--
https://mail.python.org/mailman
Am 09.12.2014 04:09 schrieb memilanuk:
so in the first example in my original post:
...
lambda: update_label2('A', 100)
would this work the same? It looks as though it'd be passing the same
two parameters to the same function...
lambda: 'A', 100: update_label2()
No. Even if it would be all
Am 09.12.2014 09:14 schrieb pengsir:
> My vps ip is x.y.z.w ,i want to download /etc/passwd from linux server
> into my local window disk c: .
> localpath = 'c:'
[...]
> with open(localpath, 'wb') as fl:
> PermissionError: [Errno 13] Permission denied: 'c:'
That's completely clear: you ar
Am 08.12.2014 19:11 schrieb Luuk:
> no, it's the ssh-server denying a log on from 'root'
You are repating yourself.
How could possibly
with open(localpath, 'wb') as fl:
PermissionError: [Errno 13] Permission denied: 'c:'
be a problem with the SSH server?
--- SoupGate-Win32 v1.05
* Origi
Am 2013-08-28 14:52 schrieb AdamKal:
Hi,
From time to time I have to apply a series of functions to a value in such a
way:
func4(func3(func2(func1(myval
I was wondering if there is a function in standard library that would take a
list of functions and a initial value and do the above li
Am 09.11.2013 14:27 schrieb Joshua Landau:
`select` is quite an odd statement, in that in most cases it's just a
weaker variant of `if`. By the time you're at the point where a
`select` is actually more readable you're also at the point where a
different control flow is probably a better idea. T
Am 02.03.2015 20:14 schrieb sohcahto...@gmail.com:
On Monday, March 2, 2015 at 12:43:59 AM UTC-8, Sarvagya Pant wrote:
f = open("somefile.txt")
This one is the problem. Under Windows, you have to open the file in
binary to avoid that something "bad" happens with it.
So just do
f = open("
Am 26.02.2015 01:37 schrieb Chris Angelico:
My bad. I was talking in a context of Python programming, specifically
with APIs where you would use some kind of true/false flag as either a
function parameter or a return value.
Oh. Then take subprocess.Popen.wait()... :-P
Thomas
--
https://mail.
Am 13.05.2015 um 15:25 schrieb andrew cooke:
class Foo:
... def __new__(cls, *args, **kargs):
... print('new', args, kargs)
... super().__new__(cls, *args, **kargs)
new (1,) {}
Traceback (most recent call last):
File "", line 1, in
File "", line 4, in __new__
TypeE
Am 16.05.2015 um 21:20 schrieb C.D. Reimer:
Does python perform the dot operators from left to right or according to
a rule of order (i.e., multiplication/division before add/subtract)?
In this case, it does the only thing it can do:
title = slug.replace('-',' ').title()
is performed as
* t
Am 19.05.2015 um 15:16 schrieb Oscar Benjamin:
However the normal way to do this is to iterate over stdout directly:
Depends. There may be differences when it comes to buffering etc...
Thomas
--
https://mail.python.org/mailman/listinfo/python-list
Am 20.05.2015 um 18:44 schrieb Robin Becker:
not really, it's just normal to keep event routines short; the routine
which beeps is after detection of the cat's entrance into the house and
various recognition schemes have pronounced intruder :)
You could add a timed "cleanup" routine which .wai
Am 03.06.2015 um 01:56 schrieb Chris Angelico:
and it's pretty convenient. In C, the nearest equivalent is passing a
number of pointers as parameters, and having the function fill out
values. Python's model is a lot closer to what you're saying than C's
model is :)
At least, C functions can re
Am 08.06.2014 05:58 schrieb Rustom Mody:
Some people¹ think that gotos are a code-smell.
¹ I am not exactly those people.
A chap called E W Dijkstra made the statement: "Goto statement considered
harmful" and became famous.
And became widely misunderstood. If anybody would read the whole what
Am 11.06.2014 14:23 schrieb BrJohan:
Can it, for a pair of regular expressions be decided whether at least
one string matching both of those regular expressions, can be constructed?
If it is possible to make such a decision, then how? Anyone aware of an
algorithm for this?
Just a feeling-base
Am 15.07.2014 02:10 schrieb LJ:
Hi All.
I'm coding a Dynamic Programming algorithm to solve a network flow problem. At
some point in the algorithm I have to iterate through a set of nodes, while
adding and/or removing elements, until the set is empty. I know a regular set()
object does not wo
Am 19.08.2014 00:04 schrieb Chris Kaynor:
In each of these cases, the behavior may be different in other
implementations or versions of Python.
And, the most important thing, in each of these cases, using "is" is
semantically wrong, so no matter how different versions behave.
If you ask the
Am 18.08.2014 22:53 schrieb Marko Rauhamaa:
Frankly, I don't know of any other object that is "==" to the None
object except None itself, but such objects could possible exist.
class ImitatingNone(object):
def __eq__(self, other):
return True # is equal to everything else
r
Am 20.08.2014 13:17 schrieb Chris Angelico:
That's true, but how easy is it to annotate a file with each line's
author (or, at least, to figure out who wrote some particular line of
code)? It's easy enough with 'git blame' or 'hg blame', and it
wouldn't surprise me if bzr had a similar feature;
Am 11.09.2014 23:32 schrieb Ervin Hegedüs:
There is no upper limit to the thread name other than that you will
eventually run out of memory ;)
thanks - I hope that the memory will not run out by these
threads... :)
Anyway, that means, on my system:
import sys
print sys.maxint
9223372036854
Am 13.09.2014 09:22 schrieb Chris Angelico:
In that case, don't iterate over the list at all. Do something like this:
while lst:
element = lst.pop(0)
# work with element
lst.append(new_element)
And if you don't like that, define a
def iter_pop(lst):
while lst:
yiel
Am 09.09.2011 07:47 schrieb Oliver:
class Container(object):
"""Container to store a number of non-overlapping rectangles."""
def __init__(self, xsize=1200, ysize=800):
super(Container, self).__init__(xsize, ysize)
And this is the nonsense: Container derives from object and
Am 09.09.2011 10:33 schrieb Steven D'Aprano:
Not nonsense. Merely a backward-incompatible change:
[1]
In Python 2.2, the default object constructor accepts, and ignores, any
parameters. In Python 2.3 on up, that becomes an error.
Thanks, I wasn't aware of that. My first contact with Pytho
Am 15.09.2011 15:16 schrieb Alan Plum:
The Turkish 'I' is a peculiarity that will probably haunt us programmers
until hell freezes over.
That's why it would have been nice if the Unicode guys had defined "both
Turkish i-s" at separate codepoints.
Then one could have the three pairs
I, i ("n
Am 22.09.2011 08:12 schrieb Steven D'Aprano:
I don't understand why some environment variables are not visible from
Python.
[steve@wow-wow ~]$ echo $LINES $COLUMNS $TERM
30 140 xterm
[steve@wow-wow ~]$ python2.6
Python 2.6.6 (r266:84292, Dec 21 2010, 18:12:50)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-
Am 22.09.2011 05:42 schrieb Atherun:
I'm pretty sure thats the problem, this is a generic catch all
function for running subprocesses. It can be anything to a simple
command to a complex command with a ton of output. I'm looking for a
better solution to handle the case of running subprocesses
Am 22.09.2011 12:16 schrieb Ben Finney:
--
\ “As far as the laws of mathematics refer to reality, they are |
`\not certain, and as far as they are certain, they do not refer |
_o__) to reality.” —Albert Einstein, 1983 |
Ben Finney
So, he said what in
Am 22.09.2011 12:21 schrieb Gavin Panella:
Hi,
On Python 2.6 and 3.1 the following code works fine:
class Foo(object):
@classmethod
def __enter__(cls):
print("__enter__")
@classmethod
def __exit__(cls, exc_type, exc_value, traceback):
Am 12.10.2011 10:22 schrieb Christian Wutte:
Hello all,
as stated in the docs [1] os.startfile relies on Win32 ShellExecute().
So maybe someone can explain it to me, why there is no support for
program arguments.
Because it is intended to start an arbitrary file of any type (.txt,
.doc, ...)
Am 16.11.2011 14:48 schrieb Eduardo Oliva:
Hello, I have a py script that reads for all "m2ts" video files and convert them to
"mpeg" using ffmpeg with command line.
What I want to do is:
I need my script to run 2 separated threads, and then when the first has
finished, starts the next one
Am 17.11.2011 03:30 schrieb Roy Smith:
When I run this (python 2.6.1):
class C:
@staticmethod
def foo():
pass
print "inside", foo, callable(foo)
print "outside", C.foo, callable(C.foo)
I get:
inside False
outside True
Right. The reason is that on an attribute acce
Am 18.11.2011 05:34 schrieb Dennis Lee Bieber:
>> def _pass(*args):
>> pass
>>
>> def long_running_process(arg1, arg2, arg_etc, report = _pass):
>> result1 = do_stuff()
>> report(result1)
>
> So this is a call to a function that just returns a None, which is
> dropped by the interpr
Am 08.12.2011 08:18 schrieb 8 Dihedral:
I use the @ decorator to behave exactly like a c macro that
does have fewer side effects.
I am wondering is there other interesting methods to do the
jobs in Python?
In combination with a generator, you can do many funny things.
For example, you ca
Am 08.12.2011 12:43 schrieb Chris Angelico:
On Thu, Dec 8, 2011 at 10:22 PM, K.-Michael Aye wrote:
I am still perplexed about decorators though, am happily using Python for
many years without them, but maybe i am missing something?
For example in the above case, if I want the names attached to
Am 16.12.2011 09:52 schrieb Ulrich:
Could anyone please explain me why this does not work / how to get b
into .__dict__ / hint me to an explanation?
b is not a data element of the particular instance, but it lives in the
class. It is, roughly spoken, a "kind of method", just to be used
witho
Am 21.12.2011 23:25 schrieb Eric:
Is it true that if I want to create an array or arbitrary size such
as:
for a in range(n):
x.append()
I must do this instead?
x=[]
for a in range(n):
x.append()
Of course - your x must exist before using it.
> Now to my actual quest
Am 22.12.2011 00:48 schrieb Steven D'Aprano:
On Wed, 21 Dec 2011 18:20:16 -0500, Dennis Lee Bieber wrote:
For the amount of typing, it's easier to just do a straight line
tuple unpack
a,b,c = ([],[],[])
Note that tuples are created by the comma, not the round brackets (or
parenthese
Am 22.12.2011 00:20 schrieb Dennis Lee Bieber:
The key one is that lists ([] defines a list, not an array) are
"mutable". Your "7" is not mutable.
Strictly spoken, that's only a "side show" where the effect is visible.
The real key concept is that [] creates *one* object which is then
Am 22.12.2011 15:40 schrieb Νικόλαος Κούρας:
Hello when i try to visit my webpage i get the error it displays. Iam
not posting it since you can see it by visiting my webpage at
http://superhost.gr
Please if you can tell me what might be wrong.
What is wrong on this site? Mainly the unwanted so
Am 06.01.2012 21:00 schrieb jmfauth:
Another simple approach, os independent.
You probably do not write your code in iso-6937, but
you only need to encode/decode some bytes sequence
"on the fly". In that case, work with bytes, create
a couple of coding / decoding functions with a
created [*] a
Am 09.01.2012 23:35 schrieb Dominic Binks:
On 1/9/2012 2:19 PM, Νικόλαος Κούρας wrote:
Can you please explain me what the [0] in host =
socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] does at the end?
Why not just host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )
instead? what is th
101 - 200 of 215 matches
Mail list logo