Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: expression vs statement
Post: RE: expression vs statement

Sure, you can try compiling it and see if you get a SyntaxError: >>> # eval mode can only compile expressions >>> compile('a = 1', '', 'eval') Traceback (most recent call last): Fi...
stranac News and Discussions 1 1,512 May-20-2021, 05:55 AM
    Thread: Unable to upload files to my thread?
Post: RE: Unable to upload files to my thread?

There's a whitelist of allowed extensions, so you won't be able to upload a .xsd .xml upload should be allowed for all groups though, do you get any error messages?
stranac Board 2 2,713 May-20-2021, 05:44 AM
    Thread: assignments
Post: RE: assignments

https://www.python.org/dev/peps/pep-0572/
stranac Bar 2 2,066 Apr-21-2021, 05:21 AM
    Thread: issubclass() not as documented
Post: RE: issubclass() not as documented

(Mar-08-2021, 08:13 AM)Skaperen Wrote: i think there is a better way to explain it as what it says right now doesn't do it.If you're not happy with the current explanation and can come up with a bet...
stranac News and Discussions 19 7,626 Mar-08-2021, 12:29 PM
    Thread: issubclass() not as documented
Post: RE: issubclass() not as documented

Quote:classinfo may be a tuple of class objects, in which case every entry in classinfo will be checked. In any other case, a TypeError exception is raised. What it's saying is that it raises TypeErro...
stranac News and Discussions 19 7,626 Mar-08-2021, 06:36 AM
    Thread: Advantages of Python
Post: RE: Advantages of Python

Looks like spam for promoting a website to me...
stranac News and Discussions 7 3,821 Feb-03-2021, 01:22 PM
    Thread: "Silly Frenchman"? Really?
Post: RE: "Silly Frenchman"? Really?

User titles are Monty Python references. You can find out more here: https://python-forum.io/misc.php?action=help&hid=29
stranac Board 7 5,583 Feb-02-2021, 06:52 AM
    Thread: Unpacking a list
Post: RE: Unpacking a list

You are passing 2 arguments to .format(). Since your format string only has one placeholder, the second argument is ignored.
stranac General Coding Help 3 2,555 Dec-17-2020, 03:58 PM
    Thread: Help with my code due 11:59 pm, can you tell me where I went wrong and help fix it?
Post: RE: Help with my code due 11:59 pm, can you tell m...

I'm not sure when 11:59 PM is, so it might be too late for this particular question, but... My guess is that the reason you're not getting a reply is not asking a question. Quote:can you tell me wher...
stranac Homework 1 2,609 Dec-09-2020, 06:37 AM
    Thread: Django
Post: RE: Django

Any kind of filtering would probably be done by the database layer, which in your case would probably be done by django's ORM If you buy a template, you're getting files you can modify
stranac Web Scraping & Web Development 1 1,570 Dec-07-2020, 09:56 AM
    Thread: Collatz-problem
Post: RE: Collatz-problem

You're missing a return on line 10, so you're not returning the value of the recursive call. Also, you can use functools.lru_cache (or functools.cache if using 3.9) to take care of memoization, which ...
stranac Homework 2 2,157 Dec-07-2020, 09:46 AM
    Thread: to do list
Post: RE: to do list

Yeah, I was pretty sure we didn't. I deleted the records and disabled future logging in ACP. I made a table backup just in case, even though I don't think it will be useful.
stranac Board 55 34,287 Dec-04-2020, 06:46 AM
    Thread: How to access a web service from a python script?
Post: RE: How to access a web service from a python scri...

A response object (your p) has a .json() method. It's used in the first code snippet you see on the website.
stranac Web Scraping & Web Development 6 3,115 Dec-04-2020, 02:48 AM
    Thread: How to access a web service from a python script?
Post: RE: How to access a web service from a python scri...

Use requests.
stranac Web Scraping & Web Development 6 3,115 Dec-03-2020, 07:02 PM
    Thread: to do list
Post: RE: to do list

Do we care about preserving the user promotion log? mysql service basically froze when I tried to view it, which is unsurprising since the table is by far the largest in the database (just under 5GiB)...
stranac Board 55 34,287 Dec-03-2020, 06:38 PM
    Thread: to do list
Post: RE: to do list

I might have broken that this morning when messing with plugins... if that was implemented by modifying my customcodetags plugin, I've probably reverted it. Will try fixing. Edit: Looks like it's wor...
stranac Board 55 34,287 Dec-03-2020, 04:45 PM
    Thread: Subscribed Doesn't Notify via Email
Post: RE: Subscribed Doesn't Notify via Email

There seems to be a problem with the email account we use for sending these notifications. I tried checking it out, but my device is not recognized by google... Hopefully @metulburr will fix this soo...
stranac Board 3 2,573 Dec-03-2020, 03:38 PM
    Thread: Don't Understand Recursive Function
Post: RE: Don't Understand Recursive Function

This is the basic structure of your function: Output:rec_count(5) print 5 rec_count(4) print 5If we expand all calls like that, we get: Output:rec_count(5) print 5 rec_count(4) print 4 ...
stranac General Coding Help 9 3,574 Dec-02-2020, 06:03 PM
    Thread: Default values of arguments with the same id
Post: RE: Default values of arguments with the same id

Ah, the good old mutable defaults... https://python-forum.io/Thread-Basic-Var...on-Gotchas has an explanation of what's going on. Search for "empty list".
stranac General Coding Help 3 2,231 Dec-02-2020, 02:16 PM
    Thread: to do list
Post: RE: to do list

I noticed there are a few plugins that are slightly out of date. I'll start by updating those. Also, would it be ok to uninstall the inactive plugins? There's really no point updating them if we're n...
stranac Board 55 34,287 Dec-02-2020, 09:34 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020