Jerzy Kozera jerzy.koz...@gmail.com added the comment:
I forgot to mention my patch is 3.3-only, sorry - it depends on changes from
#12555 (http://hg.python.org/cpython/rev/41a1de81ef2b#l18.21 to be precise). To
support 3.2 and 2.7:
(1) select.error must be caught as in the original patch
Jerzy Kozera jerzy.koz...@gmail.com added the comment:
I've updated the patch according to suggestions from Gregory P. Smith. Thanks
to a change from #12555 (PEP 3151) now just checking for OSError is enough.
(I've decided to use mocked select() instead of calling alarm() to avoid
depending
Jerzy Kozera jerzy.koz...@gmail.com added the comment:
Running
gcc -Wl,-R/usr/local/lib,-R/usr/lib -o python Python/pymath.o Modules/python.o
libpython2.7.a -lresolv -lsocket -lnsl -lrt -ldl -lpthread -lm
mv build/lib.solaris-2.8-sun4u-2.7/math_failed.so
build/lib.solaris-2.8-sun4u-2.7
New submission from Jerzy jer...@genesilico.pl:
Hi
When I am outputting unicode strings to terminal my script works OK, but
when I redirect it to file I get a crash:
$ python mailing/message_sender.py -l Bia
Białystok
$ python mailing/message_sender.py -l Bia ~/tmp/aaa.txt
Traceback (most
Jerzy jer...@genesilico.pl added the comment:
I know how to make it work. The question is why outputting to file makes
it crush when outputting to terminal does not.
I have never seen $program file behaving in a different way than
$program in any other language
Jerzy Orlowski
Benjamin
Jerzy jer...@genesilico.pl added the comment:
Well, I would suggest using the terminal encoding as default one when
redirecting. In my opinion sys.stdin and sys.stdout should always have
the terminal encoding
Alternatively you could make the function sys.setdefaultencoding()
visible
Jerzy jer...@genesilico.pl added the comment:
OK, I give up.
The problem is that one might test a program on terminal and think that
everything is running OK and then spend a reasonable amount of time
trying to find the problem later
Another approach: couldn't utf8 be set as default encoding
Jerzy jer...@genesilico.pl added the comment:
good point!
I will give it a try
Jerzy
Martin v. Löwis wrote:
Martin v. Löwis mar...@v.loewis.de added the comment:
If you want to switch to a different language, consider switching to
Python 3. There, all strings are Unicode strings
I've stumbled upon the following in Python 3:
Python 3.0.1+ (r301:69556, Apr 15 2009, 15:59:22)
[GCC 4.3.3] on linux2
Type help, copyright, credits or license for more information.
import sys
sys.stdout.write()
0
sys.stdout.write(something)
something9
write() is appending the length of the
import sys
n = sys.stdout.write('something')
something n
9
Yes, that works as expected, now, similar to 2.6.
Thank you both, Diez and André!
-Jerzy
--
http://mail.python.org/mailman/listinfo/python-list
the return
value(9), which is suppressed if it's None, which it was in 2.x. This has
nothing to do with how the language behaves in normal use.
This makes it much clearer!
You are right, output in a shell script is normal, without the return value.
Thank you, Dave.
-Jerzy
--
http
New submission from Jerzy Jalocha N jjalo...@gmail.com:
Actually, it is not possible to use the 'with' statement in the
ossaudiodev module:
import ossaudiodev
with ossaudiodev.open('/dev/dsp', 'r') as device:
... pass
...
Traceback (most recent call last):
File stdin, line 1 in module
New submission from Jerzy Jalocha N jjalo...@gmail.com:
Actually, the Python Tutorial recommends the use of the 'with' statement
in Section 7.2.1. Methods of File Objects:
It is good practice to use the with keyword when dealing with file
objects. [etc.]
But the example and description
Jerzy jer...@genesilico.pl added the comment:
OK, I see and if don't want l to exist in f() I have to:
def f():
pass
def a():
l=[]
f()
a()
Jurek
Martin v. Löwis wrote:
Martin v. Löwis mar...@v.loewis.de added the comment:
I still do not understand what is going on when
Jerzy jer...@genesilico.pl added the comment:
And anyway, for me it's not OK if something in a code of a function like
'del' affect how variables are affected in whole function.
It is really illogical. There code is in lines and line are one below
another. The logical way is that a line
Jerzy jer...@genesilico.pl added the comment:
I am not an expert. But for me it is much better.
If you cannot delete the global variable in a function (del makes the
variable local anyway). So trying to delete a global variable should
raise an exception Cannot delete a global variable
Jerzy jer...@genesilico.pl added the comment:
I still do not understand what is going on when python executed thic
code. I have a local variable l in my parent process. When I create a
child process, program makes first makes a copy of memory. Than what?
I am sure that l still exists in child
New submission from Jerzy jer...@genesilico.pl:
Hi
I am using the multiprocessing mudule and I found a very weird thing.
It seems that that the result of one fragment of the code depends on the
fragment of the code that is after it, which should not happen.
My script looks like this
import
Scott David Daniels wrote:
So, the first question is: How do I install the complete Python test
framework under Ubuntu (Debian)?
You could use BZR or SVN to get a copy of the full Lib/test tree. Given
your long-disconnected running, I'd consider getting a full source set
for
to support the
_complete_ Python release.
Thanks,
Jerzy
--
http://mail.python.org/mailman/listinfo/python-list
to compile Python?
The one thing you will definitely need is the python-dev-package. It will
contain things such as headers and distutils that are needed to build and
install 3rd-party-packages.
Thanks for your comments, Diez!
Jerzy
--
http://mail.python.org/mailman/listinfo/python-list
, my second question: What (meta?-)package(s) do I have to install
under Ubuntu (Debian) in order to get a full (as in the official
release) Python installation?
Thank you in advance!
Jerzy
--
http://mail.python.org/mailman/listinfo/python-list
* be overloaded, but the absence of *aliasing* (undiscriminate
handling of pointers) in Python. Am I wrong?
Jerzy Karczmarczuk
--
http://mail.python.org/mailman/listinfo/python-list
my words. Sure, I didn't
want to claim that the assignment a=anything can be plainly overloaded. But
getitem, setitem, getattr, setattr - yes. And they (set-) are also assignments.
Jerzy Karczmarczuk
--
http://mail.python.org/mailman/listinfo/python-list
pornography to teenagers, or driving
without a licence.
Possession of banned books is a crime in many countries, [enough ...]
Now, tell me: is the polluting of a newsgroup with off-topic postings,
a crime, and if yes then what?
Jerzy Karczmarczuk
--
http://mail.python.org/mailman/listinfo
no harm. More than hundred -
become annoying. Cross-posting to 5 groups is bad. Please go away.
Claiming that this is an interesting, great thread is utterly silly in this
context. Shall Python newsgroup discuss the trial of Saddam Hussein as well?
Jerzy Karczmarczuk
--
http://mail.python.org
time (unless
the whole stuff is copied, which again makes the complexity related to the size
of existing structure...)
It is probably possible to retrieve this information from the sources, but I try
first an easier way.
Thank you.
Jerzy Karczmarczuk
--
http://mail.python.org/mailman/listinfo
either. *EVERYTHING*
from the beginning until the yield gets executed only upon s.next().
Could you tell me please where can I read something in depth about the
semantics of generators? I feel a bit lost.
Thank you.
Jerzy Karczmarczuk
--
http://mail.python.org/mailman/listinfo/python-list
some co-recursive algorithms with them.
So i use next() when I wish, and never 'for'.
Thank you once more.
Jerzy Karczmarczuk
--
http://mail.python.org/mailman/listinfo/python-list
to many. Well, *why* people who jump into Python from other
languages very often like functional constructs, and dislike the fact
that destructive methods return nothing?...
Jerzy Karczmarczuk
--
http://mail.python.org/mailman/listinfo/python-list
algorithms to Python generators...
Jerzy Karczmarczuk
--
http://mail.python.org/mailman/listinfo/python-list
calling Jerzy Karczmarczuk's efficiently recursive function with
n=1000, while my iterative version works for at least values of n an order
of magnitude larger.)
Yes, the maximum recursion depth in Python is an artificial limit. But
that artificial limit is built into Python specifically
rather inacceptable. It is not the machine code which matters, but
human effort [provided you spent sufficient time to be fluent in *good*
recursive programming of complex tasks.]
Jerzy Karczmarczuk
--
http://mail.python.org/mailman/listinfo/python-list
memoization, though, so it is not entirely senseless to learn it.
Jerzy Karczmarczuk
--
http://mail.python.org/mailman/listinfo/python-list
is similar. I didn't try other methods, but
I suspect that it won't improve.
WHY?
It seems that there was already some discussion about consistency and
somebody produced the example: h = {}.update(l) which didn't work,
but I wasn't subscribed to this nsgr, I couldn't follow this affair.
Jerzy
35 matches
Mail list logo