Re: Convert a scientific notation to decimal number, and still keeping the data format as float64

2019-10-21 Thread Piet van Oostrum
Piet van Oostrum writes: > doganad...@gmail.com writes: > >> I dont know much about scala actually. I have just have tried to give >> 0.0001 and it returned a presentation with an 'e' .whereas python takes >> 0.0001 and gives 0.0001 . it made me think python is better in

Re: Convert a scientific notation to decimal number, and still keeping the data format as float64

2019-10-21 Thread Piet van Oostrum
doganad...@gmail.com writes: > I dont know much about scala actually. I have just have tried to give > 0.0001 and it returned a presentation with an 'e' .whereas python takes > 0.0001 and gives 0.0001 . it made me think python is better in that > specific subject. > > However, python though

Re: Convert a scientific notation to decimal number, and still keeping the data format as float64

2019-10-20 Thread Piet van Oostrum
doganad...@gmail.com writes: > > In the meanwhile I have checked Scala , and it's more limited then Python. > As an example: > 0.0001 > 1.0E-4: Double > Why do you think this means Scala is more limited than Python? -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key:

Re: Jupyter Notebook -> PDF with A4 pages?

2019-10-16 Thread Piet van Oostrum
Martin Schöön writes: > Den 2019-10-15 skrev Piet van Oostrum : >> >> What does this report? Compare if there is a difference between home and >> work. >> >> from jupyter_core.paths import jupyter_path >> print(jupyter_path('notebook','templates')) &

Re: Instantiating sub-class from super

2019-10-16 Thread Piet van Oostrum
than making hasty subdivisions. In this context that means attributes (that can be None) rather than subclasses. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Hello, I need help.

2019-10-15 Thread Piet van Oostrum
n IDE that is called IDLE. It is simpler than Pycharm, but it can do the job. So you can try that. If that also gives an error you could try to reinstall Python. If you are familiar with the command line, then that is also a possibility. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8D

Re: Jupyter Notebook -> PDF with A4 pages?

2019-10-15 Thread Piet van Oostrum
Martin Schöön writes: > Den 2019-10-13 skrev Piet van Oostrum : >> Martin Schöön writes: >> >>> Is there a way to do "Download as PDF" and get A4 pages instead >>> of Letter? Yes, I know I can do "Download as LaTeX" and edit the >> &g

Re: Jupyter Notebook -> PDF with A4 pages?

2019-10-13 Thread Piet van Oostrum
line if you don't want the LaTeX exporter to generate A4. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Strange tab completion oddity with enums?

2019-10-08 Thread Piet van Oostrum
actmethods__ Traceback (most recent call last): File "", line 1, in AttributeError: __abstractmethods__ -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Print to Paper

2019-10-04 Thread Piet van Oostrum
te a PDF file and send that to the printer, possibly with the use of LaTeX. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: itertools query

2019-09-27 Thread Piet van Oostrum
about (5,7), (5,8) and (6,8)? -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: CSV reader ignore brackets

2019-09-26 Thread Piet van Oostrum
is some working code: def PReader(csvfile): import re for line in csvfile: line = re.sub(r'\(.*?\)', '"\g<0>"', line) yield line import csv with open('testcsv.csv') as csvfile: reader = csv.reader(PReader(csvfile), quotechar='"') for row in read

Re: Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-23 Thread Piet van Oostrum
> I added the b because the default in the definition of read_csv is b'.', but you are right, it works with just ','. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-22 Thread Piet van Oostrum
e extracting the numeric fields to the > array. > > Please, any comments or tip? data = pd.read_csv ('table.csv', sep = ',', skiprows = 1, decimal=b',', skipinitialspace=True) -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: python is bugging

2019-09-21 Thread Piet van Oostrum
complete error message with your question. 3) Your with body is not indented: with fits.open(fits_filename) as data: df=pd.DataFrame(data[1].data) df.columns=[c.lower() for c in df.columns] print("Columns.") print(df.columns.values) But how should WE know how many li

Re: python is bugging

2019-09-21 Thread Piet van Oostrum
facility. When a compound statement is entered interactively, it must be followed by a blank line to indicate completion (since the parser cannot guess when you have typed the last line). Note that each line within a basic block must be indented by the same amount. -- Piet van Oostrum WWW: http://piet

Re: not working

2019-09-17 Thread Piet van Oostrum
gt; |IndexError: no such group > |>>> re.search( pattern2, '1234' ).group( 1 ) > |>>> > The second pattern has parentheses, hence a group. The first doesn't. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: pandas loc on str lower for column comparison

2019-09-10 Thread Piet van Oostrum
df1['New Team'].str.lower().str.strip() works on whole columns, not only on an individual row. xls = pd.ExcelFile("Melbourne.xlsx") df = xls.parse('Sheet1', skiprows= 4) df1 = df[['UID','Name','New Leader','Current Team', 'New Team']].copy() df1['Difference'] = df1['Current Team'].st

Re: phyton

2019-09-10 Thread Piet van Oostrum
101, 'low')) > > Outcome: > > 122.21 > 110.09 > > Thanks! You could use a dictionary to connect the words to the values. As this is homework you have to do it yourself. Learn about dictionaries. Otherwise just use 'if'. -- Piet van Oostrum WWW: http://piet.vanoostr

Re: numpy array - convert hex to int

2019-09-10 Thread Piet van Oostrum
> ---> 28 my_data_3 = int(my_data_2) > 29 > 30 my_data_4 = my_data_3.astype(np.float) > TypeError: only length-1 arrays can be converted to Python scalars > # >>> my_data_2 = numpy.array(['0a', '2f', '38', 'ff']) >&

Re: issue in handling CSV data

2019-09-10 Thread Piet van Oostrum
the TABs will disappear. As the format is a strange mixture of the two, you can use either one. But if it would be read with a real CSV-reader, that obeys the quote convention, than using ',' as seperator will not work. Only TAB will work. But in both cases you would have to do some pre- or post-processin

Re: pandas loc on str lower for column comparison

2019-09-05 Thread Piet van Oostrum
Piet van Oostrum writes: > That would select ROWS 0,1,5,6,7, not columns. > To select columns 0,1,5,6,7, use two-dimensional indexes > > df1 = df.iloc[:, [0,1,5,6,7]] > > : selects all rows. And that also solves your original problem. This statement: df1['Difference'] = df1

Re: pandas loc on str lower for column comparison

2019-09-05 Thread Piet van Oostrum
all columns 13 when I requested 5. > UID Name FTE Agent ID Current Leader New Leader Current Team New > Team Current Site New Site Unnamed: 10 Unnamed: 11 Unnamed: 12 > > How do I misunderstand iloc? > That would select ROWS 0,1,5,6,7, not columns. To select columns 0,1,5,6,7, u

Re: IDLE missing !

2019-09-01 Thread Piet van Oostrum
I couldn’d find the IDLE shell > with them. Well, on MacOS 10.13.6 (High Sierra) tensorflow 1.14.0 does install on Python 3.7.4, and it also runs. It does give some warnings about deprecations, however. There is also a version 2.0RC which installs and runs without warnings. -- Piet van

Re: ``if var'' and ``if var is not None''

2019-09-01 Thread Piet van Oostrum
...: print('True') ...: else: ...: print('False') True -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: pandas loc on str lower for column comparison

2019-08-31 Thread Piet van Oostrum
t Team' is spelled differently in the assignment than in the construction of df1? For example a difference in spaces, like a triling space or a breaking vs. non-breaking space? Please check that both are exactly the same. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE

Re: open, close

2019-08-31 Thread Piet van Oostrum
o guarantee. It depends on garbage collection. In your case the file will not be closed as long as there is still a reference to it (as in f). When f disappears and all copies of it as well, the file COULD be closed similarly. On the other hand, the with statement guarantees that the file will b

Re: pandas loc on str lower for column comparison

2019-08-30 Thread Piet van Oostrum
in the [index]' > > if I test df1 before trying to create the new column it works just fine. > > Sayth What does df1.info() produce? Which versions of numpy, scipy and pandas are you using? It would be helpful if you could make a copy of the original .xlsx file available. --

Re: pandas loc on str lower for column comparison

2019-08-29 Thread Piet van Oostrum
Piet van Oostrum writes: > So the correct way to do this is to make df1 a copy rather than a view. > > df1 = df.loc[:, ('UID','Name','New Leader','Current Team', 'New Team')] Or maybe even make an explicit copy: df1 = df[['UID','Name','New Leader','Current Team', 'New Team']].copy()

Re: pandas loc on str lower for column comparison

2019-08-29 Thread Piet van Oostrum
an empty string instead of white space. This was wrong in the stackoverflow post. To replace whitespace it should be str.replace('\\s+',"", regex=True). But simpler is to use str.strip(): df1['Difference'] = df1['Current Team'].str.lower().str.strip() == df1['New Team'].str.lower

Re: Why is augmented assignment of a tuple with iterable unpacking invalid syntax?

2019-05-19 Thread Piet van Oostrum
y is basically part of an expression. But starred expressions are not allowed in expressions, except within explicit parentheses. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Import module from a different subdirectory

2019-05-18 Thread Piet van Oostrum
got. So to get this working you must make sure 'classes' is inside a directory that is in sys.path, for example by adding: sys.path.insert(0, '..') -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Testing the data type of a value

2019-05-12 Thread Piet van Oostrum
t(int) The value of int is the class int, which is the class of 5, so type(5) is also that same class int. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: WebScrapping

2019-02-19 Thread Piet van Oostrum
randing'}) > price = container.find('div', attrs={'class':'item-action'}) > records.append((brand, price)) > When I put this in a python file, and run it under python3.7, it works. It seems you were running this line by line interactively, tight? Could it be that you accidenta

Re: Convert a list with wrong encoding to utf8

2019-02-15 Thread Piet van Oostrum
\xce\xa4\xcf\x83\xce\xb9\xce\xac\xce\xbc\xce\xb7\xcf\x82' >>> b = bytes(ord(c) for c in x) >>> b.decode('utf-8') 'Άκης Τσιάμης' >>> -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: The slash "/" as used in the documentation

2019-02-09 Thread Piet van Oostrum
an Even simpler: >>> help(len) help(len) Help on built-in function len in module builtins: len(obj, /) Return the number of items in a container. both in python 3.6 and 3.7. This is weird. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: The slash "/" as used in the documentation

2019-02-09 Thread Piet van Oostrum
; f( x; y ) > > (the actual call still would use a comma there). > What are you talking about? What documentation? It seems to me you are talking about a completely different programming language, not python. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Python read text file columnwise

2019-01-11 Thread Piet van Oostrum
') as csvfile: reader = csv.reader(csvfile, delimiter='\t') for row in reader: for i in range(2, 5): row[i] = float(row[i]) print(row) You could convert the first two columns to datetime format if you wish. -- Piet van Oostrum WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Facing an Error after migrating from python 3.4.1 to python 3.6.6 ( Failed to import the site module )

2018-12-28 Thread Piet van Oostrum
` > After migrating from python 3.4.1 to python 3.6.6 > while Executing my project, I'm facing this issue and not able to > resolve it. Can i get any solution for this issue? Could it be that your PYTHONPATH environment variable is set to a directory in Py

Re: Problem with subprocess.Popen and EINTR

2017-10-29 Thread Piet van Oostrum
'll try that out. Or I could first try to switch to Python 3, as Chris suggested, to see if that makes the problem disappear. -- Piet van Oostrum <pie...@vanoostrum.org> WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Problem with subprocess.Popen and EINTR

2017-10-28 Thread Piet van Oostrum
e "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 121, in _eintr_retry_call return func(*args) OSError: [Errno 22] Invalid argument TASK is a string with the name of the shell script. Can anybody shed some light on this? --

Re: String to Dictionary conversion in python

2017-09-16 Thread Piet van Oostrum
t "%s: %s" % (type(e).__name__, ', '.join(e.args)) >>> literal("'x':1") {'x': 1} >>> literal("x:1") ValueError: malformed string But in non-interactive use you probably want to propagate the exception. -- Piet van Oostrum <pie...@vanoostrum.org> WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: What extended ASCII character set uses 0x9D?

2017-08-18 Thread Piet van Oostrum
nt 127? The reason turns out to be paper punch tape. > By backstepping and punching a DEL over the previous ASCII character you > can "rub out" the character. > Sure, I have done that many times. Years ago. -- Piet van Oostrum <pie...@vanoostrum.org> WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: how to group by function if one of the group has relationship with another one in the group?

2017-08-01 Thread Piet van Oostrum
Ho Yeung Lee <jobmatt...@gmail.com> writes: > which function should be used for this problem? > I think it is a kind if clustering, or a connectivity problem. There are special algorithms for that, not just a simple function. Maybe scikit-learn has a suitable algorithm for it.

Re: how to sort a list of tuples with custom function

2017-08-01 Thread Piet van Oostrum
ts into a one-dimensiqonal list in such a way thet points that are close together in the two-dimensional sense will also be close together in the one-dimensional list. But that is impossible. -- Piet van Oostrum <pie...@vanoostrum.org> WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Need help to understand not the answer

2017-07-29 Thread Piet van Oostrum
another location as parameter. -- Piet van Oostrum <pie...@vanoostrum.org> WWW: http://piet.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: how to group by function if one of the group has relationship with another one in the group?

2017-07-29 Thread Piet van Oostrum
,5),(3,6),(4,6)] > > for key, group in groupby(items, key=PairKey(isneighborlocation)): > print key, list(group) > > $ python sequential_group_class.py > False [(1, 1)] > True [(2, 3), (2, 4)] > False [(3, 5), (3, 6), (4, 6)] That only works if (a) The elements in the list

Re: Python BeautifulSoup extract html table cells that contains images and text

2017-07-29 Thread Piet van Oostrum
5.0'} > raw_html = requests.get(url, headers=headers) > > raw_data = raw_html.text > soup_data = BeautifulSoup(raw_data, "lxml") > > td = soup_data.findAll('tr')[1:] > > country = [] > > for data in td: > col = data.find_all('td') > co

Re: Temporary variables in list comprehensions

2017-04-11 Thread Piet van Oostrum
Vincent Vande Vyvre <vincent.vande.vy...@telenet.be> writes: > final = [(x, y+1) for x, y in zip(e, e)] final = [(x, x+1) for x in e] -- Piet van Oostrum <pie...@pietvanoostrum.com> WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/

Re: Temporary variables in list comprehensions

2017-04-06 Thread Piet van Oostrum
be nice if python had a real 'let' construction. Or for example: [(tmp, tmp + 1) for x in data with tmp = expensive_calculation(x)] Alas! -- Piet van Oostrum <pie...@pietvanoostrum.com> WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Getting stdout and stderr from subprocess in correct order

2017-03-04 Thread Piet van Oostrum
ement, like sys.stdout.flush() Then you get them in order. $ python3 subprc.py a b c d Of course you won't be able to tell from which stream each line comes. The streams are byte streams, not message streams. You would have to put extra information, e.g. a prefix, in your print statements. -- Piet van Oostrum <pie...@pietvanoostrum.com> WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Expression can be simplified on list

2016-09-17 Thread Piet van Oostrum
not wrong, but it can be simplified to just: if errors: This is quite usual in Python, but some people prefer the more elaborate form, or something like: if len(errors) == 0: -- Piet van Oostrum <pie...@pietvanoostrum.com> WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] --

Re: Something wrong with the PIP, lots of friend have the same problem

2016-08-25 Thread Piet van Oostrum
ormation it is difficult to say. What command did you use and what was the result? [Maybe you tried to include images in your post/mail but they did not come through. Just copy/paste the text.] -- Piet van Oostrum <pie...@pietvanoostrum.com> WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Calling a function is faster than not calling it?

2015-06-22 Thread Piet van Oostrum
__main__ import code) And then you'll see that t1 is slightly slower than t2. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: singleton ... again

2014-02-13 Thread Piet van Oostrum
in :-) There is a use case for a singleton class: when creating the singleton object takes considerable resources and you don't need it always in your program. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo

Re: ANN: A new version (0.3.6) of python-gnupg has been released.

2014-02-06 Thread Piet van Oostrum
Vinay Sajip vinay_sa...@yahoo.co.uk writes: A new version of the Python module which wraps GnuPG has been released. There seem to be 2 gnupg modules for Python. The other one has version number 1.2.5. Very confusing! -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP

Re: Highlighting program variables instead of keywords?

2014-01-29 Thread Piet van Oostrum
. Stop it. Please. If you want to try to convince someone, convince me. Write to me offline: n...@nedbatchelder.com -- Ned Batchelder, http://nedbatchelder.com I seriously think jmf has a mental disorder. So these reactions won't do anything useful. Just ignore. -- Piet van Oostrum p

Re: Can post a code but afraid of plagiarism

2014-01-24 Thread Piet van Oostrum
yourself, you have a serious lack of knowledge about Python, or maybe about programming, and it is time to learn that first. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Early retirement project?

2014-01-22 Thread Piet van Oostrum
wxjmfa...@gmail.com writes: In fact, Python just becomes the last tool I (would) recommend, especially for non-ascii users. jmf In fact, Python 3 is one of the best programming tools for non-ASCII users. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key

Re: How to write this as a list comprehension?

2014-01-20 Thread Piet van Oostrum
for a way to avoid that. Functional programming languages have a way to do this with the 'let' or 'where' construction which is missing in Python. Thanks everybody for your thoughts on this. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4

Re: How to write this as a list comprehension?

2014-01-19 Thread Piet van Oostrum
because it makes it more clear that a new list is constructed from an existing list, something that is not as immediately clear with the append construction. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman

Re: How to write this as a list comprehension?

2014-01-18 Thread Piet van Oostrum
Rustom Mody rustompm...@gmail.com writes: On Saturday, January 18, 2014 4:49:55 AM UTC+5:30, Piet van Oostrum wrote: [...] Python misses a 'where' or 'let'-like construction as in Haskell. +1 Yes Ive often been bitten by the lack of a 'comprehension-let' If it used only in a comprehension

Re: How to write this as a list comprehension?

2014-01-18 Thread Piet van Oostrum
Alain Ketterlin al...@dpt-info.u-strasbg.fr writes: Piet van Oostrum p...@vanoostrum.org writes: [...] Python misses a 'where' or 'let'-like construction as in Haskell. let x = v in e really is (lambda x:e)(v) You are right, but it is a lot less readable IMHO. -- Piet van Oostrum p

How to write this as a list comprehension?

2014-01-17 Thread Piet van Oostrum
, _, _, _, wd, _, _ in [localtime(then)]] Python misses a 'where' or 'let'-like construction as in Haskell. Anybody has a more elegant solution? -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.x adoption

2014-01-16 Thread Piet van Oostrum
Travis Griggs travisgri...@gmail.com writes: Personally, I wish they’d start python4, sure would take the heat out of the 3 vs 2 debates. And maybe there’d be a program called twentyfour as a result. twelve would be sufficient, I would think. -- Piet van Oostrum p...@vanoostrum.org WWW: http

Re: setup.py issue - some files are included as intended, but one is not

2014-01-15 Thread Piet van Oostrum
contains this instruction twice: ifdef(/*pyx*/,cp)if current is None: ifdef(/*pyx*/,cp)raise KeyError Which when generating pyx_treap.pyx (with *pyx* defined) expands to the syntactically incorrect cpif current is None: cpraise KeyError -- Piet van Oostrum p

Re: Monkeypatching a staticmethod?

2014-01-10 Thread Piet van Oostrum
Ian Kelly ian.g.ke...@gmail.com writes: I suggest defining x as a normal function and writing the assignment as Foo.x = staticmethod(x) to keep x callable from the global namespace. Or just del it after doing the monkey patch. You can use Foo.x = staticmethod(lambda: 2) -- Piet van Oostrum

Re: the Gravity of Python 2

2014-01-09 Thread Piet van Oostrum
the doc and use that: from datetime import tzinfo, timedelta, datetime ZERO = timedelta(0) class UTC(tzinfo): UTC def utcoffset(self, dt): return ZERO def tzname(self, dt): return UTC def dst(self, dt): return ZERO utc = UTC() -- Piet van Oostrum p

Re: the Gravity of Python 2

2014-01-09 Thread Piet van Oostrum
(for text: Unicode; for time zones: twelve simple, static zones that never change) Twelve or twenty-four? Or are you thinking we should all be an even number of hours away from UTC, which would also work? Even 24 doesn't take into account DST. -- Piet van Oostrum p...@vanoostrum.org WWW: http

Re: the Gravity of Python 2

2014-01-09 Thread Piet van Oostrum
Chris Angelico ros...@gmail.com writes: On Fri, Jan 10, 2014 at 1:06 AM, Piet van Oostrum p...@vanoostrum.org wrote: Chris Angelico ros...@gmail.com writes: On Thu, Jan 9, 2014 at 2:34 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: With time zones, as with text encodings

Re: Bytes indexing returns an int

2014-01-09 Thread Piet van Oostrum
of these things. Continuing to post these comments with no interest in learning is rude. Other recent threads have contained details rebuttals of your views, which you have ignored. This is rude. Please stop. Please ignore jmf's repeated nonsense. -- Piet van Oostrum p...@vanoostrum.org WWW: http

Re: Python/Django Extract and append only new links

2014-01-01 Thread Piet van Oostrum
get the user id from Django). -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Python mange with liste

2013-12-29 Thread Piet van Oostrum
() thank you =) -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: python socket query

2013-12-23 Thread Piet van Oostrum
it did not work. Any idea what is the problem? Length(reply) == 0 means that the other side closed the socket without sending anything back. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Oh look, another language (ceylon)

2013-11-18 Thread Piet van Oostrum
. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: If you continue being rude i will continue doing this

2013-11-18 Thread Piet van Oostrum
anyone have known that this was the problem? AFIAK you didn't even tell about the VPS. And moreover this wasn't a Python problem, so off topic here. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python

Re: splitting file/content into lines based on regex termination

2013-11-09 Thread Piet van Oostrum
, Robert div class='instructors'Seppi, Kevinbr\n//div] -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Adding 'download' column to existing 'visitors' table (as requested)

2013-11-08 Thread Piet van Oostrum
Sibylle Koczian nulla.epist...@web.de writes: Am 07.11.2013 14:14, schrieb Piet van Oostrum: Nick the Gr33knikos.gr...@gmail.com writes: I have decided to take your advice. I wasn't able to fit those 'lists' of mine into MySQL's varchar() datatype after converting them to long strings

Re: Help me with this code

2013-11-07 Thread Piet van Oostrum
for k in range (1,N): step = ((-1)**(k+1))/(2*k-1) print(step) ## debug output result += step return result print(sequence_b(10)) # print the result of the function call [I use print() because I use Python 3] -- Piet van Oostrum p...@vanoostrum.org WWW: http

Re: Adding 'download' column to existing 'visitors' table (as requested)

2013-11-07 Thread Piet van Oostrum
. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Help me with this code PLEASE

2013-11-05 Thread Piet van Oostrum
TO LONG STRINGS SO I CAN STORE SUCCESSFULLY LIST PYTHON DATATYPE TO MYSQL SCALAR STRING. EVERYHTIGN I TRIED FAILED. Then why don't you use the simple solution: use a relational database to store the data? -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key

[issue19490] Problem installing matplotlib 1.3.1 with Python 2.7.6rc1 and 3.3.3rc1

2013-11-05 Thread Piet van Oostrum
Piet van Oostrum added the comment: I think future versions of Python should add the relevant information about how they are linked to Tcl/Tk in sysconfig. This would include the path of the include files, the shared libraries and the tcl files. Or a framework location on OS X if this is used

Problem installing matplotlib 1.3.1 with Python 2.7.6 and 3.3.3 (release candidate 1)

2013-11-03 Thread Piet van Oostrum
should also include the Tcl/Tk header files. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: trying to strip out non ascii.. or rather convert non ascii

2013-10-29 Thread Piet van Oostrum
instead of asking for evidence you know you will never get. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: how to avoid checking the same condition repeatedly ?

2013-10-28 Thread Piet van Oostrum
, even though there is no chance for needs_processing to change inside the loop, which does not look very efficient. I bet in most cases you won't notice the time used to check the condition. Beware of premature optimization! -- Piet van Oostrum p...@vanoostrum.org WWW: http

Re: Cookie aint retrieving when visiting happens from a backlink.

2013-10-26 Thread Piet van Oostrum
and then trying both the back button and entering the URL in the address bar. So it has nothing to do with referrer, I think. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Cookie aint retrieving when visiting happens from a backlink.

2013-10-26 Thread Piet van Oostrum
Piet van Oostrum p...@vanoostrum.org writes: Νίκος Αλεξόπουλος nikos.gr...@gmail.com writes: There is no set of cookie returned back when visitor comes from a referer. Isn't this strange? No matter if you visit a webpage as a direct hit or via a referer the cookie on the visitor's browser

Re: Python Front-end to GCC

2013-10-22 Thread Piet van Oostrum
just confused or are you trollong? -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Front-end to GCC

2013-10-22 Thread Piet van Oostrum
Neil Cerutti ne...@norwich.edu writes: Context-sensitive grammars can be parse, too. That's not English. Do you mean parsed? But context-sentitive grammars cannot be specified by BNF. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4

Re: Python Front-end to GCC

2013-10-22 Thread Piet van Oostrum
to compile it at all. That's the difference between a calculator and a computer. You think a language that is not Turing-complete cannot be compiled? What nonsense is that. Please Mark, spare us your nonsense. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key

Re: functools and objective usage

2013-10-22 Thread Piet van Oostrum
and functionality differ, Do you have experience with objective usage ? http://docs.python.org/2/library/functools.html#partial-objects What do you mean with objective usage? -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman

Re: Python Front-end to GCC

2013-10-21 Thread Piet van Oostrum
syntax. It doesn't say anything about semantics. So how could this be used to produce executable C code for a program? BNF is used to produce parsers. But a parser isn't sufficient. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https

Re: ANN: matplotlib 1.3.1

2013-10-19 Thread Piet van Oostrum
Ned Deily n...@acm.org writes: In article m2zjq6mugp@cochabamba.vanoostrum.org, Piet van Oostrum p...@vanoostrum.org wrote: I tried to install it from source, on Mac OS X 10.6.8, with Python 3.3.2, and Tck/Tk 8.5 installed as Frameworks, but I get an error during compilation. It seems

Re: ANN: matplotlib 1.3.1

2013-10-18 Thread Piet van Oostrum
-//ccXN6p4b.out error: command 'gcc-4.2' failed with exit status 1 You have new mail in /var/mail/piet bash-3.2$ hg ftp -su -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Python was designed (was Re: Multi-threading in Python vs Java)

2013-10-17 Thread Piet van Oostrum
intermediate C code would be an object-oriented program in C. IIRC, the C code was reasonably clear, not really convoluted, so you would have been able to write it yourself. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org

Re: Markers on a matplotlib plot

2013-10-17 Thread Piet van Oostrum
(20,40, 'bo') plt.annotate('B', (20,40), xytext=(-10,10), textcoords='offset points') Of course you should write a loop to calculate the x, y points, and use the proper colors. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https

Re: urllib2 timeout issue

2013-10-16 Thread Piet van Oostrum
version is Python 2.7.3. Am I missing something ? I would guess the difference to be caused by DNS. Maybe the DNS configuration on the RPi is not optimal. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman

Re: converting letters to numbers

2013-10-16 Thread Piet van Oostrum
.) Perhaps Scheme has the same convention, but Scheme could be considered a part of the Lisp clade. Lisp and scheme use semicolon (;). It wouldn't have been that difficult to look that up I think. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4

Re: Python was designed

2013-10-16 Thread Piet van Oostrum
van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

Re: Python was designed

2013-10-15 Thread Piet van Oostrum
(similar to yacc, that I did not know) and used it to generate a parser for Algol 68. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   >