rounds=1)
The values (in double precision) 0 and 2047 are reserved for zero,
infinity and NaN (in combination with the fraction), so I was expecting
-1022 and 1023...
--
Marco Buttu
--
http://mail.python.org/mailman/listinfo/python-list
t;, line 1, in
OverflowError: long int too large to convert to float
I think the multiplication should have the same behavior than the
division:
* `inf` or `-inf` when the operands are inside the limits,
but the result is not
* `OverflowError` when the result, and at least one oper
f = open('myfile', 'w', buffering=2)
>>> f.write('a')
1
>>> open('myfile').read()
''
>>> f.write('b')
1
>>> open('myfile').read()
''
>>> f.write('cdefghi\n')
8
>>> open('myfile').read()
''
>>> f.flush()
>>> open('myfile').read()
'abcdefghi\n'
Regards,
Marco
--
http://mail.python.org/mailman/listinfo/python-list
On 08/24/2012 06:35 AM, Marco wrote:
Please, can anyone explain me the meaning of the
"buffering > 1" in the built-in open()?
The doc says: "...and an integer > 1 to indicate the size
of a fixed-size chunk buffer."
Sorry, I get it:
>>> f = open('myfi
On 08/26/2012 10:25 AM, Hans Mulder wrote:
The algorithm is explained at
http://docs.python.org/library/io.html#io.DEFAULT_BUFFER_SIZE
Thanks ;)
In other words: open() tries to find a suitable size by
calling os.stat(your_file).st_blksize and if that fails,
it uses io.DEFAULT_BUFFER_SIZE, wh
Does anyone have an example of utilisation?
--
http://mail.python.org/mailman/listinfo/python-list
On 09/03/2012 03:05 PM, Dave Angel wrote:
Does anyone have an example of utilisation?
As of Python 3.2.3, there is no "opener" parameter in the open() function.
http://docs.python.org/py3k/library/functions.html
I don't know of any such parameter in earlier or later versions, but I
coul
I was trying to import a pyo module in Python 3.3, but Python does not
find it:
$ echo "print(__file__)" > foo.py
$ python3.3 -O -m foo
/home/marco/temp/foo.py
$ ls
foo.py __pycache__
$ rm foo.py
$ mv __pycache__/foo.cpython-33.pyo foo.pyo
$ rm __pycache__ -r
$ ls
foo.pyo
# The fo
; and (3) it does work in Python 3.3 if you don't use the
-O option.
It doesn't work with Python 3.3.0rc2 too.
--
Marco
--
http://mail.python.org/mailman/listinfo/python-list
new__(cls):
... print('Foo.__new__()')
... return super().__new__(cls)
... def __init__(self):
... print('Foo.__init__(self)')
...
>>> f = type.__call__(Foo)
Foo.__new__()
Foo.__init__(self)
Is that right? Thanks in advance
--
Marco
--
http://mail.python.org/mailman/listinfo/python-list
script.py
261
94
216
is explicit enough? Do you prefer a clearer solution?
Thanks in advance, Marco
--
Marco
--
http://mail.python.org/mailman/listinfo/python-list
Hi all, in the documentation:
http://docs.python.org/3.3/reference/lexical_analysis.html
the escape sequence `\newline` is expained as "Backslash and newline
ignored". What does it mean?
Thanks in advance, M.
--
Marco
--
http://mail.python.org/mailman/listinfo/python-list
;> print('\u0660123')
٠123
>>> '\u0660123'.isdigit(), '\u0660123'.isdecimal()
(True, True)
>>> print('\u216B')
Ⅻ
>>> '\u216B'.isdecimal(), '\u216B'.isdigit()
(False, False)
Can anyone give me some help?
Regards, Marco
--
http://mail.python.org/mailman/listinfo/python-list
On 05/16/2012 06:24 PM, Ulrich Eckhardt wrote:
Marco wrote:
>>>> '123'.isdecimal(), '123'.isdigit()
> (True, True)
>>>> print('\u0660123')
> ٠123
>>>> '\u0660123'.isdigit(), '\u0660123
meric()
(False, True, True)
py> unicodedata.numeric(c)
2.0
Perfect explanation, thanks again, Marco
--
http://mail.python.org/mailman/listinfo/python-list
Is it normal the str.isnumeric() returns False for these Cuneiforms?
'\U00012456'
'\U00012457'
'\U00012432'
'\U00012433'
They are all in the Nl category.
Marco
--
http://mail.python.org/mailman/listinfo/python-list
Hello gals and guys,
I'm an experienced Python user and I'd like to begin playing with
Twisted.
I started RTFM the tutorial advised on the official site and I found it
really useful and well done.
Now I'd like to practice a bit by coding a little program that reads
strings from a serial device an
Hello!
Can anyone explain why the following code does not work?
(I'm using python2.4.)
Cheers, Marco
--
# the following code does _not_ work.
# intended: put child-nodes as children to another node
from xml.dom.minidom import Document
doc = Document()
node1 = doc.createElement('
That's it. Thank you very much!
Marco
--
http://mail.python.org/mailman/listinfo/python-list
hi folks,
i can not run any python scripts with dos lineendings under cygwin's python.
if i run such a scripts i get stupid syntax error messages from python.
what can i do to run these scripts without changing the lineending of these
scripts.
regards marco
pgpz3U7zraEvK.pgp
Description
Steven D'Aprano <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Can anyone think of some good, easy to understand examples of where
> Python's name/object model differs from the variable/value model?
a = b = [ 1 ]
a and b are _not_ two variables, each with [ 1 ] as value, but
1.0 / 7:\t', isnumber(1.0 / 7)
print '1+0j:\t', isnumber((1+0j))
print '"spam":\t', isnumber("spam")
output:
1: True
1.25: True
1.0/7: True
1+0j: True
"spam": False
Ooops! While checking other posts I realized that this is alm
uld/)
in the section "Event Driven programming"
Hope it helps
Marco
--
http://mail.python.org/mailman/listinfo/python-list
I'm a bit puzzled by the following behaviour
(at least in the way I read
http://docs.python.org/lib/module-tempfile.html )
> python
Python 2.4 (#1, Mar 21 2005, 23:04:52)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more informati
Re: http://xahlee.org/perl-python/python_re-write/lib/module-re.html
Bill Mill <[EMAIL PROTECTED]> writes:
> Alright, I feel like I'm feeding the trolls just by posting in this
> thread. Just so that nobody else has to read the "revised" docs, no it
> doesn't:
I find that Lee's version compleme
--dir mydir
python finder.py --file myfile --pattern mypattern --dir mydir
where --dir is required, and --file _or_ --parser have to be specified.
In other words, I want the parser prints an error message just in this case:
python finder.py --dir mydir
Thanks in advance, Marco
--
Marco
--
http
ot;
Thanks Rob, but I was looking for a solution in the stdlib
--
Marco
--
http://mail.python.org/mailman/listinfo/python-list
quot; has installed pygments too.
So my question is: if I want "python3.3 setup.py install" installs the
dependencies of a package I need to have distribute?
And pip installs the dependencies because of it uses distribute?
Thanks in advance,
--
Marco
--
http://mail.python.org/mailman/listinfo/python-list
ed to scale rotate the text.
I don't know anything about handling fonts, I must use this .shx but I
don't know. In which way can I take this file and put them in my
programs?
In two afternoons in Google I don't find anything.
If somebody wants to help me :-)
Thanks.
Ma
e
quite a niche.
Can I run py2exe runs under wm5?
Any other suggestion?
Thanks in advance
Marco
--
http://mail.python.org/mailman/listinfo/python-list
I found a Very c00l feature, that you can write your own MPlayer GUI.
The core is Xembed (http://www.freedesktop.org/wiki/Standards/xembed-spec)
And Of course MPlayer support it as its para: -wid
I hope you like it!
--
LinuX Power
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I write a program control a device via RS232, I hope to add some code
to let the program canNOT be used by other people when one people
using.
Can you tell me how to create pid.lock file in python?
Thank you!!
--
LinuX Power
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I can use sd.setsockopt() to enable the socket use TCP keepalive
feature, but how to set a different parameters(interval, probes and
time) for it?
Sure, I can modify /proc/sys/net/ipv4/tcp_* , but need root password
and will affect other program.
Thank you!
--
LinuX Power
--
http://mail.p
Oh, I see,
sd.getsockopt(SOL_TCP, TCP_*)
On 3/13/07, Marco <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I can use sd.setsockopt() to enable the socket use TCP keepalive
> feature, but how to set a different parameters(interval, probes and
> time) for it?
> Sure, I can modify
Hi,
I want to set SA_RESTART flag to restart a system-call. How to do
this in Python?
Thank you!
--
LinuX Power
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
In C, a signal handler function has only one parameter, that is signal number.
But in Python(import signal), a signal handler function has two
parameters, the first is signal number, the second is "frame"?
What is "frame", please?
Thank you!
--
LinuX Power
--
http://mail.python.org/mailm
Hi,
I want to write a PyQt4 program, which like a graph-ssh. One side
user choose server moder, and other side(s) user choose client mode.
Both of them have a GUI, they can connect via socket.
I have study PyQt4 for a while and learn a little socket(from W.R
Stevens Unix Networking Programming).
Hello,
I write two class, which one is Gui(PyQt4) other is socket server. I
wanna: if socket recv() something, Gui will show it in a label.
But it seems that I cannot call the func from other threading. How to
reslove it?
Thank you!
--
LinuX Power
--
http://mail.python.org/mailman/listinfo/
Yes, use signal/slot could reslove this question!
On 4/6/07, Marco <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I write two class, which one is Gui(PyQt4) other is socket server. I
> wanna: if socket recv() something, Gui will show it in a label.
> But it seems that I cannot cal
Hi,
I have a problem to install wxPython on my MacBook (Pythonversion 2.5).
If would install the wxPython (python setup.py install), then I got
this error:
Traceback (most recent call last):
File "/Users/marco/Desktop/flexo1/wxpython/wxPython-src-2.8.3.0/
wxPython/setup.py", l
Hi,
I have a problem to install wxPython on my MacBook (Pythonversion 2.5).
If would install the wxPython (python setup.py install), then I got
this error:
Traceback (most recent call last):
File "/Users/marco/Desktop/flexo1/wxpython/wxPython-src-2.8.3.0/
wxPython/setup.py", l
Hi George,
> Please tell me from which website I will get the free Python Ebook.
which one do you mean?
I only know this one:
http://diveintopython.org
Bye,
Marco
PS: Sorry, hit the wrong button the first time ;-)
--
http://mail.python.org/mailman/listinfo/python-list
is reset when 'compatible' is set.
If you'd like to use VIM for Python make sure you have the following
settings for the best result:
http://www.vex.net/~x/python_and_vim.html
Marco
--
http://mail.python.org/mailman/listinfo/python-list
Hello,every one, I meet a question:
in my old script, I usually use os.popen2() to get info from standard
unix(LinuX) program like ps,ifconfig...
Now, I write a OO-based programme, I still use os.popen2( check
whether mplayer still working via ps command ), but some things I got
the following mes
Hello,every one, I meet a question:
in my old script, I usually use os.popen2() to get info from standard
unix(LinuX) program like ps,ifconfig...
Now, I write a OO-based programme, I still use os.popen2( check
whether mplayer still working via ps command ), but some things I got
the following mes
The following code is my test program for control mplayer.
in movies/ there are about 20 movies, the code plays them in circle,
but mplayer will crash silently after a circle, the "sliently" means I
can handle popen2 without except, but no movie.
I have no idea about it...
Can you help me?
class
Can I use LinuX signal as a tool for commuction with a QT(PyQt4) programme?
The follow code didNOT work...
from PyQt4 import QtCore,QtGui
import signal
import sys
import os
try:
import psyco
psyco.full()
except:
pass
class Main(QtGui.QWidget):
def __init__(self):
QtGui.
Hi,
I have know that signal will interrupt some kind low speed system
call like pipe. But how to design a program that both support signal
and pipe?
I have a mplayer.py to play movie via os.popen2() and mplayer
slave mode. And there is a mplayer_ctl.py send signal to mplayer.py to
trigger
Hello everyone,
I wanta know why (Py)Qt has its own lib on socket/ sql/ openGL,etc ?
Is the lib better than standard lib?
Thank you!
--
LinuX Power
--
http://mail.python.org/mailman/listinfo/python-list
Hi, I wanna write a simple curses program, but somethings confuse
me, my code here:
#!/usr/bin/python
import os
import sys
import time
import curses
class CursesObject( object ):
def __init__(self):
self.STDSCR = curses.initscr()
curses.noecho()
curses.cbreak()
Hello python list,
i want to write a program in python which can communicate with
rpcservices. At the first stage it shall talk with
portbind on port 111 and figure out the running rpc services. Is there
already a implementation for python to do so?
Best regards,
marco
--
http://mail.python.org
t len(dir())
print my_name
->
__main__
119
x
117
unhandled NameError "name 'my_name' is not defined"
The module x is from me, and I am not aware of doing anything cruel there.
What evil thing can be done in its sub module that can result in that
strange thing?
br
Marco
Terry Reedy wrote:
> Marco wrote:
>> Hi,
>>
>> There happened something that I do not understand. Actually I don't even
>> know how it can be possible.
>>
>> I import a module and then the name space of the importing module seems
>> do be overw
Marco wrote:
> Hi,
>
> There happened something that I do not understand. Actually I don't even
> know how it can be possible.
>
> I import a module and then the name space of the importing module seems do
> be overwritten.
>
> my_name = __name__
> print
t py_compile
py_compile.compile(__file__)
Still I appreciate if someone could explain me why.
br
Marco
--
http://mail.python.org/mailman/listinfo/python-list
c
['C:\\Users\\mapr\\example.py']
C:\Users\mapr>python example.py a b c
['example.py', 'a', 'b', 'c']
Can someone please explain?
Regards,
Marco
--
http://mail.python.org/mailman/listinfo/python-list
a C
struct (a class with only attributes and no methods).
A small additional remark. Besides being a real dict or list (by means of
inheritance), custom class can also implement the interface (__getitem__ etc.).
If you want to know if an object implements this interface you could use the
types defined in the 'abc' and 'collections' standard modules. So instead of
checking if a type is a dict like this:
>>> isinstance(s, dict)
you could also check if it implements the dict interface:
>>> isinstance(s, collections.MutableMapping) # or similar
Regards,
Marco
--
http://mail.python.org/mailman/listinfo/python-list
d'
If you want attributes to be local to the instance, you have to define them in
the __init__ section of the class like this:
class A(object):
def __init__(self):
d = 'my attribute'
>>> aobj = A()
>>> bobj = A()
>>> aobj.d
'my attribute'
>>> bobj.d
'my attribute'
>>> aobj.d = 'oops...attribute changed'
>>> aobj.d
'oops...attribute changed'
>>> bobj.d
'my attribute'
Regards,
Marco
--
http://mail.python.org/mailman/listinfo/python-list
On Thursday, August 30, 2012 3:15:03 PM UTC+2, Ulrich Eckhardt wrote:
> Am 30.08.2012 13:54, schrieb boltar2003@boltar.world:
>
> s = os.stat(".")
>
> print s
>
> > posix.stat_result(st_mode=16877, st_ino=2278764L, st_dev=2053L, st_nlink=2,
> > st_u
>
> > id=1000, st_gid=100, st_size
On Thursday, August 30, 2012 3:25:52 PM UTC+2, Hans Mulder wrote:
> On 30/08/12 14:34:51, Marco Nawijn wrote:
>
>
>
> > Note that if you change 'd' it will change for all instances!
>
>
>
> That depends on how you change it.
>
>
>
> &
On Thursday, August 30, 2012 4:30:59 PM UTC+2, Dave Angel wrote:
> On 08/30/2012 10:11 AM, Marco Nawijn wrote:
>
> > On Thursday, August 30, 2012 3:25:52 PM UTC+2, Hans Mulder wrote:
>
> >>
>
> >>
>
> > Learned my lesson today. Don't assume
romq (www.zeromq.org)? It does not
provide a messaging system, but you could use things like simple strings (json)
or more complicated things like Protobuf.
Marco
--
http://mail.python.org/mailman/listinfo/python-list
note that in my opinion, Blender cannot be considered as a CAD
environment. Ofcourse it is very powerful, but I think it is more targeted
towards animation and visually pleasing applications, not mechanical
engineering.
Regards,
Marco
--
http://mail.python.org/mailman/listinfo/python-list
to post the question to the PythonOCC mailinglist. They are quite responsive.
One last suggestion. OCC itself comes with a small utility called DRAWEXE. It
is a tcl/tk program that can be used to play around with a lot of the
functionality provided by OCC.
Good luck!
Marco
--
http://mail.python.org/mailman/listinfo/python-list
On Monday, October 15, 2012 1:33:02 PM UTC+2, (unknown) wrote:
> I want to fix an error in some code I have installed, however I don't
>
> really want to just bodge it.
>
>
>
> The function producing the error is:-
>
>
>
> def get_text(self, idx): # override !
>
>
On Tuesday, October 16, 2012 10:48:17 AM UTC+2, Gaudha wrote:
> my_package/
>
> __init__.py
>
> my_module1.py
>
> my_module2.py
>
> variables.py
>
>
>
> I want to define common variables in __init__.py and use the namespace in
> my_module1.py or my_module2.py. Defining it is not a p
d I selected BOOST Python, because I was only interested in
the Python wrapping (SWIG could generate many other wrappers as well).
Regards,
Marco
--
http://mail.python.org/mailman/listinfo/python-list
as accurate.
>
>
>
> So does anyone know of a way to do this? Unfortunately, I've tried
>
> some searching but google doesn't like the term klog, and most of the
>
> hits involved injecting code or other things that are not related at
>
> all.
>
>
&g
this) is definitely an efficient way of exploring the
Python world, I also liked alot the Python Essential Reference (4th edition).
Since you already understand how to program, the Python essential reference
quickly guides you through Python language and the standard library.
Regards,
Marco
--
http://mail.python.org/mailman/listinfo/python-list
h!
>
> >>
>
> > What it prints should give you a hint:
>
> >
>
> > >>> Dx = numpy.matrix([[test11, test12, test13], [test21, test22,
>
> > -0.5], [0, -0.5, 1.5]])
>
> > >>> Dx
>
> > matrix([[ 1
e path to feedparser.py directly in the script that uses it. Something
like the following:
import sys
sys.path.append("path to feedparser.py")
import feedparser
Regards,
Marco
--
http://mail.python.org/mailman/listinfo/python-list
On Tuesday, October 16, 2012 1:39:44 PM UTC+2, Stefan Behnel wrote:
> Marco Nawijn, 16.10.2012 12:17:
>
> > On Tuesday, October 16, 2012 10:11:52 AM UTC+2, aaron.l...@gmail.com wrote:
>
> >> I have a C++ module where I have a defined, working type. How would I
>
&
ing
etc.). Working with MS/Word through the win32 bindings is really simple.
I have done this a while ago for some automatic report generation. The basic
routine is to start recording your actions with the MS/Word macro recorder, do
the things you want to do, stop recording, look at the VB code and guess the
equivalent Python code. This is not as bad as it sounds. It normally is really
straightforward.
I am on Linux at the moment, so I cannot present any code examples. Feel free
to try and post some example code if you get stuck.
Marco
--
http://mail.python.org/mailman/listinfo/python-list
Am Freitag, 18. Januar 2013 15:47:52 UTC+1 schrieb Rik:
> Hi, I've developed a website for beginners to Python. I'd appreciate any
> comments or criticism. It's still under development, and should be finished
> in the next few months. Oh, and it's free to use.
>
>
>
> www.usingpython.com
Very
7;A'
>> aobj.a
10
The methods might be a little more difficult to attach to the class,
but I don't fully understand your problem. In particular, where does
the implementation of your methods come from?
Marco
--
http://mail.python.org/mailman/listinfo/python-list
numeric(), '\U00012456'.isnumeric()
(True, False)
It seems to me that they are not:
py> c = '\U00012456'
py> import unicodedata
py> unicodedata.numeric(c)
Traceback (most recent call last):
File "", line 1, in
ValueError: not a numeric character
Exactly, as I wrote above, is that right?
--
Marco
--
http://mail.python.org/mailman/listinfo/python-list
Unicode (ver. 5.0.0) does not assign numeric
values to these code points.
help(unicodedata) says Python 3.3a refers to Unicode 6.0.0
--
Marco
--
http://mail.python.org/mailman/listinfo/python-list
On 05/17/2012 09:32 PM, Marco wrote:
Is it normal the str.isnumeric() returns False for these Cuneiforms?
'\U00012456'
'\U00012457'
'\U00012432'
'\U00012433'
They are all in the Nl category.
Marco
It's ok, I found that they don't have a nu
On 05/18/2012 05:42 PM, jmfauth wrote:
Non official but really practical:
http://www.fileformat.info/info/unicode/index.htm
Very well ordered, thanks
--
Marco
--
http://mail.python.org/mailman/listinfo/python-list
On Jun 2, 11:54 am, loial wrote:
> I need to pass some sort of array or hashmap from Java and read the
> data in a python script (which will be called by the java class). Is
> there any neater way to do this other than just passing strings?
I recently had to deal with the same problem, some bi-d
s on how to fix this issue?
>
> Many thanks in advance,
>
> Neil Berg
>
> csv_test.py
> 1KViewDownload
>
> csv_sample.csv
> < 1KViewDownload
Dear Neil,
Don't know if this is a double post (previous post seems to be gone),
but val = val.rstrip('\\') should fix your problem. Note the double
backslash.
Kind regards,
Marco
--
http://mail.python.org/mailman/listinfo/python-list
ions on how to fix this issue?
>
> Many thanks in advance,
>
> Neil Berg
>
> csv_test.py
> 1KViewDownload
>
> csv_sample.csv
> < 1KViewDownload
Hello Neil,
I just had a quick look at your script. To remove the trailing "\" you
can use val = val.rstrip('\\') in your script. Note the double
backslash.
The script now returns 24 items in the hour_list.
Good luck!
Marco
--
http://mail.python.org/mailman/listinfo/python-list
nterface you need, like traversing from parent to children and back.
In addition, you
get querying capabilities like XPATH for free. In python I recommend
lxml.
Your task than is to fill the tree based on the information in the
database. The ORM functionality
from sqlalchemy will be of help here. In addition, you somehow have to
populate the QT tree with the
data from your in-memory XML representation. I have no experience with
QT so I cannot help you there.
Regards,
Marco
--
http://mail.python.org/mailman/listinfo/python-list
This applies to debugging a spinning Zope server, but I think you can adapt
the suggestions to your core dump:
http://www.upfrontsystems.co.za/Members/jean/zope-notes/debug-spinning-zope
Regards
Marco
On Thu, Mar 3, 2011 at 10:40 AM, Gelonida wrote:
> Hi,
>
> I have a QWebview ap
if iFile in media:
filePath =
os.path.join(root, iFile)
result.append(filePath)
return result
for filePath in FindMedia(path):
log(filePath)
This is the real file name that I can't find:
Li
Hi,
what i'm trying to do is develop my own email client, but a simple one.
I just want it to connect to a specific email account and read the subject line
of messages coming from a certain email address.
I then want it to be able to execute the command i wrote on the subject.
It would be nice
Il giorno martedì 13 febbraio 2018 21:18:37 UTC+1, Chris Angelico ha scritto:
> On Wed, Feb 14, 2018 at 7:05 AM, Maroso Marco wrote:
> > Hi,
> >
> > what i'm trying to do is develop my own email client, but a simple one.
> >
> > I just want it to connect to
Il giorno martedì 13 febbraio 2018 21:06:19 UTC+1, Maroso Marco ha scritto:
> Hi,
>
> what i'm trying to do is develop my own email client, but a simple one.
>
> I just want it to connect to a specific email account and read the subject
> line of messages coming from
Hi everyone, i need this program to run as a service.
This program basically check an email account (gmail) and looks if there is
mail from a specific email account, then reads the subject line and splits the
text found assigning the left part (before the ; ) to the password, and the
right part
Il giorno martedì 20 febbraio 2018 23:42:27 UTC+1, Maroso Marco ha scritto:
> Hi everyone, i need this program to run as a service.
>
> This program basically check an email account (gmail) and looks if there is
> mail from a specific email account, then reads the subject line and s
(self, k)
except AttributeError:
print('*** error: attribute {} does not exist.'.format(k))
setattr(self, k, v)
d = Demo()
print(d.a)
d.foo(a=3.14)
print(d.a)
d.foo(q='this will raise')
So, use the inspect module to detect the va
On Sat, 16 Apr 2022 at 17:14, Peter J. Holzer wrote:
>
> On 2022-04-16 16:49:17 +0200, Marco Sulla wrote:
> > Furthermore, you didn't answer my simple question: why does the
> > security update package contain metadata about Debian patches, if the
> > Ubuntu secur
What about introducing a method for text streams that reads the lines
from the bottom? Java has also a ReversedLinesFileReader with Apache
Commons IO.
--
https://mail.python.org/mailman/listinfo/python-list
I don't know in Python, but maybe you can create a script that writes
on a named pipe and read it from Python?
https://askubuntu.com/questions/226278/run-script-on-wakeup
--
https://mail.python.org/mailman/listinfo/python-list
On Sat, 23 Apr 2022 at 20:59, Chris Angelico wrote:
>
> On Sun, 24 Apr 2022 at 04:37, Marco Sulla
> wrote:
> >
> > What about introducing a method for text streams that reads the lines
> > from the bottom? Java has also a ReversedLinesFileReader with Apac
n". When it find it, it stops and do a readline():
def tail(filepath):
"""
@author Marco Sulla
@date May 31, 2016
"""
try:
filepath.is_file
fp = str(filepath)
except AttributeError:
fp = filepath
with open(fp, "
On Sat, 23 Apr 2022 at 23:18, Chris Angelico wrote:
> Ah. Well, then, THAT is why it's inefficient: you're seeking back one
> single byte at a time, then reading forwards. That is NOT going to
> play nicely with file systems or buffers.
>
> Compare reading line by line over the file with readline
On Sun, 24 Apr 2022 at 00:19, Cameron Simpson wrote:
> An approach I think you both may have missed: mmap the file and use
> mmap.rfind(b'\n') to locate line delimiters.
> https://docs.python.org/3/library/mmap.html#mmap.mmap.rfind
>
Ah, I played very little with mmap, I didn't know about this.
on code!
> If I understand Marco correctly, what he want is to read the lines from
> bottom to top, i.e. tac instead of tail, despite his subject.
> I use tail very frequently too, but tac is something I almost never use.
>
Well, the inverse reader is only a secondary suggestion
Something like this is OK?
import os
def tail(f):
chunk_size = 100
size = os.stat(f.fileno()).st_size
positions = iter(range(size, -1, -chunk_size))
next(positions)
chunk_line_pos = -1
pos = 0
for pos in positions:
f.seek(pos)
chars = f.read(chunk_si
1 - 100 of 799 matches
Mail list logo